安裝torch出現如下錯誤make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o] Error 1 CMak
torch安裝地址
按照官網步驟
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch
bash install-deps
./install.sh
依賴保證安裝完畢以後
執行最後一步後出現錯誤如下:
/home/brian/torch/extra/cutorch/lib/THC/generic/THCTensorMathPairwise.cu(66): error: more than one operator "!=" matches these operands: function "operator!=(const __half &, const __half &)" function "operator!=(half, half)" operand types are: half != half
1 error detected in the compilation of "/tmp/tmpxft_000078f9_00000000-6_THCTensorMathPairwise.cpp1.ii". CMake Error at THC_generated_THCTensorMathPairwise.cu.o.cmake:267 (message): Error generating file /home/brian/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMathPairwise.cu.o
lib/THC/CMakeFiles/THC.dir/build.make:140: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMathPairwise.cu.o' failed make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMathPairwise.cu.o] Error 1 make[2]: *** Waiting for unfinished jobs.... /home/brian/torch/extra/cutorch/lib/THC/generic/THCTensorMath.cu(393): error: more than one operator "==" matches these operands: function "operator==(const __half &, const __half &)" function "operator==(half, half)" operand types are: half == half
/home/brian/torch/extra/cutorch/lib/THC/generic/THCTensorMath.cu(414): error: more than one operator "==" matches these operands: function "operator==(const __half &, const __half &)" function "operator==(half, half)" operand types are: half == half
2 errors detected in the compilation of "/tmp/tmpxft_00007911_00000000-6_THCTensorMath.cpp1.ii". CMake Error at THC_generated_THCTensorMath.cu.o.cmake:267 (message): Error generating file /home/brian/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath.cu.o
lib/THC/CMakeFiles/THC.dir/build.make:112: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o' failed make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o] Error 1 CMakeFiles/Makefile2:172: recipe for target 'lib/THC/CMakeFiles/THC.dir/all' failed make[1]: *** [lib/THC/CMakeFiles/THC.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2
此時嘗試採用如下命令進行安裝:
sudo su
export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"
bash install-deps
yes | bash ./install.sh
按照此方法,對我來講是有效的,已經成功安裝torch