getkeops / keops

KErnel OPerationS, on CPUs and GPUs, with autodiff and without memory overflows
https://www.kernel-operations.io
MIT License
1.04k stars 64 forks source link

Install error for v2.0a1 (alpha release), "not enough values to unpack" in LoadKeOps.py #215

Closed jeanfeydy closed 2 years ago

jeanfeydy commented 2 years ago

Hi @joanglaunes , @bcharlier ,

Thanks again for your work on the release, this is fantastic! I am currently going through all of my machines to test KeOps v2.0 with:

pip install pykeops==2.0b0
python -c 'import pykeops; pykeops.test_numpy_bindings(); pykeops.test_torch_bindings()'

Unfortunately, this code doesn't work properly on my main laptop. For reference, this is a Dell XPS 15 with an old GPU (compute capability 5) and deprecated CUDA drivers. Ideally, we would like to have a warning about CUDA missing, and still have the KeOps CPU version running. The error message reads as follows:

(base) jean@jean-XPS-15-9550:~$ python
Python 3.8.8 (default, Apr 13 2021, 19:58:26) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> import pykeops
[KeOps] Warning : cuda was detected, but driver API could not be initialized. Switching to cpu only.

>>> pykeops.__version__
'2.0b0'

>>> pykeops.__file__
'/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/__init__.py'

>>> pykeops.test_numpy_bindings()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/test/install.py", line 21, in test_numpy_bindings
    if np.allclose(my_conv(x, y).flatten(), expected_res):
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/numpy/generic/generic_red.py", line 302, in __call__
    self.myconv = keops_binder["nvrtc" if tagCPUGPU else "cpp"](
  File "/home/jean/anaconda3/lib/python3.8/site-packages/keops/utils/Cache.py", line 64, in __call__
    obj = self.cls(*args)
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/common/keops_io/LoadKeOps_cpp.py", line 72, in __init__
    super().__init__(*args, fast_init=fast_init)
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/common/keops_io/LoadKeOps.py", line 18, in __init__
    self.init(*args)
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/common/keops_io/LoadKeOps.py", line 107, in init
    (
ValueError: not enough values to unpack (expected 18, got 17)

>>> pykeops.test_torch_bindings()
/home/jean/anaconda3/lib/python3.8/site-packages/torch/cuda/__init__.py:80: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 9010). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at  ../c10/cuda/CUDAFunctions.cpp:112.)                                                                                                          
  return torch._C._cuda_getDeviceCount() > 0                                                                             
Traceback (most recent call last):                                                                                       
  File "<stdin>", line 1, in <module>                                                                                    
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/test/install.py", line 47, in test_torch_bindings       
    my_conv(x, y).view(-1), torch.tensor(expected_res).type(torch.float32)
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/torch/generic/generic_red.py", line 623, in __call__
    out = GenredAutograd.apply(
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/torch/generic/generic_red.py", line 77, in forward
    myconv = keops_binder["nvrtc" if tagCPUGPU else "cpp"](
  File "/home/jean/anaconda3/lib/python3.8/site-packages/keops/utils/Cache.py", line 64, in __call__
    obj = self.cls(*args)
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/common/keops_io/LoadKeOps_cpp.py", line 72, in __init__
    super().__init__(*args, fast_init=fast_init)
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/common/keops_io/LoadKeOps.py", line 18, in __init__
    self.init(*args)
  File "/home/jean/anaconda3/lib/python3.8/site-packages/pykeops/common/keops_io/LoadKeOps.py", line 107, in init
    (
ValueError: not enough values to unpack (expected 18, got 17)

I will keep running the tests on other configurations, ask colleagues to do the same on their clusters, and keep you updated on the documentation :-)

See you soon, Jean

jeanfeydy commented 2 years ago

Please note that I reproduced the same error on my cluster at Imperial College, in a fresh conda environment. On the other hand, things work perfectly fine on Colab with next to zero dependencies, that's really impressive :-)

joanglaunes commented 2 years ago

Hello @jeanfeydy , This is really weird, we have indeed changed the number of arguments returned from get_keops_dll a few days ago, but it should be well managed in all files. Would it be possible that your version of the keops package (not pykeops) corresponds to a previous version of the python_engine branch ? What does return import keops; keops.__version__ ? Otherwise, can you tell if it fails on the cluster with the Gpu or Cpu version ?

jeanfeydy commented 2 years ago

Hi @joanglaunes,

You were right: I had simply forgotten to use pykeops.clean_pykeops()... I'll let you know if I encounter any issue on other configurations, but so far so good :-)

See you on Friday, Jean