Build error when using pytorch 1.7
See original GitHub issueWhen I upgraded to a RTX 3090 graphics card, I had to use cuda11 and the latest official version of PyTorch 1.7.
System Info: I9 9900K RTX3090 NVIDIA-Linux-x86_64-455.23.04.run cuda_11.1.1_455.32.00_linux.run cudnn-11.1-linux-x64-v8.0.4.30.tgz Python 3.8 (Anaconda3-2020.07-Linux-x86_64.sh) Pytorch 1.7
The following error (is too long, there is only the last part) occurred while reinstalling this library from pip:
pip install spatial_correlation_sampler==0.3.0
....
/tmp/tmpxft_00004720_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:55:0: error: expected ‘)’ before ‘float’
tmpxft_00004720_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:1:28: error: reference to ‘_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e’ is ambiguous
Correlation_Module/correlation_cuda_kernel.cu:20:11: note: candidates are: namespace _GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e { }
namespace {
^
/home1/user/anaconda3/lib/python3.8/site-packages/torch/include/ATen/Functions.h:1518:11: note: namespace at::_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e { }
namespace {
^
In file included from /tmp/tmpxft_00004720_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:8:0,
from tmpxft_00004720_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:1:
/tmp/tmpxft_00004720_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:55:0: error: expected primary-expression before ‘double’
static void __nv_cudaEntityRegisterCallback(void **__T672){__nv_dummy_param_ref(__T672);__nv_save_fatbinhandle_for_managed_rt(__T672);__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIN3c104HalfELm5ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIN3c104HalfELm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIN3c104HalfELm4ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input2< ::c10::Half> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e39correlation_cuda_backward_kernel_input2IN3c104HalfEEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS3_17RestrictPtrTraitsEiEENS4_IS5_Lm4ES6_iEES8_iiiiiiiiiii, (-1));__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIN3c104HalfELm5ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIN3c104HalfELm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIN3c104HalfELm4ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input1< ::c10::Half> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e39correlation_cuda_backward_kernel_input1IN3c104HalfEEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS3_17RestrictPtrTraitsEiEENS4_IS5_Lm4ES6_iEES8_iiiiiiiiiii, (-1));__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIfLm5ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIfLm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIfLm4ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input2<float> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e39correlation_cuda_backward_kernel_input2IfEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS1_17RestrictPtrTraitsEiEENS2_IS3_Lm4ES4_iEES6_iiiiiiiiiii, (-1));__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIfLm5ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIfLm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIfLm4ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input1<float> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e39correlation_cuda_backward_kernel_input1IfEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS1_17RestrictPtrTraitsEiEENS2_IS3_Lm4ES4_iEES6_iiiiiiiiiii, (-1));__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIdLm5ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIdLm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIdLm4ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input2<double> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e39correlation_cuda_backward_kernel_input2IdEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS1_17RestrictPtrTraitsEiEENS2_IS3_Lm4ES4_iEES6_iiiiiiiiiii, (-1));__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIdLm5ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIdLm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIdLm4ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input1<double> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e39correlation_cuda_backward_kernel_input1IdEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS1_17RestrictPtrTraitsEiEENS2_IS3_Lm4ES4_iEES6_iiiiiiiiiii, (-1));__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIN3c104HalfELm4ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIN3c104HalfELm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIN3c104HalfELm5ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_forward_kernel< ::c10::Half> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e31correlation_cuda_forward_kernelIN3c104HalfEEEvN2at27GenericPackedTensorAccessorIT_Lm4ENS3_17RestrictPtrTraitsEiEES7_NS4_IS5_Lm5ES6_iEEiiiiiiiiii, (-1));__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIfLm4ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIfLm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIfLm5ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_forward_kernel<float> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e31correlation_cuda_forward_kernelIfEEvN2at27GenericPackedTensorAccessorIT_Lm4ENS1_17RestrictPtrTraitsEiEES5_NS2_IS3_Lm5ES4_iEEiiiiiiiiii, (-1));__cudaRegisterEntry(__T672, ((void ( *)(const _ZN2at20PackedTensorAccessorIdLm4ENS_17RestrictPtrTraitsEiEE, const _ZN2at20PackedTensorAccessorIdLm4ENS_17RestrictPtrTraitsEiEE, _ZN2at20PackedTensorAccessorIdLm5ENS_17RestrictPtrTraitsEiEE, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_forward_kernel<double> ), _ZN82_GLOBAL__N__58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e31correlation_cuda_forward_kernelIdEEvN2at27GenericPackedTensorAccessorIT_Lm4ENS1_17RestrictPtrTraitsEiEES5_NS2_IS3_Lm5ES4_iEEiiiiiiiiii, (-1));__cudaRegisterVariable(__T672, __shadow_var(_ZN80_INTERNAL_58_tmpxft_00004720_00000000_7_correlation_cuda_kernel_cpp1_ii_90c2133e6thrust6system6detail10sequential3seqE,::thrust::system::detail::sequential::seq), 0, 1UL, 0, 0);}
/tmp/tmpxft_00004720_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:55:0: error: expected ‘)’ before ‘double’
error: command '/usr/local/cuda-11.1/bin/nvcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home1/user/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ytagkuw8/spatial-correlation-sampler/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ytagkuw8/spatial-correlation-sampler/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-41m2pf99/install-record.txt --single-version-externally-managed --compile --install-headers /home1/user/anaconda3/include/python3.8/spatial-correlation-sampler Check the logs for full command output.
I also tested installing 0.2.1 and 0.2.0 using pip and returned the same error.
In addition, I try to install through source code compilation following the README.
python setup.py install
/tmp/tmpxft_00003dbc_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:55:0: error: expected ‘)’ before ‘float’
tmpxft_00003dbc_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:1:28: error: reference to ‘_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c’ is ambiguous
Correlation_Module/correlation_cuda_kernel.cu:20:11: note: candidates are: namespace _GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c { }
namespace {
^
/home1/user/anaconda3/lib/python3.8/site-packages/torch/include/ATen/Functions.h:1518:11: note: namespace at::_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c { }
namespace {
^
In file included from /tmp/tmpxft_00003dbc_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:8:0,
from tmpxft_00003dbc_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:1:
/tmp/tmpxft_00003dbc_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:55:0: error: expected primary-expression before ‘double’
static void __nv_cudaEntityRegisterCallback(void **__T684){__nv_dummy_param_ref(__T684);__nv_save_fatbinhandle_for_managed_rt(__T684);__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IN3c104HalfELm5ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IN3c104HalfELm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IN3c104HalfELm4ENS_17RestrictPtrTraitsEEE, int, int, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input2< ::c10::Half> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c39correlation_cuda_backward_kernel_input2IN3c104HalfEEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS3_17RestrictPtrTraitsEiEENS4_IS5_Lm4ES6_iEES8_iiiiiiiiiiiii, (-1));__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IN3c104HalfELm5ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IN3c104HalfELm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IN3c104HalfELm4ENS_17RestrictPtrTraitsEEE, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input1< ::c10::Half> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c39correlation_cuda_backward_kernel_input1IN3c104HalfEEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS3_17RestrictPtrTraitsEiEENS4_IS5_Lm4ES6_iEES8_iiiiiiiiiiiii, (-1));__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IfLm5ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IfLm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IfLm4ENS_17RestrictPtrTraitsEEE, int, int, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input2<float> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c39correlation_cuda_backward_kernel_input2IfEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS1_17RestrictPtrTraitsEiEENS2_IS3_Lm4ES4_iEES6_iiiiiiiiiiiii, (-1));__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IfLm5ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IfLm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IfLm4ENS_17RestrictPtrTraitsEEE, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input1<float> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c39correlation_cuda_backward_kernel_input1IfEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS1_17RestrictPtrTraitsEiEENS2_IS3_Lm4ES4_iEES6_iiiiiiiiiiiii, (-1));__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IdLm5ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IdLm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IdLm4ENS_17RestrictPtrTraitsEEE, int, int, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input2<double> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c39correlation_cuda_backward_kernel_input2IdEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS1_17RestrictPtrTraitsEiEENS2_IS3_Lm4ES4_iEES6_iiiiiiiiiiiii, (-1));__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IdLm5ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IdLm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IdLm4ENS_17RestrictPtrTraitsEEE, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int, const int))_NV_ANON_NAMESPACE::correlation_cuda_backward_kernel_input1<double> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c39correlation_cuda_backward_kernel_input1IdEEvN2at27GenericPackedTensorAccessorIT_Lm5ENS1_17RestrictPtrTraitsEiEENS2_IS3_Lm4ES4_iEES6_iiiiiiiiiiiii, (-1));__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IN3c104HalfELm4ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IN3c104HalfELm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IN3c104HalfELm5ENS_17RestrictPtrTraitsEEE, int, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_forward_kernel< ::c10::Half> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c31correlation_cuda_forward_kernelIN3c104HalfEEEvN2at27GenericPackedTensorAccessorIT_Lm4ENS3_17RestrictPtrTraitsEiEES7_NS4_IS5_Lm5ES6_iEEiiiiiiiiiiii, (-1));__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IfLm4ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IfLm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IfLm5ENS_17RestrictPtrTraitsEEE, int, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_forward_kernel<float> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c31correlation_cuda_forward_kernelIfEEvN2at27GenericPackedTensorAccessorIT_Lm4ENS1_17RestrictPtrTraitsEiEES5_NS2_IS3_Lm5ES4_iEEiiiiiiiiiiii, (-1));__cudaRegisterEntry(__T684, ((void ( *)(const _ZN2at22PackedTensorAccessor32IdLm4ENS_17RestrictPtrTraitsEEE, const _ZN2at22PackedTensorAccessor32IdLm4ENS_17RestrictPtrTraitsEEE, _ZN2at22PackedTensorAccessor32IdLm5ENS_17RestrictPtrTraitsEEE, int, int, int, int, int, int, int, int, int, int, int, int))_NV_ANON_NAMESPACE::correlation_cuda_forward_kernel<double> ), _ZN82_GLOBAL__N__58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c31correlation_cuda_forward_kernelIdEEvN2at27GenericPackedTensorAccessorIT_Lm4ENS1_17RestrictPtrTraitsEiEES5_NS2_IS3_Lm5ES4_iEEiiiiiiiiiiii, (-1));__cudaRegisterVariable(__T684, __shadow_var(_ZN80_INTERNAL_58_tmpxft_00003dbc_00000000_7_correlation_cuda_kernel_cpp1_ii_04f3d18c6thrust6system6detail10sequential3seqE,::thrust::system::detail::sequential::seq), 0, 1UL, 0, 0);}
/tmp/tmpxft_00003dbc_00000000-6_correlation_cuda_kernel.cudafe1.stub.c:55:0: error: expected ‘)’ before ‘double’
error: command '/usr/local/cuda-11.1/bin/nvcc' failed with exit status 1
It looks like the same error as pip.
In order to determine where the problem is, I tried to install Pytorch 1.7 on a 2080ti computer, and the same error occurred when compiling this library. It uses cuda10.0 and python 3.8. However, using Pytorch 1.6 can install this library normally. My guess is that this error was introduced in the latest version of Pytorch 1.7.
I hope I can get your help, Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top GitHub Comments
Hi, after some investigation on my system : Ubuntu 20.04 Pytorch 1.7 RTX 2080 Super Cuda 11.1
I had the same bug, and using an explicitely named namespace instead of a generic one seems to do the trick. I have genuinely no idea, why it works now though, especially when the official extension-cpp repo does build on my machine and has a generic namespace.
Anyway, you can try the change with the branch fix_1.7 . If the build is successful (along with check.py and grad_check.py) I’ll merge the changes
Clément
It helps on RTX 3090 either, thanks!