Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail on 12-thread Ryzen 5 #479

Closed
mgorny opened this issue Apr 4, 2024 · 5 comments
Closed

Tests fail on 12-thread Ryzen 5 #479

mgorny opened this issue Apr 4, 2024 · 5 comments

Comments

@mgorny
Copy link
Contributor

mgorny commented Apr 4, 2024

First noticed on 2.10.0, reproduced with cb7aed5.

$ python -c 'import numexpr; numexpr.test()'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Numexpr version:   2.10.1.dev0
NumPy version:     1.26.4
Python version:    3.11.8 (main, Feb 11 2024, 17:30:38) [GCC 13.2.1 20240113]
Platform:          linux-x86_64-#1 SMP PREEMPT_DYNAMIC Wed Apr  3 15:46:55 -00 2024
CPU vendor:        
CPU model:         
CPU clock speed:    MHz
VML available?     False
Number of threads used by default: 8 (out of 12 detected cores)
Maximum number of threads: 64
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F..F....
======================================================================
FAIL: test_numexpr_max_threads_empty_string (numexpr.tests.test_numexpr.test_threading_config.test_numexpr_max_threads_empty_string)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/numexpr/.venv/lib/python3.11/site-packages/numexpr/tests/test_numexpr.py", line 1174, in test_numexpr_max_threads_empty_string
    self.assertEqual(detect_number_of_cores(), numexpr._init_num_threads())
AssertionError: 12 != 8

======================================================================
FAIL: test_omp_num_threads_empty_string (numexpr.tests.test_numexpr.test_threading_config.test_omp_num_threads_empty_string)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/numexpr/.venv/lib/python3.11/site-packages/numexpr/tests/test_numexpr.py", line 1167, in test_omp_num_threads_empty_string
    self.assertEqual(detect_number_of_cores(), numexpr._init_num_threads())
AssertionError: 12 != 8

----------------------------------------------------------------------
Ran 5538 tests in 3.164s

FAILED (failures=2)
@FrancescAlted
Copy link
Contributor

Strange. 2.9.x is working well in that box?

@mgorny
Copy link
Contributor Author

mgorny commented Apr 4, 2024

Yes.

$ pip install numexpr==2.9.0
Collecting numexpr==2.9.0
  Downloading numexpr-2.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.9 kB)
Collecting numpy>=1.13.3 (from numexpr==2.9.0)
  Using cached numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
Downloading numexpr-2.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (377 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 377.5/377.5 kB 1.9 MB/s eta 0:00:00
Using cached numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
Installing collected packages: numpy, numexpr
Successfully installed numexpr-2.9.0 numpy-1.26.4
$ python -c 'import numexpr; numexpr.test()'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Numexpr version:   2.9.0
NumPy version:     1.26.4
Python version:    3.11.8 (main, Feb 11 2024, 17:30:38) [GCC 13.2.1 20240113]
Platform:          linux-x86_64-#1 SMP PREEMPT_DYNAMIC Wed Apr  3 15:46:55 -00 2024
CPU vendor:        
CPU model:         
CPU clock speed:    MHz
VML available?     False
Number of threads used by default: 8 (out of 12 detected cores)
Maximum number of threads: 64
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 5536 tests in 4.126s

OK
$ pip install numexpr==2.10.0
Collecting numexpr==2.10.0
  Downloading numexpr-2.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.9 kB)
Requirement already satisfied: numpy>=1.19.3 in ./venv/lib/python3.11/site-packages (from numexpr==2.10.0) (1.26.4)
Downloading numexpr-2.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (378 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 378.3/378.3 kB 2.0 MB/s eta 0:00:00
Installing collected packages: numexpr
  Attempting uninstall: numexpr
    Found existing installation: numexpr 2.9.0
    Uninstalling numexpr-2.9.0:
      Successfully uninstalled numexpr-2.9.0
Successfully installed numexpr-2.10.0
$ python -c 'import numexpr; numexpr.test()'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Numexpr version:   2.10.0
NumPy version:     1.26.4
Python version:    3.11.8 (main, Feb 11 2024, 17:30:38) [GCC 13.2.1 20240113]
Platform:          linux-x86_64-#1 SMP PREEMPT_DYNAMIC Wed Apr  3 15:46:55 -00 2024
CPU vendor:        
CPU model:         
CPU clock speed:    MHz
VML available?     False
Number of threads used by default: 8 (out of 12 detected cores)
Maximum number of threads: 64
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F..F....
======================================================================
FAIL: test_numexpr_max_threads_empty_string (numexpr.tests.test_numexpr.test_threading_config.test_numexpr_max_threads_empty_string)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/venv/lib/python3.11/site-packages/numexpr/tests/test_numexpr.py", line 1174, in test_numexpr_max_threads_empty_string
    self.assertEqual(detect_number_of_cores(), numexpr._init_num_threads())
AssertionError: 12 != 8

======================================================================
FAIL: test_omp_num_threads_empty_string (numexpr.tests.test_numexpr.test_threading_config.test_omp_num_threads_empty_string)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/venv/lib/python3.11/site-packages/numexpr/tests/test_numexpr.py", line 1167, in test_omp_num_threads_empty_string
    self.assertEqual(detect_number_of_cores(), numexpr._init_num_threads())
AssertionError: 12 != 8

----------------------------------------------------------------------
Ran 5538 tests in 4.597s

FAILED (failures=2)

@FrancescAlted
Copy link
Contributor

Yup. The only reason that I can see for that is PR #472, but I don't immediately see what the issue could be. Any hint @phofl?

@FrancescAlted
Copy link
Contributor

Ah, I think I know what it is: https://github.com/pydata/numexpr/blob/master/numexpr/utils.py#L146-L149

        if n_cores > 8:
            # The historical 'safety' limit.
            log.info('Note: NumExpr detected %d cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.'%n_cores)
            n_cores = 8

The cutoff to 8 cores is because we have never experienced a speedup with more than 8 threads, and often times, slowdowns occur in these circumstances. Perhaps it is time to measure with more modern machines and decide whether to increase the threshold?

Meanwhile, the tests should be updated indeed. @phofl would you like to tackle this?

FrancescAlted added a commit that referenced this issue May 4, 2024
Fix tests on nthreads detection (closes: #479)
@mgorny
Copy link
Contributor Author

mgorny commented May 4, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants