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

undefined symbol: cusparseScsrgemm #1

Closed
phi-go opened this issue Aug 15, 2018 · 34 comments
Closed

undefined symbol: cusparseScsrgemm #1

phi-go opened this issue Aug 15, 2018 · 34 comments

Comments

@phi-go
Copy link

phi-go commented Aug 15, 2018

Hi,

I'm trying to get the torch-geometry package to work and everything installs just fine.

But I'm getting following error during import from torch_sparse:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.6/site-packages/torch_sparse/__init__.py", line 4, in <module>
    from .spspmm import spspmm
  File "/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.6/site-packages/torch_sparse/spspmm.py", line 7, in <module>
    import spspmm_cuda
ImportError: /home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.6/site-packages/spspmm_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cusparseScsrgemm

For me that can be reproduced with:

#!/bin/bash
pipenv --python 3.6
export PATH=/opt/cuda/bin:$PATH
export CPATH=/opt/cuda/include
pipenv install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp36-cp36m-linux_x86_64.whl
pipenv install torchvision
pipenv install cffi
pipenv install torch-scatter
pipenv install torch-sparse
# pipenv install torch-cluster
# pipenv install torch-spline-conv
# pipenv install torch-geometric
pipenv run python -c "from torch_sparse import spmm"

More info:

$ pipenv run python -c "import torch; print(torch.__version__)"
0.4.1

I'm not sure if this is a problem on my side or not. Would appreciate your help.

@rusty1s
Copy link
Owner

rusty1s commented Aug 15, 2018

I will look into this. In the meantime, you can clone torch-sparse locally, remove the spspmm import in torch_sparse/init.py and run python setup.py install. Sparse sparse matrix multiplication currently has no use case in torch_geometric, but this may change in the near future.

@phi-go
Copy link
Author

phi-go commented Aug 16, 2018

Thank you for your help. The workaround works fine. Let me know, if you need more information.

@rusty1s
Copy link
Owner

rusty1s commented Aug 16, 2018

Does the file cusparse.h exist in cuda/include?

@phi-go
Copy link
Author

phi-go commented Aug 16, 2018

Yes it does, also a cusparse_v2.h if that matters.

