'Failing to compile project using CUDA 11.0, Python 3.8, Torch 1.8
I am trying to compile DiffDVR, a differentiable renderer. This requires running cmake first, so I had to install some dependencies. I want to use the same dependencies as the ones in the repo. I'm on Linux Mint 20.3, which is based on Ubuntu 20.04. In order, I have installed:
- CUDA 11.0 (using the official runfile)
- cuDNN v8.1.1 (the highest version compatible with 11.0, as per the cuDNN archive)
- created a Python 3.8 environment with Torch 1.8.0 (based on the environment.yml file in the repo)
- libglm-dev, libglfw3-dev and libglew-dev as they were needed for compilation.
The error I get when going to the build dir and running cmake .. is:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
TORCH_LIB_c10
linked by target "Renderer" in directory /home/andrei/PycharmProjects/DiffDVR/renderer
linked by target "Gui" in directory /home/andrei/PycharmProjects/DiffDVR/gui
TORCH_LIB_c10_cuda
linked by target "Renderer" in directory /home/andrei/PycharmProjects/DiffDVR/renderer
linked by target "Gui" in directory /home/andrei/PycharmProjects/DiffDVR/gui
TORCH_LIB_torch_cpu
linked by target "Renderer" in directory /home/andrei/PycharmProjects/DiffDVR/renderer
linked by target "Gui" in directory /home/andrei/PycharmProjects/DiffDVR/gui
TORCH_LIB_torch_cuda
linked by target "Renderer" in directory /home/andrei/PycharmProjects/DiffDVR/renderer
linked by target "Gui" in directory /home/andrei/PycharmProjects/DiffDVR/gui
TORCH_LIB_torch_python
linked by target "Renderer" in directory /home/andrei/PycharmProjects/DiffDVR/renderer
linked by target "Gui" in directory /home/andrei/PycharmProjects/DiffDVR/gui
Scrolling up in the output reveals the following problem:
Torch: full library list: /usr/lib/libtorch.so;TORCH_LIB_c10-NOTFOUND;TORCH_LIB_c10_cuda-NOTFOUND;/usr/lib/libtorch.so;TORCH_LIB_torch_cpu-NOTFOUND;TORCH_LIB_torch_cuda-NOTFOUND;TORCH_LIB_torch_python-NOTFOUND
So it seems like these libraries are not found. I tried to sudo apt-get install libtorch3-dev but apt says it's already installed (I assume it happened when conda installed the pytorch package?), and there are no libraries available with the c10, c10_cuda etc suffixes. How would I make sure these libraries are found, so I can compile the project?
I made some progress with the following (hacky) solution:
sudo ln -s /home/andrei/miniconda3/envs/py38torch18/lib/python3.8/site-packages/torch/lib/libc10.so libc10.so
sudo ln -s /home/andrei/miniconda3/envs/py38torch18/lib/python3.8/site-packages/torch/lib/libc10_cuda.so libc10_cuda.so
sudo ln -s /home/andrei/miniconda3/envs/py38torch18/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so libtorch_cpu.so
sudo ln -s /home/andrei/miniconda3/envs/py38torch18/lib/python3.8/site-packages/torch/lib/libtorch_cuda.so libtorch_cuda.so
sudo ln -s /home/andrei/miniconda3/envs/py38torch18/lib/python3.8/site-packages/torch/lib/libtorch_python.so libtorch_python.so
Which fixed the previous errors.
Unfortunately, I'm now encountering the following error:
CMake Error at renderer/CMakeLists.txt:92 (add_library):
CUDA_STANDARD is set to invalid value '17'
More progress:
Managed to run cmake successfully by uninstalling it via apt and reinstalling it via snap (because the apt version was too old). Unfortunately, make fails now, with the error:
[ 46%] Building CXX object renderer/CMakeFiles/Renderer.dir/volume.cpp.o
In file included from /opt/project/renderer/volume.cpp:1:
/opt/project/renderer/volume.h:9:10: fatal error: torch/types.h: No such file or directory
9 | #include <torch/types.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [renderer/CMakeFiles/Renderer.dir/build.make:76: renderer/CMakeFiles/Renderer.dir/volume.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:244: renderer/CMakeFiles/Renderer.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
