A Problem : CUDA/limits.cuh(119): error: identifier "inf" is undefined
MaxShi007 opened this issue · 3 comments
hi, I have some trouble when i install softpool. The detail is that im follow "Installation" and use "make install",then im encountered the mistake:
(mos3d) root@LUCAS-DEV-01a694:~/MotionSeg3D/SoftPool/pytorch# make install
rm -rf *.egg-info
rm -rf build dist
python setup.py install
running install
/usr/local/envs/mos3d/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
/usr/local/envs/mos3d/lib/python3.7/site-packages/setuptools/command/easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
EasyInstallDeprecationWarning,
running bdist_egg
running egg_info
creating SoftPool.egg-info
writing SoftPool.egg-info/PKG-INFO
writing dependency_links to SoftPool.egg-info/dependency_links.txt
writing top-level names to SoftPool.egg-info/top_level.txt
writing manifest file 'SoftPool.egg-info/SOURCES.txt'
reading manifest file 'SoftPool.egg-info/SOURCES.txt'
writing manifest file 'SoftPool.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/SoftPool
copying SoftPool/init.py -> build/lib.linux-x86_64-3.7/SoftPool
copying SoftPool/idea.py -> build/lib.linux-x86_64-3.7/SoftPool
running build_ext
building 'softpool_cuda' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/CUDA
gcc -pthread -B /usr/local/envs/mos3d/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/envs/mos3d/lib/python3.7/site-packages/torch/include -I/usr/local/envs/mos3d/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/usr/local/envs/mos3d/lib/python3.7/site-packages/torch/include/TH -I/usr/local/envs/mos3d/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.2/include -I/usr/local/envs/mos3d/include/python3.7m -c CUDA/softpool_cuda.cpp -o build/temp.linux-x86_64-3.7/CUDA/softpool_cuda.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -DTORCH_EXTENSION_NAME=softpool_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda-10.2/bin/nvcc -I/usr/local/envs/mos3d/lib/python3.7/site-packages/torch/include -I/usr/local/envs/mos3d/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/usr/local/envs/mos3d/lib/python3.7/site-packages/torch/include/TH -I/usr/local/envs/mos3d/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.2/include -I/usr/local/envs/mos3d/include/python3.7m -c CUDA/softpool_cuda_kernel.cu -o build/temp.linux-x86_64-3.7/CUDA/softpool_cuda_kernel.o -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=softpool_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 -std=c++14
CUDA/limits.cuh(119): error: identifier "inf" is undefined
CUDA/limits.cuh(120): error: identifier "inf" is undefined
CUDA/limits.cuh(128): error: identifier "inf" is undefined
CUDA/limits.cuh(129): error: identifier "inf" is undefined
4 errors detected in the compilation of "/tmp/tmpxft_00280a89_00000000-6_softpool_cuda_kernel.cpp1.ii".
error: command '/usr/local/cuda-10.2/bin/nvcc' failed with exit code 1
Makefile:2: recipe for target 'install' failed
make: *** [install] Error 1
my environment :
pytorch:1.11.0
cuda:10.2
gcc:7.5
The problem was solved by install pytorch==1.7
Hi @alexandrosstergiou , I also meet this issue with torch 1.13.0 + cu117
, but I found a solution in a chinese blog.
Let me briefly summarize.
Because the error is CUDA/limits.cuh(119): error: identifier "inf" is undefined
.
It seems that the variable or macro is not defined, so hw refer to other articles to define the integer inf after the include directive and assign the value to a large number:
const int inf=0x3f3f3f3f
.
I tried this scheme, and make test can pass
Hi @MaxChanger ,
Thanks for narrowing down the cause of the error. It seems that this is due to inf
not being loaded from CUDA Math in limits.cuh
. I will run some tests to see if there are any effects by defining a constant explicitly (e.g. const int inf=0x3f3f3f3f
), and if not, I'll update limits.cuh
afterward.