$ la /opt/cuda/include/
total 72M
drwxr-xr-x  5 root root 4.0K Aug 15 15:29 ./
drwxr-xr-x 16 root root 4.0K Aug 15 15:29 ../
-rw-r--r--  1 root root 3.1K Jul 12 19:19 builtin_types.h
-rw-r--r--  1 root root  15K Jul 12 19:19 channel_descriptor.h
drwxr-xr-x  2 root root 4.0K Jul 14 16:38 CL/
-rw-r--r--  1 root root 2.5K Jul 12 19:19 common_functions.h
-rwxr-xr-x  1 root root  38K Jul 12 19:19 cooperative_groups.h*
-rwxr-xr-x  1 root root 8.6K Jul 12 19:19 cooperative_groups_helpers.h*
drwxr-xr-x  2 root root 4.0K Jul 14 16:38 crt/
-rw-r--r--  1 root root 200K Jul 12 19:19 cublas_api.h
-rw-r--r--  1 root root  33K Jul 12 19:19 cublas.h
-rw-r--r--  1 root root  11K Jul 12 19:19 cublas_v2.h
-rw-r--r--  1 root root  41K Jul 12 19:19 cublasXt.h
-rw-r--r--  1 root root  12K Jul 12 19:19 cuComplex.h
-rw-r--r--  1 root root  15K Jul 12 19:19 cuda_device_runtime_api.h
-rw-r--r--  1 root root  31K Jul 12 19:19 cudaEGL.h
-rw-r--r--  1 root root  31K Jul 12 19:19 cuda_egl_interop.h
-rw-r--r--  1 root root  70K Jul 12 19:19 cuda_fp16.h
-rw-r--r--  1 root root  71K Jul 12 19:19 cuda_fp16.hpp
-rw-r--r--  1 root root  24K Jul 12 19:19 cudaGL.h
-rw-r--r--  1 root root  19K Jul 12 19:19 cuda_gl_interop.h
-rw-r--r--  1 root root 491K Jul 12 19:19 cuda.h
-rw-r--r--  1 root root 4.1K Jul 12 19:19 cudalibxt.h
-rw-r--r--  1 root root  56K Jul 12 19:19 cuda_occupancy.h
-rw-r--r--  1 root root 6.0K Jul 12 19:19 cuda_profiler_api.h
-rw-r--r--  1 root root 6.1K Jul 12 19:19 cudaProfiler.h
-rw-r--r--  1 root root 328K Jul 12 19:19 cuda_runtime_api.h
-rw-r--r--  1 root root  88K Jul 12 19:19 cuda_runtime.h
-rw-r--r--  1 root root 4.3K Jul 12 19:19 cuda_surface_types.h
-rw-r--r--  1 root root 4.8K Jul 12 19:19 cuda_texture_types.h
-rw-r--r--  1 root root  14K Jul 12 19:19 cudaVDPAU.h
-rw-r--r--  1 root root 7.5K Jul 12 19:19 cuda_vdpau_interop.h
-r--r--r--  1 root root  99K Aug 14 19:53 cudnn.h
-rw-r--r--  1 root root  13K Jul 12 19:19 cufft.h
-rw-r--r--  1 root root  18K Jul 12 19:19 cufftw.h
-rw-r--r--  1 root root  12K Jul 12 19:19 cufftXt.h
-rw-r--r--  1 root root  11K Jul 12 19:19 curand_discrete2.h
-rw-r--r--  1 root root 3.5K Jul 12 19:19 curand_discrete.h
-rw-r--r--  1 root root 3.7K Jul 12 19:19 curand_globals.h
-rw-r--r--  1 root root  42K Jul 12 19:19 curand.h
-rw-r--r--  1 root root  48K Jul 12 19:19 curand_kernel.h
-rw-r--r--  1 root root  28K Jul 12 19:19 curand_lognormal.h
-rw-r--r--  1 root root 165K Jul 12 19:19 curand_mrg32k3a.h
-rw-r--r--  1 root root 271K Jul 12 19:19 curand_mtgp32dc_p_11213.h
-rw-r--r--  1 root root 7.8K Jul 12 19:19 curand_mtgp32.h
-rw-r--r--  1 root root  18K Jul 12 19:19 curand_mtgp32_host.h
-rw-r--r--  1 root root  14K Jul 12 19:19 curand_mtgp32_kernel.h
-rw-r--r--  1 root root  27K Jul 12 19:19 curand_normal.h
-rw-r--r--  1 root root 4.6K Jul 12 19:19 curand_normal_static.h
-rw-r--r--  1 root root 7.0K Jul 12 19:19 curand_philox4x32_x.h
-rw-r--r--  1 root root  30K Jul 12 19:19 curand_poisson.h
-rw-r--r--  1 root root 327K Jul 12 19:19 curand_precalc.h
-rw-r--r--  1 root root  17K Jul 12 19:19 curand_uniform.h
-rw-r--r--  1 root root 3.7K Jul 12 19:19 cusolver_common.h
-rw-r--r--  1 root root  48K Jul 12 19:19 cusolverDn.h
-rw-r--r--  1 root root  18K Jul 12 19:19 cusolverRf.h
-rw-r--r--  1 root root  23K Jul 12 19:19 cusolverSp.h
-rw-r--r--  1 root root  27K Jul 12 19:19 cusolverSp_LOWLEVEL_PREVIEW.h
-rw-r--r--  1 root root 376K Jul 12 19:19 cusparse.h
-rw-r--r--  1 root root 2.6K Jul 12 19:19 cusparse_v2.h
-rw-r--r--  1 root root  12K Jul 12 19:19 device_atomic_functions.h
-rw-r--r--  1 root root 8.1K Jul 12 19:19 device_atomic_functions.hpp
-rw-r--r--  1 root root 2.5K Jul 12 19:19 device_double_functions.h
-rw-r--r--  1 root root 2.5K Jul 12 19:19 device_functions.h
-rw-r--r--  1 root root 3.8K Jul 12 19:19 device_launch_parameters.h
-rw-r--r--  1 root root 3.1K Jul 12 19:19 device_types.h
-rw-r--r--  1 root root 4.6K Jul 12 19:19 driver_functions.h
-rw-r--r--  1 root root  75K Jul 12 19:19 driver_types.h
-rw-r--r--  1 root root  70K Jul 12 19:19 dynlink_cuda_cuda.h
-rw-r--r--  1 root root  527 Jul 12 19:19 dynlink_cuda.h
-rw-r--r--  1 root root  45K Jul 12 19:19 dynlink_cuviddec.h
-rw-r--r--  1 root root  22K Jul 12 19:19 dynlink_nvcuvid.h
-rw-r--r--  1 root root 4.5K Jul 12 19:19 fatBinaryCtl.h
-rw-r--r--  1 root root 2.8K Jul 12 19:19 fatbinary.h
-rw-r--r--  1 root root 2.5K Jul 12 19:19 host_config.h
-rw-r--r--  1 root root 2.5K Jul 12 19:19 host_defines.h
-rw-r--r--  1 root root 3.5K Jul 12 19:19 library_types.h
-rw-r--r--  1 root root 7.5K Jul 12 19:19 math_constants.h
-rw-r--r--  1 root root 2.5K Jul 12 19:19 math_functions.h
-rw-r--r--  1 root root 2.5K Jul 12 19:19 mma.h
-rw-r--r--  1 root root 6.2K Jul 12 19:19 nppcore.h
-rw-r--r--  1 root root  24K Jul 12 19:19 nppdefs.h
-rw-r--r--  1 root root 2.8K Jul 12 19:19 npp.h
-rw-r--r--  1 root root 560K Jul 12 19:19 nppi_arithmetic_and_logical_operations.h
-rw-r--r--  1 root root 379K Jul 12 19:19 nppi_color_conversion.h
-rw-r--r--  1 root root  43K Jul 12 19:19 nppi_compression_functions.h
-rw-r--r--  1 root root 2.9K Jul 12 19:19 nppi_computer_vision.h
-rw-r--r--  1 root root 220K Jul 12 19:19 nppi_data_exchange_and_initialization.h
-rw-r--r--  1 root root 527K Jul 12 19:19 nppi_filtering_functions.h
-rw-r--r--  1 root root 205K Jul 12 19:19 nppi_geometry_transforms.h
-rw-r--r--  1 root root 3.4K Jul 12 19:19 nppi.h
-rw-r--r--  1 root root 5.1K Jul 12 19:19 nppi_linear_transforms.h
-rw-r--r--  1 root root  90K Jul 12 19:19 nppi_morphological_operations.h
-rw-r--r--  1 root root 583K Jul 12 19:19 nppi_statistics_functions.h
-rw-r--r--  1 root root  14K Jul 12 19:19 nppi_support_functions.h
-rw-r--r--  1 root root 146K Jul 12 19:19 nppi_threshold_and_compare_operations.h
-rw-r--r--  1 root root 174K Jul 12 19:19 npps_arithmetic_and_logical_operations.h
-rw-r--r--  1 root root  38K Jul 12 19:19 npps_conversion_functions.h
-rw-r--r--  1 root root 3.5K Jul 12 19:19 npps_filtering_functions.h
-rw-r--r--  1 root root 3.1K Jul 12 19:19 npps.h
-rw-r--r--  1 root root  15K Jul 12 19:19 npps_initialization.h
-rw-r--r--  1 root root 193K Jul 12 19:19 npps_statistics_functions.h
-rw-r--r--  1 root root 7.7K Jul 12 19:19 npps_support_functions.h
-rw-r--r--  1 root root 3.1K Jul 12 19:19 nppversion.h
-rw-r--r--  1 root root  18K Jul 12 19:19 nvblas.h
-rw-r--r--  1 root root 2.5K Jul 12 19:19 nvfunctional
-rw-r--r--  1 root root  16K Jul 12 19:19 nvgraph.h
-rw-r--r--  1 root root 299K Jul 12 19:19 nvml.h
-rw-r--r--  1 root root  20K Jul 12 19:19 nvrtc.h
-rw-r--r--  1 root root 5.9K Jul 12 19:19 nvToolsExtCuda.h
-rw-r--r--  1 root root 5.1K Jul 12 19:19 nvToolsExtCudaRt.h
-rw-r--r--  1 root root  53K Jul 12 19:19 nvToolsExt.h
-rw-r--r--  1 root root 5.6K Jul 12 19:19 nvToolsExtMeta.h
-rw-r--r--  1 root root  15K Jul 12 19:19 nvToolsExtSync.h
-rw-r--r--  1 root root 4.3K Jul 12 19:19 sm_20_atomic_functions.h
-rw-r--r--  1 root root 3.9K Jul 12 19:19 sm_20_atomic_functions.hpp
-rw-r--r--  1 root root  48K Jul 12 19:19 sm_20_intrinsics.h
-rw-r--r--  1 root root 4.8K Jul 12 19:19 sm_20_intrinsics.hpp
-rw-r--r--  1 root root  16K Jul 12 19:19 sm_30_intrinsics.h
-rw-r--r--  1 root root  24K Jul 12 19:19 sm_30_intrinsics.hpp
-rw-r--r--  1 root root 6.5K Jul 12 19:19 sm_32_atomic_functions.h
-rw-r--r--  1 root root 5.3K Jul 12 19:19 sm_32_atomic_functions.hpp
-rw-r--r--  1 root root  18K Jul 12 19:19 sm_32_intrinsics.h
-rw-r--r--  1 root root  33K Jul 12 19:19 sm_32_intrinsics.hpp
-rw-r--r--  1 root root 2.9K Jul 12 19:19 sm_35_atomic_functions.h
-rw-r--r--  1 root root 2.9K Jul 12 19:19 sm_35_intrinsics.h
-rwxr-xr-x  1 root root  21K Jul 12 19:19 sm_60_atomic_functions.h*
-rwxr-xr-x  1 root root  15K Jul 12 19:19 sm_60_atomic_functions.hpp*
-rw-r--r--  1 root root 5.9K Jul 12 19:19 sm_61_intrinsics.h
-rw-r--r--  1 root root 6.7K Jul 12 19:19 sm_61_intrinsics.hpp
-rw-r--r--  1 root root  65M Jul 12 19:19 sobol_direction_vectors.h
-rw-r--r--  1 root root  19K Jul 12 19:19 surface_functions.h
-rw-r--r--  1 root root    1 Jul 12 19:19 surface_functions.hpp
-rw-r--r--  1 root root  12K Jul 12 19:19 surface_indirect_functions.h
-rw-r--r--  1 root root    1 Jul 12 19:19 surface_indirect_functions.hpp
-rw-r--r--  1 root root 4.6K Jul 12 19:19 surface_types.h
-rw-r--r--  1 root root  32K Jul 12 19:19 texture_fetch_functions.h
-rw-r--r--  1 root root    1 Jul 12 19:19 texture_fetch_functions.hpp
-rw-r--r--  1 root root  17K Jul 12 19:19 texture_indirect_functions.h
-rw-r--r--  1 root root    1 Jul 12 19:19 texture_indirect_functions.hpp
-rw-r--r--  1 root root 7.2K Jul 12 19:19 texture_types.h
drwxr-xr-x  6 root root 4.0K Jul 14 16:38 thrust/
-rw-r--r--  1 root root 7.8K Jul 12 19:19 vector_functions.h
-rw-r--r--  1 root root 9.9K Jul 12 19:19 vector_functions.hpp
-rw-r--r--  1 root root  13K Jul 12 19:19 vector_types.h

