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.

AMD CPU limitation

See original GitHub issue

Describe the bug AMD CPU produces significantly worse performance than Intel CPUs in the “Simple PYSR Example” from pysr_demo.ipynb. AMD appears limited to utilize one core while Intel can utilize all cores.

Additional context Tested CPU / OS:

  • Ryzen 5900x (12 cores / 24 threads): 6% CPU usage (using 1 core, 1x baseline)
  • i5 2020 macbook pro (4 cores / 8 threads): 60% CPU usage (using all cores, 2.1 x faster than the AMD)
  • i5 6600k windows 10 desktop (4 cores / 4 threads): 80% CPU usage (using all cores,1.2 x faster than the AMD)

Running the PyTorch trainer In [12], with gpus=0 utilizes all CPU cores on all systems tested.

Version (please complete the following information):

  • OS: macOS 12.4, intel (OK), Windows 10, intel (OK), Windows 11, AMD (Problem)

  • Version: PYSR 0.9.3

  • Python 3.9 venv in pycharm 2022.1.3

  • Does the bug appear with the latest version of PySR? Yes

Configuration

  • What are your PySR settings? Exactly the Simple PySR example found in pysr_demo.ipynb
default_pysr_params = dict(
    populations=30,
    procs=4,
    model_selection="best",
)
# Learn equations
model = PySRRegressor(
    niterations=30,
    binary_operators=["plus", "mult"],
    unary_operators=["cos", "exp", "sin"],
    **default_pysr_params
)

model.fit(X, y)
  • What dataset are you running on?
# Dataset
np.random.seed(0)
X = 2 * np.random.randn(100, 5)
y = 2.5382 * np.cos(X[:, 3]) + X[:, 0] ** 2 - 2

Error message No message, just performance loss on the AMD chip.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mtaylorDWcommented, Jul 6, 2022

Thanks @MilesCranmer , multithreading=False gave a 2-3x increase in cpu utilization on the AMD machine, utilizing 20% of the CPU resources and doubles the MBP’s speed in cycles per second. I was then able to saturate the CPU by cranking up the population_size parameter, which previously had no effect.

0reactions
MilesCranmercommented, Jul 6, 2022

As a quick fix, if you set multithreading=False, it will use multiprocessing instead, which is almost guaranteed to fix this, and give you the same performance as on other machines. Windows seems to have issues with the multithreading backend of PySR for some reason.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the honest limitations/issues with AMD CPUs ...
AMD has slightly lower single core performance, much better multithread performance, cheaper price. Ryzen is a little more sensitive to memory ...
Read more >
AMD clarifies power usage limits of its next-gen AM5 CPUs ...
On Thursday, AMD clarified to Tom's Hardware that the 170 W number refers to the maximum TDP of socket AM5 processors and that...
Read more >
AMD Processor in a box (PIB) 3 Year Limited Warranty
AMD warrants that processors sold through the AMD Processor in a Box Program, which have a "qualifying" serial number, when properly installed and...
Read more >
Understanding CPU limitations with memory | Crucial.com
As an example a CPU like the i7-6700K can handle up to 64GB of RAM, and has added DDR4 support up to 2133...
Read more >
How to Limit the CPU Usage for a Single Program in Windows
Unless you are running heavy programs on a fairly older processor, your CPU usage should remain under 80 percent. Even if it shoots...
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