Repository: pytorch
Issue: Failed to compile PyTorch on IBM Power 9 architecture with CUDA 10
Labels: module: build,triaged

I started to build `pytorch` and `libtorch` on a IBM Power 9 machine with RedHat 7.6 and cuda 10.0 installed. For both `pytorch` and `libtorch` I got an error during building NVCC. I appreciate any help or comment. 


For `pytorch`, I tried `python setup.py install` and it resulted an error during building caffe2:
```
[1667/1694] Building NVCC (Device) object modules/detectron/CMakeFiles/c...ir/caffe2_detectron_ops_gpu_generated_sigmoid_cross_entropy_loss_op.cu.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "tools/build_libtorch.py", line 23, in <module>
    rerun_cmake=True, cmake_only=False, cmake=CMake())
  File "/c/bb04na2a/vol/bigdisk/plx/rl/pytorch/tools/build_pytorch_libs.py", line 64, in build_caffe2
    cmake.build(my_env)
  File "/c/bb04na2a/vol/bigdisk/plx/rl/pytorch/tools/setup_helpers/cmake.py", line 329, in build
    self.run(build_args, my_env)
  File "/c/bb04na2a/vol/bigdisk/plx/rl/pytorch/tools/setup_helpers/cmake.py", line 133, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/bigdisk/plx/rl/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', '160']' returned non-zero exit status 1.

```


For `libtorch` I called `python tools/build_libtorch.py` and similarly it resulted an error during building caffe2:

```
[2633/2662] Building NVCC (Device) object modules/detectron/CMakeFiles/c...tectron_ops_gpu.dir/caffe2_detectron_ops_gpu_generated_sample_as_op.cu.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 756, in <module>
    build_deps()
  File "setup.py", line 321, in build_deps
    cmake=cmake)
  File "/c/bb04na2a/vol/bigdisk/plx/rl/pytorch/tools/build_pytorch_libs.py", line 64, in build_caffe2
    cmake.build(my_env)
  File "/c/bb04na2a/vol/bigdisk/plx/rl/pytorch/tools/setup_helpers/cmake.py", line 329, in build
    self.run(build_args, my_env)
  File "/c/bb04na2a/vol/bigdisk/plx/rl/pytorch/tools/setup_helpers/cmake.py", line 133, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/bigdisk/plx/rl/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', '160']' returned non-zero exit status 1.
(base) machine1>
(base) machine1> ls tools/
amd_build          build_pytorch_libs.py  cwrap              generated_dirs.txt           __init__.py  pyi                      setup_helpers
aten_mirror.sh     build_variables.py     docker             git_add_generated_dirs.sh    jit          pytorch.version          shared
autograd           clang_format.py        download_mnist.py  git-pre-commit               nnwrap       README.md
build_libtorch.py  clang_tidy.py          flake8_hook.py     git_reset_generated_dirs.sh  __pycache__  run-clang-tidy-in-ci.sh
(base) machine1> python tools/build_variables.py
Traceback (most recent call last):
  File "tools/build_variables.py", line 5, in <module>
    load("@bazel_skylib//lib:new_sets.bzl", "sets")
NameError: name 'load' is not defined
(base) machine1> python tools/build_pytorch_libs.py
Traceback (most recent call last):
  File "tools/build_pytorch_libs.py", line 6, in <module>
    from .setup_helpers import escape_path
ModuleNotFoundError: No module named '__main__.setup_helpers'; '__main__' is not a package
```