@VoVAllen
Copy link

Same problem here

@rusty1s
Copy link
Owner

rusty1s commented Aug 17, 2018

Could you both try out a possible fix to this problem?

I guess cusparse is not linked to the nvcc call. Please add -lcusparse as compiler argument to nvcc in setup.py (example can be found here).

@phi-go
Copy link
Author

phi-go commented Aug 17, 2018

Just tried it but the same error remains. However the path to the .so library changed:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/philipp/tmp/pytorch_sparse/torch_sparse/__init__.py", line 4, in <module>
    from .spspmm import spspmm
  File "/home/philipp/tmp/pytorch_sparse/torch_sparse/spspmm.py", line 7, in <module>
    import spspmm_cuda
ImportError: /home/philipp/tmp/pytorch_sparse/spspmm_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cusparseScsrgemm

Modified setup.py:

    ext_modules += [
        CUDAExtension(
            'spspmm_cuda',
            ['cuda/spspmm.cpp', 'cuda/spspmm_kernel.cu'],
            extra_compile_args={'nvcc': ['-lcusparse']}
            )
    ]
    cmdclass['build_ext'] = BuildExtension

@shagunsodhani
Copy link
Contributor

I have the same issue. The suggested workaround gets me running though.

@rusty1s
Copy link
Owner

