NVIDIA / flownet2-pytorch

Pytorch implementation of FlowNet 2.0: Evolution of Optical Flow Estimation with Deep Networks
Other
3.09k stars 739 forks source link

error: identifier "__syncwarp" is undefined; error: identifier "__shfl_down_sync" is undefined #237

Closed Lifedecoder closed 3 years ago

Lifedecoder commented 3 years ago

Hi, when running "python setup.py install" in networks/correlation_package, two error occurs. The complete error is below:

houchen@imclserver:/data/houchen/Flownet2/networks/correlation_package$ python setup.py install running install running bdist_egg running egg_info writing correlation_cuda.egg-info/PKG-INFO writing dependency_links to correlation_cuda.egg-info/dependency_links.txt writing top-level names to correlation_cuda.egg-info/top_level.txt reading manifest file 'correlation_cuda.egg-info/SOURCES.txt' writing manifest file 'correlation_cuda.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_ext building 'correlation_cuda' extension gcc -pthread -B /data/houchen/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/data/houchen/anaconda3/include/python3.7m -c correlation_cuda.cc -o build/temp.linux-x86_64-3.7/correlation_cuda.o -std=c++11 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=correlation_cuda -D_GLIBCXX_USE_CXX11_ABI=0 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from correlation_cuda.cc:1:0: /data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include/torch/torch.h:7:2: warning: #warning "Including torch/torch.h for C++ extensions is deprecated. Please include torch/extension.h" [-Wcpp]

warning \

^ /usr/local/cuda/bin/nvcc -I/data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/data/houchen/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/data/houchen/anaconda3/include/python3.7m -c correlation_cuda_kernel.cu -o build/temp.linux-x86_64-3.7/correlation_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=correlation_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 correlation_cuda_kernel.cu(130): error: identifier "syncwarp" is undefined

correlation_cuda_kernel.cu(19): error: identifier "__shfl_down_sync" is undefined detected during: instantiation of "scalar_t warpReduceSum(scalar_t) [with scalar_t=float]" (131): here instantiation of "void correlation_forward(scalar_t , int, int, int, const scalar_t , int, int, int, const scalar_t *, int, int, int, int, int) [with scalar_t=double]" (403): here

2 errors detected in the compilation of "/tmp/tmpxft_00000d7b_00000000-13_correlation_cuda_kernel.compute_61.cpp1.ii". error: command '/usr/local/cuda/bin/nvcc' failed with exit status 2

It seems that my code doesn't have function "_syncwarp" and "_shfl_down_sync". Someone says it is due to cuda's version. My cuda version is :

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA Corporation Built on Sun_Sep__4_22:14:01_CDT_2016 Cuda compilation tools, release 8.0, V8.0.44

How to solve this problem? Should I change cuda's version? What version could help solve?

Lifedecoder commented 3 years ago

Replace "syncwarp" with "syncthreads" and replace "shfl_down_sync" with "shfl_down" may help? In this way code can run though i don't know whether it is feasible logically.

superlwx commented 3 years ago

Replace "syncwarp" with "syncthreads" and replace "shfl_down_sync" with "shfl_down" may help? In this way code can run though i don't know whether it is feasible logically.

I use your solution but the value of corr layer is overflow. Then I try to change cuda8.0 to cuda9.0 to compile, it's worked and value of corr layer was looked good.

Lifedecoder commented 3 years ago

Replace "syncwarp" with "syncthreads" and replace "shfl_down_sync" with "shfl_down" may help? In this way code can run though i don't know whether it is feasible logically.

I use your solution but the value of corr layer is overflow. Then I try to change cuda8.0 to cuda9.0 to compile, it's worked and value of corr layer was looked good. Yeah, that can help, I've update cuda from 8.0 to 9.0, thus the code can work.