This solves the nvlink error issue.



 ptrblck:

TORCH_CUDA_ARCH_LIST=“5.0” python setup.py install


But while compiling some other error showed up.

[3064/3538] Building CXX object caffe2/CMakeFiles/torch_cuda.dir/__/torch/csrc/cuda/nccl.cpp.o
../torch/csrc/cuda/nccl.cpp: In function ‘ncclDataType_t torch::cuda::nccl::detail::get_data_type(const at::Tensor&)’:
../torch/csrc/cuda/nccl.cpp:85:14: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
   if (t.type().backend() != Backend::CUDA) {
              ^
In file included from ../aten/src/ATen/Tensor.h:11,
                 from ../aten/src/ATen/Context.h:4,
                 from ../aten/src/ATen/ATen.h:5,
                 from ../torch/csrc/cuda/nccl.h:3,
                 from ../torch/csrc/cuda/nccl.cpp:1:
aten/src/ATen/core/TensorBody.h:244:30: note: declared here
   DeprecatedTypeProperties & type() const {
                              ^~~~
../torch/csrc/cuda/nccl.cpp: In function ‘void torch::cuda::nccl::detail::check_inputs(at::TensorList, at::TensorList, int, int)’:
../torch/csrc/cuda/nccl.cpp:129:30: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
   auto type = inputs[0].type();
                              ^
In file included from ../aten/src/ATen/Tensor.h:11,
                 from ../aten/src/ATen/Context.h:4,
                 from ../aten/src/ATen/ATen.h:5,
                 from ../torch/csrc/cuda/nccl.h:3,
                 from ../torch/csrc/cuda/nccl.cpp:1:
aten/src/ATen/core/TensorBody.h:244:30: note: declared here
   DeprecatedTypeProperties & type() const {
                              ^~~~
../torch/csrc/cuda/nccl.cpp:141:30: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
     if (!(type == input.type() && type == output.type())) {
                              ^
In file included from ../aten/src/ATen/Tensor.h:11,
                 from ../aten/src/ATen/Context.h:4,
                 from ../aten/src/ATen/ATen.h:5,
                 from ../torch/csrc/cuda/nccl.h:3,
                 from ../torch/csrc/cuda/nccl.cpp:1:
aten/src/ATen/core/TensorBody.h:244:30: note: declared here
   DeprecatedTypeProperties & type() const {
                              ^~~~
../torch/csrc/cuda/nccl.cpp:141:55: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
     if (!(type == input.type() && type == output.type())) {
                                                       ^
In file included from ../aten/src/ATen/Tensor.h:11,
                 from ../aten/src/ATen/Context.h:4,
                 from ../aten/src/ATen/ATen.h:5,
                 from ../torch/csrc/cuda/nccl.h:3,
                 from ../torch/csrc/cuda/nccl.cpp:1:
aten/src/ATen/core/TensorBody.h:244:30: note: declared here
   DeprecatedTypeProperties & type() const {
                              ^~~~
../torch/csrc/cuda/nccl.cpp: In function ‘bool torch::cuda::nccl::is_available(at::TensorList)’:
../torch/csrc/cuda/nccl.cpp:181:29: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
     auto type = tensor.type();
                             ^
In file included from ../aten/src/ATen/Tensor.h:11,
                 from ../aten/src/ATen/Context.h:4,
                 from ../aten/src/ATen/ATen.h:5,
                 from ../torch/csrc/cuda/nccl.h:3,
                 from ../torch/csrc/cuda/nccl.cpp:1:
aten/src/ATen/core/TensorBody.h:244:30: note: declared here
   DeprecatedTypeProperties & type() const {
                              ^~~~
[3078/3538] Linking CXX executable bin/utility_ops_gpu_test
FAILED: bin/utility_ops_gpu_test 
: && /usr/bin/c++  -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -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-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Wno-stringop-overflow -DHAVE_AVX_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION -O3  -rdynamic    -rdynamic caffe2/CMakeFiles/utility_ops_gpu_test.dir/operators/utility_ops_gpu_test.cc.o  -o bin/utility_ops_gpu_test -L/root/anaconda3/lib -Wl,-rpath,/usr/local/cuda/lib64:/root/anaconda3/lib:/codehub/external/pytorch/build/lib: /usr/local/cuda/lib64/libcudart.so lib/libgtest_main.a -Wl,--no-as-needed,/codehub/external/pytorch/build/lib/libtorch.so -Wl,--as-needed -Wl,--no-as-needed,/codehub/external/pytorch/build/lib/libtorch_cpu.so -Wl,--as-needed lib/libprotobuf.a -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -fopenmp -lpthread -lm -ldl lib/libmkldnn.a -Wl,--no-as-needed,/codehub/external/pytorch/build/lib/libtorch_cuda.so -Wl,--as-needed lib/libc10_cuda.so lib/libc10.so /usr/local/cuda/lib64/libnvToolsExt.so /usr/local/cuda/lib64/libcudart.so /usr/local/cuda/lib64/libcufft.so /usr/local/cuda/lib64/libcurand.so -lcublas /usr/lib/x86_64-linux-gnu/libcudnn.so lib/libgtest.a -lpthread && :
/codehub/external/pytorch/build/lib/libtorch_cuda.so: undefined reference to `cudaSetupArgument'
/codehub/external/pytorch/build/lib/libtorch_cuda.so: undefined reference to `cudaConfigureCall'
/codehub/external/pytorch/build/lib/libtorch_cuda.so: undefined reference to `cudaLaunch'
collect2: error: ld returned 1 exit status
[3085/3538] Building CXX object caffe2/CMakeFiles/net_dag_utils_test.dir/core/net_dag_utils_test.cc.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 737, in <module>
    build_deps()
  File "setup.py", line 316, in build_deps
    cmake=cmake)
  File "/codehub/external/pytorch/tools/build_pytorch_libs.py", line 62, in build_caffe2
    cmake.build(my_env)
  File "/codehub/external/pytorch/tools/setup_helpers/cmake.py", line 341, in build
    self.run(build_args, my_env)
  File "/codehub/external/pytorch/tools/setup_helpers/cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/root/anaconda3/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 1.