rusty1s commented Aug 20, 2018

Which one do you mean? Adding -lcusparse as compiler argument?

@shagunsodhani
Copy link
Contributor

Removing the spspmm import.

@rusty1s
Copy link
Owner

rusty1s commented Aug 21, 2018

Please modify setup.py according to:

if torch.cuda.is_available():
    ext_modules += [
        CUDAExtension(
            'spspmm_cuda',
            ['cuda/spspmm.cpp', 'cuda/spspmm_kernel.cu'],
            extra_link_args=['-l', 'cusparse'],
        )
    ]
    cmdclass['build_ext'] = BuildExtension

This should hopefully work now (borrowed from here).

@phi-go
Copy link
Author

phi-go commented Aug 21, 2018

Hi, just tried this. Not sure if it is a fix, as I'm running into another problem but this time with torch_scatter:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/philipp/tmp/pytorch_sparse/torch_sparse/__init__.py", line 1, in <module>
    from .coalesce import coalesce
  File "/home/philipp/tmp/pytorch_sparse/torch_sparse/coalesce.py", line 2, in <module>
    import torch_scatter
  File "/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.6/site-packages/torch_scatter/__init__.py", line 3, in <module>
    from .mul import scatter_mul
  File "/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.6/site-packages/torch_scatter/mul.py", line 3, in <module>
    from torch_scatter.utils.ext import get_func
  File "/home/philipp/.local/share/virtualenvs/pytorch_geometric-4vUoAfdD/lib/python3.6/site-packages/torch_scatter/utils/ext.py", line 5, in <module>
    import scatter_cuda
