Skip to content

Fix cupy error in KernelDensity with epanechnikov#6388

Merged
rapids-bot[bot] merged 2 commits intorapidsai:branch-25.04from
jcrist:fix-epanechnikov-kernel-density
Mar 5, 2025
Merged

Fix cupy error in KernelDensity with epanechnikov#6388
rapids-bot[bot] merged 2 commits intorapidsai:branch-25.04from
jcrist:fix-epanechnikov-kernel-density

Conversation

@jcrist
Copy link
Copy Markdown
Member

@jcrist jcrist commented Mar 3, 2025

This works around an upstream bug in cupy where cupy.fuse sometimes fails to properly compile when executing operations on scalars. It's unclear to me why some scalar operations succeed while others fail, but as is epanechnikov was the only kernel that ran into this issue. Rewriting it slightly to work around the problem for now.

Fixes the nightly test failure for test_kernel_density
Fixes #6173.

This works around an upstream bug in `cupy` where `cupy.fuse`
_sometimes_ fails to properly compile when executing operations on
scalars. It's unclear to me why some scalar operations succeed while
others fail, but as is `epanechnikov` was the only kernel that ran into
this issue. Rewriting it slightly to work around the problem for now.
@jcrist jcrist requested a review from a team as a code owner March 3, 2025 20:43
@jcrist jcrist requested review from bdice and viclafargue March 3, 2025 20:43
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Mar 3, 2025
@jcrist jcrist added bug Something isn't working non-breaking Non-breaking change Cython / Python Cython or Python issue and removed Cython / Python Cython or Python issue labels Mar 3, 2025
@jcrist
Copy link
Copy Markdown
Member Author

jcrist commented Mar 3, 2025

Hypothesis tests:

$ HYPOTHESIS_ENABLED=true py.test python/cuml/cuml/tests/test_kernel_density.py -k test_kernel_density -vv --pdb -s
========================================== test session starts ===========================================
platform linux -- Python 3.12.9, pytest-7.4.4, pluggy-1.5.0 -- /raid/jcristharif/miniforge3/envs/cuml-dev/bin/python3.12
cachedir: .pytest_cache
benchmark: 5.1.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
hypothesis profile 'unit' -> max_examples=20, deadline=timedelta(milliseconds=2000), suppress_health_check=[HealthCheck.data_too_large, HealthCheck.too_slow], phases=(Phase.explicit, Phase.reuse, Phase.generate, Phase.target, Phase.shrink), database=DirectoryBasedExampleDatabase(PosixPath('/raid/jcristharif/cuml/.hypothesis/examples'))
rootdir: /raid/jcristharif/cuml/python/cuml
configfile: pyproject.toml
plugins: cov-6.0.0, cases-3.8.6, benchmark-5.1.0, xdist-3.6.1, hypothesis-6.125.1
collected 5 items

python/cuml/cuml/tests/test_kernel_density.py::test_kernel_density PASSED
python/cuml/cuml/tests/test_kernel_density.py::test_logaddexp PASSED
python/cuml/cuml/tests/test_kernel_density.py::test_metric_params PASSED
python/cuml/cuml/tests/test_kernel_density.py::test_grid_search PASSED
python/cuml/cuml/tests/test_kernel_density.py::test_not_fitted PASSED

@jcrist
Copy link
Copy Markdown
Member Author

jcrist commented Mar 5, 2025

/merge

@rapids-bot rapids-bot Bot merged commit f926245 into rapidsai:branch-25.04 Mar 5, 2025
@jcrist jcrist deleted the fix-epanechnikov-kernel-density branch March 5, 2025 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Cython / Python Cython or Python issue non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Nightly CI issue: kerneldensity cupy fusekernels fail hypothesis flaky test in CUDA 12.0.1 job with cupy compilation error.

4 participants