Hello, everone. I’m a new in PyTorch.
Today I’m trying to build PyTorch from source on Ubuntu 16.04 (as described in pytorch repo), but I’m getting an error:
[1293/3131] Generating …/…/…/torch/init.pyi
Writing ./torch/init.pyi
[1296/3131] Generating include/renamesse2.h
Generating renamesse2.h: mkrename 2 4 sse2
[1302/3131] Generating …/…/…/include/sleef.h
Generating sleef.h: mkrename 2 4 __m128d __m128 __m128i __m128i SSE2
Generating sleef.h: mkrename 2 4 __m128d __m128 __m128i __m128i SSE2 sse2
Generating sleef.h: mkrename 2 4 __m128d __m128 __m128i __m128i SSE2 sse4
Generating sleef.h: mkrename 4 8 __m256d __m256 __m128i struct\ {\ __m128i\ x,\ y;\ } AVX
Generating sleef.h: mkrename 4 8 __m256d __m256 __m128i struct\ {\ __m128i\ x,\ y;\ } AVX avx
Generating sleef.h: mkrename 4 8 __m256d __m256 __m128i struct\ {\ __m128i\ x,\ y;\ } AVX fma4
Generating sleef.h: mkrename 4 8 __m256d __m256 __m128i __m256i AVX avx2
Generating sleef.h: mkrename 2 4 __m128d __m128 __m128i __m128i SSE2 avx2128
Generating sleef.h: mkrename 8 16 __m512d __m512 __m256i __m512i AVX512F
Generating sleef.h: mkrename 8 16 __m512d __m512 __m256i __m512i AVX512F avx512f
[2076/3131] Linking CXX shared library lib/libthnvrtc.so
FAILED: lib/libthnvrtc.so
: && /usr/bin/c++ -fPIC -fvisibility-inlines-hidden -fopenmp -DUSE_FBGEMM -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-unused-but-set-variable -Wno-maybe-uninitialized -DHAVE_AVX_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION -O3  -rdynamic -shared -Wl,-soname,libthnvrtc.so -o lib/libthnvrtc.so caffe2/torch/CMakeFiles/thnvrtc.dir/csrc/jit/fuser/cuda/thnvrtc.cpp.o  -Wl,-rpath,/home/newnfs/yuyunjie/anaconda3/lib:::::::: /usr/lib/x86_64-linux-gnu/libcuda.so /home/newnfs/yuyunjie/anaconda3/lib/libnvrtc.so && :
/usr/lib/x86_64-linux-gnu/libcuda.so: file not recognized: File truncated
collect2: error: ld returned 1 exit status
[2125/3131] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state.dir/python/pybind_state.cc.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File “setup.py”, line 719, in 
build_deps()
File “setup.py”, line 285, in build_deps
build_dir=‘build’)
File “/home/newnfs/yuyunjie/code/pytorch/tools/build_pytorch_libs.py”, line 278, in build_caffe2
check_call(ninja_cmd, cwd=build_dir, env=my_env)
File “/home/newnfs/yuyunjie/anaconda3/lib/python3.7/subprocess.py”, line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ninja’, ‘install’]’ returned non-zero exit status 1.
My environment is:
Ubuntu 16.04
CUDA 9.2
Python 3.7
gcc 5.4
Any idea how I can solve this error?
Thank you so much!