ModuleNotFoundError: No module named 'scatter_cuda'

Reproducible for me using following commands (everything installs fine):

#!/bin/bash
pipenv --rm
rm Pipfile Pipfile.lock
pipenv --python 3.6
pipenv lock --clear
export PATH=/opt/cuda/bin:$PATH
export CPATH=/opt/cuda/include
pipenv install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp36-cp36m-linux_x86_64.whl
pipenv install torchvision
pipenv install cffi
pipenv install torch-scatter
pipenv install -e --dev ../pytorch_sparse
pipenv install torch-cluster
pipenv install torch-spline-conv
pipenv install torch-geometric
pipenv run python -c "from torch_sparse import spmm"

@rusty1s
Copy link
Owner

rusty1s commented Aug 21, 2018

Ok, cool :)
It seems that the CUDA kernel for scatter did not compile and error messages are not displayed when installing from pip. Please clone torch-scatter too and run python setup.py install (and python setup.py test to verify)

@shagunsodhani
Copy link
Contributor

In my case, I still get the same error as before.

>>> import torch_sparse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/u/sodhanis/devsetup/pytorch_geometric/sparse/torch_sparse/__init__.py", line 4, in <module>
    from .spspmm import spspmm
  File "/u/sodhanis/devsetup/pytorch_geometric/sparse/torch_sparse/spspmm.py", line 7, in <module>
    import spspmm_cuda
ImportError: /u/sodhanis/anaconda3/envs/torch0.4.1/lib/python3.6/site-packages/torch_sparse-0.2.0-py3.6-linux-x86_64.egg/spspmm_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cusparseScsrgemm

@phi-go
Copy link
Author

phi-go commented Aug 21, 2018

So I already tried for python 3.7 and there it works fine.

pipenv --python 3.7
export path=/opt/cuda/bin:$path
export cpath=/opt/cuda/include
pipenv install http://download.pytorch.org/whl/cu92/torch-0.4.1.post2-cp37-cp37m-linux_x86_64.whl
pipenv install torchvision
pipenv install cffi
pipenv install torch-scatter
pipenv install -e --dev ../pytorch_sparse
pipenv run python -c "from torch_sparse import spmm"

@shagunsodhani
Copy link
Contributor

Just to confirm, you did uncomment the import statement from __init__.py? I am using Python3.6 but would setup a virtual env to try on 3.7 as well.

@phi-go
Copy link
Author

phi-go commented Aug 21, 2018

Oh yeah you are right, I forgot to uncomment the import statement. Trying again...

@phi-go
Copy link
Author

phi-go commented Aug 21, 2018

Ok. Sorry to make that mistake. Installing scatter from clone removes my previous error. However the cusparse error remains for me as well. Edit: That is for python 3.6 Edit: and for 3.7

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/philipp/tmp/pytorch_sparse/torch_sparse/__init__.py", line 4, in <module>
    from .spspmm import spspmm
  File "/home/philipp/tmp/pytorch_sparse/torch_sparse/spspmm.py", line 7, in <module>
    import spspmm_cuda
ImportError: /home/philipp/tmp/pytorch_sparse/spspmm_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cusparseScsrgemm

@rusty1s
Copy link
Owner

rusty1s commented Aug 28, 2018

