butterfly icon indicating copy to clipboard operation
butterfly copied to clipboard

"TORCH_ERROR("Not compiled with CUDA support")"

Open Ashokvardhan opened this issue 4 years ago • 8 comments

Hi,

I have been trying to install this for the past couple of days but I am always running into errors. It would be of great help if you can provide some guidance on this. The following is the configuration of my virtual environment:

`python 3.7

pytorch 1.6

cudatoolkit 10.1

ninja 1.10.2 `

The following is the list of errors I get when I type python setup.py install

`running install

running bdist_egg

running egg_info

writing torch_butterfly.egg-info/PKG-INFO

writing dependency_links to torch_butterfly.egg-info/dependency_links.txt

writing top-level names to torch_butterfly.egg-info/top_level.txt

reading manifest file 'torch_butterfly.egg-info/SOURCES.txt'

writing manifest file 'torch_butterfly.egg-info/SOURCES.txt'

installing library code to build/bdist.linux-x86_64/egg

running install_lib

running build_py

creating build/lib.linux-x86_64-3.7

creating build/lib.linux-x86_64-3.7/torch_butterfly

copying torch_butterfly/permutation.py -> build/lib.linux-x86_64-3.7/torch_butterfly

copying torch_butterfly/diagonal.py -> build/lib.linux-x86_64-3.7/torch_butterfly

copying torch_butterfly/multiply.py -> build/lib.linux-x86_64-3.7/torch_butterfly

copying torch_butterfly/combine.py -> build/lib.linux-x86_64-3.7/torch_butterfly

copying torch_butterfly/special.py -> build/lib.linux-x86_64-3.7/torch_butterfly

copying torch_butterfly/complex_utils.py -> build/lib.linux-x86_64-3.7/torch_butterfly

copying torch_butterfly/init.py -> build/lib.linux-x86_64-3.7/torch_butterfly

copying torch_butterfly/butterfly.py -> build/lib.linux-x86_64-3.7/torch_butterfly

running build_ext

building 'torch_butterfly._butterfly' extension

creating build/temp.linux-x86_64-3.7

creating build/temp.linux-x86_64-3.7/home

creating build/temp.linux-x86_64-3.7/home/ashok

creating build/temp.linux-x86_64-3.7/home/ashok/reed_muller

creating build/temp.linux-x86_64-3.7/home/ashok/reed_muller/Neural_Plotkin

creating build/temp.linux-x86_64-3.7/home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules

creating build/temp.linux-x86_64-3.7/home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master

creating build/temp.linux-x86_64-3.7/home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc

creating build/temp.linux-x86_64-3.7/home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/cpu

gcc -pthread -B /home/ashok/anaconda3/envs/torch/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g - fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc -I/home/ashok/anaconda3/envs/torch/lib/python3.7/site-packages/torch/include -

I/home/ashok/anaconda3/envs/torch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -

I/home/ashok/anaconda3/envs/torch/lib/python3.7/site-packages/torch/include/TH -

I/home/ashok/anaconda3/envs/torch/lib/python3.7/site-packages/torch/include/THC -

I/home/ashok/anaconda3/envs/torch/include/python3.7m -c /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp -o build/temp.linux-x86_64-3.7/home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_butterfly -D_GLIBCXX_USE_CXX11_ABI=1 -std=c++11

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++

/home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp: In function ‘at::Tensor butterfly_multiply_fw(at::Tensor, at::Tensor, bool)’: /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp:43:49: error: ‘TORCH_ERROR’ was not declared in this scope TORCH_ERROR("Not compiled with CUDA support"); ^ /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp: In function ‘std::tuple<at::Tensor, at::Tensor> butterfly_multiply_bw(at::Tensor, at::Tensor, at::Tensor, bool)’: /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp:81:49: error: ‘TORCH_ERROR’ was not declared in this scope TORCH_ERROR("Not compiled with CUDA support"); ^ /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp: At global scope: /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp:118:14: error: expected constructor, destructor, or type conversion before ‘(’ token TORCH_LIBRARY(torch_butterfly, m) { ^ /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp: In function ‘at::Tensor butterfly_multiply_fw(at::Tensor, at::Tensor, bool)’: /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp: In function ‘std::tuple<at::Tensor, at::Tensor> butterfly_multiply_bw(at::Tensor, at::Tensor, at::Tensor, bool)’: /home/ashok/reed_muller/Neural_Plotkin/reed_muller_modules/butterfly-master/csrc/butterfly.cpp:86:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ error: command 'gcc' failed with exit status 1 `

Ashokvardhan avatar Sep 14 '20 23:09 Ashokvardhan

Are you compiling the code from the latest commit on master? Which OS and gcc version are you using? Was Pytorch installed with conda or pip?

tridao avatar Sep 14 '20 23:09 tridao

One possibility is incorrect Pytorch version. Old Pytorch versions don't have TORCH_CHECK and that might cause the error. When I compile with Pytorch 1.6 it defaults to -std=c++14 (https://github.com/pytorch/pytorch/blob/v1.6.0/torch/utils/cpp_extension.py#L360) but in your case it's using -std=c++11. Can you check that you have Pytorch 1.6 in your eonvironment?

tridao avatar Sep 15 '20 00:09 tridao

I've pushed a commit to change TORCH_ERROR to support non-CUDA compilation. Can you try that out?

tridao avatar Sep 15 '20 00:09 tridao

I've pushed a commit to change TORCH_ERROR to support non-CUDA compilation. Can you try that out?

Yes. I am able to successfully compile this. I see some warnings here and there but no errors.

Ashokvardhan avatar Sep 15 '20 15:09 Ashokvardhan

One possibility is incorrect Pytorch version. Old Pytorch versions don't have TORCH_CHECK and that might cause the error. When I compile with Pytorch 1.6 it defaults to -std=c++14 (https://github.com/pytorch/pytorch/blob/v1.6.0/torch/utils/cpp_extension.py#L360) but in your case it's using -std=c++11. Can you check that you have Pytorch 1.6 in your eonvironment?

Yes. I checked the version. When I typed import torch; print(torch.__version__) it outputs 1.6.0. Also I installed it with conda only.

I am using Linux OS only. More specifically, when I type uname -srm, it gives Linux 4.4.0-98-generic x86_64.

For the GCC, I checked that the version is gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Ashokvardhan avatar Sep 15 '20 15:09 Ashokvardhan

Yes. I am able to successfully compile this. I see some warnings here and there but no errors.

That's great. Thanks for trying that out.

tridao avatar Sep 15 '20 16:09 tridao

Yes. I am able to successfully compile this. I see some warnings here and there but no errors.

That's great. Thanks for trying that out.

Thanks a lot for your help! Just wondering if this is slower than the original version.

Ashokvardhan avatar Sep 15 '20 19:09 Ashokvardhan

No, it was just an error on my part. Thanks for reporting it.

tridao avatar Sep 15 '20 21:09 tridao