idiap / fast-transformers

Pytorch library for fast transformer implementations
1.65k stars 179 forks source link

causal_product_cuda.cu,Error compiling objects for extension #23

Closed burcehan closed 4 years ago

burcehan commented 4 years ago

Hi,

Thank you for your great work! I have troubles installing the package: when compile causal_product_cuda.cu, it failed.

System setup:

 Ubuntu 18.04
 Python 3.7.3 
 Cuda V10.1
 Pytorch  1.5.0

log: Segmentation fault (core dumped) ninja: build stopped: subcommand failed. Traceback (most recent call last): File "torch/utils/cpp_extension.py", line 1402, in _run_ninja_build check=True) File "/python3.7/subprocess.py", line 487, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

File "/torch/utils/cpp_extension.py", line 425, in unix_wrap_ninja_compile with_cuda=with_cuda) File "torch/utils/cpp_extension.py", line 1142, in _write_ninja_file_and_compile_objects error_prefix='Error compiling objects for extension') File "/torch/utils/cpp_extension.py", line 1415, in _run_ninja_build raise RuntimeError(message) RuntimeError: Error compiling objects for extension

Thanks for your help.

angeloskath commented 4 years ago

Hi, thanks for your good words!

The build seems to fail when calling ninja to compile the extension but I am not sure what the error might be. I would try to compile in a fresh conda environment. From our tests it seems that python 3.7 and PyTorch 1.5.0 should be fine.

Cheers, Angelos

Ghadjeres commented 4 years ago

Hi,

I had the exact same problem. In my case, this came from the fact that the LD_LIBRARY_PATH and PATH variables were pointing to the wrong cuda install. Maybe checking these lines in your .bashrc can help:

export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export PATH=/usr/local/cuda-11.0/bin${PATH:+:${PATH}}

I also reinstalled this CUDA version.

Hope this helps

angeloskath commented 4 years ago

Thanks @Ghadjeres ! I think the simplest sanity check (if you can spare about 1GB of temporary space) is to do a clean conda installation. Following the pipeline that we use in our tests should be good enough.

conda install python=3.8
conda install -c pytorch pytorch=1.6
conda install -c conda-forge cudatoolkit-dev  # this takes some time
pip install pytorch-fast-transformers  # this also takes some time
burcehan commented 4 years ago

I follow the pipeline ,create a clean conda environment, and now I make a successful installation. Thanks very much!