I could reproduce the bug on another machine and hopefully fixed it. Please checkout master and verify, so we can finally close this issue :)

@phi-go
Copy link
Author

phi-go commented Aug 29, 2018

Pulled from master and ran:

pipenv run python setup.py install
pipenv run python setup.py test

However I still get the same error, it's the same for all the tests:

ImportError while importing test module '/home/philipp/tmp/pytorch_sparse/test/test_coalesce.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_coalesce.py:2: in <module>
    from torch_sparse import coalesce
torch_sparse/__init__.py:5: in <module>
    from .spspmm import spspmm
torch_sparse/spspmm.py:7: in <module>
    import spspmm_cuda
E   ImportError: /home/philipp/tmp/pytorch_sparse/spspmm_cuda.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cusparseScsrgemm

@shagunsodhani
Copy link
Contributor

I could get along a bit more but when I execute the example given in the README:

from torch_sparse import spspmm

indexA = torch.tensor([[0, 0, 1, 2, 2], [1, 2, 0, 0, 1]])
valueA = torch.tensor([1, 2, 3, 4, 5])

indexB = torch.tensor([[0, 2], [1, 0]])
valueB = torch.tensor([2, 4])

indexC, valueC = spspmm(indexA, valueA, indexB, valueB, 3, 3, 2)

I get the error :

RuntimeError: Not implemented for '%s'Variable[CUDALongType] (operator() at cuda/spspmm_kernel.cu:82)

The complete log is available here

@rusty1s
Copy link
Owner

rusty1s commented Sep 28, 2018

Yes, spspmm does only work on floating point data types, so this error is to be expected. I will update the README.

@wildphoton
Copy link

I wonder if this issue has been fixed besides the workaround? I tried the updated master but still got the undefined cusparseScsrgemm error. Thanks!

I could reproduce the bug on another machine and hopefully fixed it. Please checkout master and verify, so we can finally close this issue :)

@rusty1s
Copy link
Owner

rusty1s commented Oct 17, 2018

It would be best if someone having this error could evaluate differing command options of -lsparse to identify the error and send a pull request. Not much else I can do :(

@shagunsodhani
Copy link
Contributor

I tried the different options you mentioned so far. They did not work for me yet. If you have a list of other options I could try (or know where I could get the list of possible options), I will try them all and let you know.

@AntoinePrv
Copy link
Contributor

I had the same problem (python 3.7) and installing from master seems to have fixed it (could run all the examples here, with values as float for @shagunsodhani example).
@rusty1s Could we expect a fix on pypi?

Thank you for a great project with amazing code quality!

@rusty1s
Copy link
Owner

rusty1s commented Oct 19, 2018

Hi,
the fix in master solved the problem for me on Ubuntu, but for others this seems not to be the case. I can publish the master to pypi, but this sadly still does not resolve this issue.

@rusty1s
Copy link
Owner

rusty1s commented Oct 19, 2018

The possible solutions seem to be to add:

CUDAExtension(
    ...,
    extra_link_args=[x],
)

or

CUDAExtension(
    ...,
    extra_compile_args={'nvcc': [x]}.
})

where x is either replaced by '-lcusparse' or '-l', 'cusparse'.

Can you test these with rm -rf build/ && python setup.py test?

@shagunsodhani
Copy link
Contributor

I tested this on 5836042. Let me know if I should be testing on any other commit as well.

@rusty1s
Copy link
Owner

rusty1s commented Oct 20, 2018

Before I accept the pull request, can you test passing both, -lcusparse and -l cusparse, as link arguments, e.g.,

CUDAExtension(
    ...,
    extra_link_args=['-lcusparse', '-l', 'cusparse'],
)

as using -l library is not recommended (cf. https://gcc.gnu.org/onlinedocs/gcc-4.6.4/gcc/Link-Options.html)

@shagunsodhani
Copy link
Contributor

Sure I can do that. I have another request. Could you suggest me a minimal test to ensure that this particular issue is fixed? I did check it with the previous commit's test cases but I am not super confident that those tests are sufficient.

@rusty1s
Copy link
Owner

rusty1s commented Oct 20, 2018

If the spspmm test runs for you, the issue is fixed.

@shagunsodhani
Copy link
Contributor

Fixed 👍

@rusty1s
Copy link
Owner

rusty1s commented Oct 20, 2018

Updated torch-sparse to 0.2.1 on pypi with the proposed fixes. Thanks to all.

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

6 participants