Giter Club home page Giter Club logo

Comments (5)

MilesCranmer avatar MilesCranmer commented on May 16, 2024

Quick update: it seems like adding @inbounds to the following loop:

@inbounds for i=1:npopulations

seems to help significantly. This is one difference with the Threads code - I declare @inbounds at the start of this loop.

It seems as though Julia might have been checking for race conditions otherwise. Yet, I know that race conditions aren't possible in this section of the code, since the hall of fame update is only done by the head worker, so @inbounds seems to help the compiler realize that.

This is essentially a 2-3x speedup!

Also: I need to add a proper benchmark test. I like numpy's tool https://asv.readthedocs.io/en/stable/ since it can be used to measure speed regressions across a commit history.

from pysr.

MilesCranmer avatar MilesCranmer commented on May 16, 2024

Seems like there are still significant speed reductions with a recent commit... See the cycles per second of travis build 39: https://travis-ci.com/github/MilesCranmer/PySR/builds/186862848, which gives 5.030e+04 cycles per second.

But the most recent travis build https://travis-ci.com/github/MilesCranmer/PySR/builds/187199749 gets 1.870e+04 cycles per second for what (I think) is the same test...

from pysr.

MilesCranmer avatar MilesCranmer commented on May 16, 2024

Very strange... maybe it's a missing @async somewhere?

See diff in julia/sr.jl here: 121e6ac...master

from pysr.

MilesCranmer avatar MilesCranmer commented on May 16, 2024

Okay, fixed on master. Will push new pip version soon.

The issue was the nested recursive threading introduced in 3a578d2.

Reading this post: https://julialang.org/blog/2019/07/multithreading/, where they do this same nested recursive threading to compute Fibonnaci numbers, made me think that it could be used for all operations on binary trees in PySR. It is supposed to be fine with millions of threads, and threads calling threads calling threads...

But for whatever reason it seems to have hurt the performance a lot - perhaps it doesn't play nice with Distributed also being used.

from pysr.

MilesCranmer avatar MilesCranmer commented on May 16, 2024

Benchmarks on v0.3.X with 4-core runs have been added to the benchmarks/ folder. They are copied below:

Version Cycles/second
v0.3.2 37526
v0.3.3 38400
v0.3.4 28700
v0.3.5 32700
v0.3.6 25900
v0.3.7 26600
v0.3.8 7470
v0.3.9 6760
v0.3.10
v0.3.11 19500
v0.3.12 19000
v0.3.13 15200
v0.3.14 14700
v0.3.15 42000

So v0.3.15 has gotten rid of the speed regressions throughout v0.3.

from pysr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.