8000 ENH: Use openmp on x86-simd-sort to speed up np.sort and np.argsort by r-devulap · Pull Request #28619 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Use openmp on x86-simd-sort to speed up np.sort and np.argsort #28619

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

Merged
merged 10 commits into from
May 14, 2025
Prev Previous commit
Next Next commit
TST: Add np.argsort test for openmp paths
  • Loading branch information
Raghuveer Devulapalli committed May 1, 2025
commit 21bc19f1349f0bff978cac6dde80ea4db6374f83
11 changes: 10 additions & 1 deletion numpy/_core/tests/test_multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -10296,9 +10296,18 @@ def test_argsort_int(N, dtype):
@pytest.mark.parametrize("dtype", [np.float16, np.float32, np.float64])
def test_sort_largearrays(dtype):
N = 1000000
arr = np.random.rand(N)
rnd = np.random.RandomState(1100710816)
arr = -0.5 + rnd.random(N).astype(dtype)
assert_equal(np.sort(arr, kind='quick'), np.sort(arr, kind='heap'))

# Test large arrays that leverage openMP implementations from x86-simd-sort:
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
def test_argsort_largearrays(dtype):
N = 1000000
rnd = np.random.RandomState(1100710816)
arr = -0. 4CD2 5 + rnd.random(N).astype(dtype)
assert_arg_sorted(arr, np.argsort(arr, kind='quick'))

@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")
def test_gh_22683():
b = 777.68760986
Expand Down
0