I’m trying to compile PyTorch from source, as I need it with the new ABI and OpenCV (which I also compiled from source) support.
I cloned the repo checked out the submodules, installed the requirements and compiled it with the following command:
CFLAGS=' -D_GLIBCXX_USE_CXX11_ABI=1 ' USE_NCCL=False USE_OPENCV=1 USE_CUDA=1 USE_DISTRIBUTED=0 TORCH_CUDA_ARCH_LIST="5.3;6.2;7.2" MAX_JOBS=5 python3 setup.py install
Building works until around 86%, then it fails with the following trace:
[ 86%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/cuda/comm.cpp.o [ 86%] Linking CXX shared library ../lib/libtorch.so /usr/bin/ld: cannot find -lCUDA_cublas_device_LIBRARY-NOTFOUND collect2: error: ld returned 1 exit status caffe2/CMakeFiles/torch.dir/build.make:27077: recipe for target 'lib/libtorch.so' failed make: *** [lib/libtorch.so] Error 1 CMakeFiles/Makefile2:5011: recipe for target 'caffe2/CMakeFiles/torch.dir/all' failed make: *** [caffe2/CMakeFiles/torch.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Traceback (most recent call last): File "setup.py", line 759, in <module> build_deps() File "setup.py", line 321, in build_deps cmake=cmake) File "/opt/pytorch/tools/build_pytorch_libs.py", line 63, in build_caffe2 cmake.build(my_env) File "/opt/pytorch/tools/setup_helpers/cmake.py", line 330, in build self.run(build_args, my_env) File "/opt/pytorch/tools/setup_helpers/cmake.py", line 143, in run check_call(command, cwd=self.build_dir, env=env) File "/usr/lib/python3.6/subprocess.py", line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '5']' returned non-zero exit status 2.
I can’t seem to find the issue here, does anyone have an idea?
If you need more info, just let me know.