-
-
Notifications
You must be signed in to change notification settings - Fork 776
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
feat: port scipy.stats.kstat
#8305
base: main
Are you sure you want to change the base?
Conversation
|
||
|
||
class TestKstat: | ||
def test_moments_normal_distribution(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a helper decorator cupy.testing.for_all_dtypes
to make a parametrized test across dtypes. Would you use it to check with other dtypes?
4*N*(N+1)*S[1]*S[3] + N*N*(N+1)*S[4]) / | ||
(N*(N-1.0)*(N-2.0)*(N-3.0))) | ||
else: | ||
raise ValueError("Should not be here.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: the same message as scipy
/test mini |
When I tried to test this on $ python3 -m pytest tests/cupyx_tests/scipy_tests/stats_tests/test_stats.py
=================================================== test session starts ===================================================
platform linux -- Python 3.8.10, pytest-8.1.1, pluggy-1.5.0
rootdir: /home/pranav/repos/cupy
configfile: setup.cfg
collected 0 items / 1 error
========================================================= ERRORS ==========================================================
________________________ ERROR collecting tests/cupyx_tests/scipy_tests/stats_tests/test_stats.py _________________________
ImportError while importing test module '/home/pranav/repos/cupy/tests/cupyx_tests/scipy_tests/stats_tests/test_stats.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
cupy/__init__.py:17: in <module>
from cupy import _core # NOQA
cupy/_core/__init__.py:3: in <module>
from cupy._core import core # NOQA
E ImportError: cannot import name 'core' from partially initialized module 'cupy._core' (most likely due to a circular import) (/home/pranav/repos/cupy/cupy/_core/__init__.py)
The above exception was the direct cause of the following exception:
/usr/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/cupyx_tests/scipy_tests/stats_tests/test_stats.py:4: in <module>
import cupy
cupy/__init__.py:19: in <module>
raise ImportError(f'''
E ImportError:
E ================================================================
E Failed to import CuPy.
E
E If you installed CuPy via wheels (cupy-cudaXXX or cupy-rocm-X-X), make sure that the package matches with the version of CUDA or ROCm installed.
E
E On Linux, you may need to set LD_LIBRARY_PATH environment variable depending on how you installed CUDA/ROCm.
E On Windows, try setting CUDA_PATH environment variable.
E
E Check the Installation Guide for details:
E https://docs.cupy.dev/en/latest/install.html
E
E Original error:
E ImportError: cannot import name 'core' from partially initialized module 'cupy._core' (most likely due to a circular import) (/home/pranav/repos/cupy/cupy/_core/__init__.py)
E ================================================================
================================================= short test summary info =================================================
ERROR tests/cupyx_tests/scipy_tests/stats_tests/test_stats.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================== 1 error in 0.26s ================================================== |
I usually see such an error when I checked out another branch, building cupy there, and going back to the original branch. Would you try to build cupy on your local again? Would you try to build cupy on your environment again?
|
I have remote access to gpu, which I connect via $ pip3 install -e .
Obtaining file:///home/pranav/repos/cupy
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/pranav/repos/cupy/setup.py'"'"'; __file__='"'"'/home/pranav/repos/cupy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
cwd: /home/pranav/repos/cupy/
Complete output (8 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/pranav/repos/cupy/setup.py", line 14, in <module>
ctx = cupy_builder.Context(source_root)
File "/home/pranav/repos/cupy/install/cupy_builder/_context.py", line 66, in __init__
hasher = hashlib.sha1(usedforsecurity=False)
TypeError: 'usedforsecurity' is an invalid keyword argument for openssl_sha1()
Generating cache key from header files...
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. |
Which python version are you using? |
$ python --version
Python 2.7.18 |
CuPy runs on python 3.9 or higher. Would you install newer Python 3 using pyenv, then try to build CuPy on it? |
I created a conda environment, installed python 3.12, and executed: $ pip install -e .
Obtaining file:///home/pranav/repos/cupy
Preparing metadata (setup.py) ... done
Collecting numpy<1.29,>=1.22 (from cupy==13.0.0rc1)
Downloading numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.0/61.0 kB 447.7 kB/s eta 0:00:00
Collecting fastrlock>=0.5 (from cupy==13.0.0rc1)
Using cached fastrlock-0.8.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl.metadata (9.3 kB)
Using cached fastrlock-0.8.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_28_x86_64.whl (52 kB)
Downloading numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.0/18.0 MB 21.7 MB/s eta 0:00:00
Installing collected packages: fastrlock, numpy, cupy
Running setup.py develop for cupy
.... |
Is it expected to take long time? |
Yes. I suppose it has finished as it is one hour after your last comment. |
Towards #6324
SciPy: https://github.com/scipy/scipy/blob/main/scipy/stats/_morestats.py#L221
SciPy API: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kstat.html#scipy.stats.kstat