question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance speed-up options?

See original GitHub issue

Hello Miles! Thank you for open-sourcing this powerful tool! I am working on including PySR in my own research, and running into some performance bottlenecks.

I found regressing a simple equation (e.g. the quick-start example) takes roughly 2 minutes. Ideally, I am aiming to reduce that time to ~30 seconds. Would you give me some pointers on this? Meanwhile, I will try break down the challenge in several pieces:

  1. Activating a new environment at each API call: I noticed that a new Julia (?) environment is created each time I call pysr() api (see terminal output below). Could we keep the environment up so we can skip this process for subsequent calls?
Running on julia -O3 /tmp/tmpe5qmgemh/runfile.jl
  Activating environment at `~/anaconda3/envs/rw/lib/python3.7/site-packages/Project.toml`
    Updating registry at `~/.julia/registries/General`
  No Changes to `~/anaconda3/envs/rw/lib/python3.7/site-packages/Project.toml`
  No Changes to `~/anaconda3/envs/rw/lib/python3.7/site-packages/Manifest.toml`
Activating environment on workers.
  Activating environment at `~/anaconda3/envs/rw/lib/python3.7/site-packages/Project.toml`
  Activating environment at `~/anaconda3/envs/rw/lib/python3.7/site-packages/Project.toml`
  Activating  Activating  environment at `~/anaconda3/envs/rw/lib/python3.7/site-packages/Project.toml`
environment at `~/anaconda3/envs/rw/lib/python3.7/site-packages/Project.toml`
  Activating  Activating environment at `~/anaconda3/envs/rw/lib/python3.7/site-packages/Project.toml` 
environment at `~/anaconda3/envs/rw/lib/python3.7/site-packages/Project.toml`
Importing installed module on workers...Finished!
Started!
  1. If the above wouldn’t work, then allowing y to be vector-valued (as mentioned in #35) would be a second-best option! Even better, if we could create a “batched” version of pysr(X, y) api pysr_batched(X, y), such that X and y are python lists, and we return the results in a list as well, so that we only generate one Julia script, and call os.system() once to keep the Julia environment up.

  2. Multi-threading: I noticed that increasing procs from 4 to 8 resulted in slightly longer running time. I am running on a 8-core 16-tread CPU. Did I do something dumb?

  3. I went into pysr/sr.py and added runtests=false flag in line 438 and 440. That saved ~20 seconds.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:20 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
MilesCranmercommented, Jun 8, 2021

It doesn’t say “Progress: 1 / …”, right? It’s stuck at “Progress: 0”? This is expected behaviour, although maybe I should wait for some equations before starting the printing.

By the way - on PySR 0.6.5, which will be up later today - I added a patch which boosts performance by nearly 2x. It turns out the optimization library I was using (main bottleneck) did not require a differentiable function, so I implemented a faster non-differentiable version.

1reaction
MilesCranmercommented, Jun 20, 2021

More ideas, which would probably help quite a bit:

  1. Use Threads instead of Distributed. That would cut down on startup time quite a bit, since you are only using a single Julia process instead of one for each procs.
  2. Get PySR to start Julia with workers julia -p {procs}, rather than create them dynamically and copy-in user definitions.
  3. Make EquationSearch specialize to type of parallelism, rather than have it as a variable.
Read more comments on GitHub >

github_iconTop Results From Across the Web

17 ways to speed up Windows 10 | Computerworld
17 ways to speed up Windows 10 ; 11. Disable shadows, animations and visual effects · performance options ; 12. Disable transparency ·...
Read more >
12 Simple Tips to Speed Up Windows | PCMag
Head to the Settings app's System > Power & Sleep option and then click the Additional Power Settings link. From here, click the...
Read more >
Speedup - Wikipedia
In computer architecture, speedup is a number that measures the relative performance of two systems processing the same problem. More technically, it is...
Read more >
17 Ways to Speed up Windows 10 and 11 - Business Insider
17 tips to speed up Windows 10 and 11, from disabling special effects to managing bloated apps · 1. Click on Start and...
Read more >
Tips to improve PC performance in Windows - Microsoft Support
1. Make sure you have the latest updates for Windows and device drivers · Select the Start button, then select Settings > Windows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found