PCN-PyTorch
PCN-PyTorch copied to clipboard
THC/THC.h: No such file or directory
Running python3 setup.py install --user gives the following error for earth mover distance extension
/home/nova/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py:398: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 11.8
warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
building 'emd_cuda' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/nova/.local/lib/python3.8/site-packages/torch/include -I/home/nova/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/nova/.local/lib/python3.8/site-packages/torch/include/TH -I/home/nova/.local/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.8/include -I/usr/include/python3.8 -c emd.cpp -o build/temp.linux-x86_64-cpython-38/emd.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=emd_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
/usr/local/cuda-11.8/bin/nvcc -I/home/nova/.local/lib/python3.8/site-packages/torch/include -I/home/nova/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/nova/.local/lib/python3.8/site-packages/torch/include/TH -I/home/nova/.local/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda-11.8/include -I/usr/include/python3.8 -c emd_kernel.cu -o build/temp.linux-x86_64-cpython-38/emd_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=emd_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++17
emd_kernel.cu:14:10: fatal error: THC/THC.h: No such file or directory
14 | #include <THC/THC.h>
| ^~~~~~~~~~~
compilation terminated.
error: command '/usr/local/cuda-11.8/bin/nvcc' failed with exit code 1
I have PyTorch 2.0.1 and CUDA 11.8
Remember @KshitijKarnawat that the CUDA version used for this repo (and other versions) are different:
Ubuntu 18.04 LTS
Python 3.7.9
PyTorch 1.7.0
CUDA 10.1.243
And you are getting:
/home/nova/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py:398: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 11.8
warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
So try and use the correct versions (+ cudnn)
Hey, I got the same problem. This is my solution:
- comment out #include <THC/THC.h>
- replace THCudaCheck(cudaGetLastError()) with AT_CUDA_CHECK(cudaGetLastError())
- add
#define CHECK_EQ(expected, actual)
do {
if ((expected) != (actual)) {
std::cerr << "CHECK_EQ failed: "
<< #expected << " != " << #actual
<< " (" << (expected) << " vs " << (actual) << ")"
<< " at " << FILE << ":" << LINE << std::endl;
std::terminate();
}
} while (false)