thanks for your response so it was not,
I found it will detect it in my build if I ran the following
sudo CUDA_HOME="/opt/cuda" python setup.py install
now I am getting another error now 
make[2]: Entering directory '/root/pytorch/third_party/nccl/nccl/src/collectives/device'
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
nvlink fatal   : Internal error: reference to deleted section
make[2]: *** [Makefile:83: /root/pytorch/build/nccl/obj/collectives/device/devlink.o] Error 1
make[2]: Leaving directory '/root/pytorch/third_party/nccl/nccl/src/collectives/device'
make[1]: *** [Makefile:45: devicelib] Error 2
make[1]: Leaving directory '/root/pytorch/third_party/nccl/nccl/src'
make: *** [Makefile:25: src.build] Error 2
[10/2853] Building CXX object third_party/protobuf/cmake/CMakeFiles/libprotoc.dir/__/src/google/protobuf/compiler/csharp/csharp_message.cc.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 734, in <module>
    build_deps()
  File "setup.py", line 281, in build_deps
    build_dir='build')
  File "/root/pytorch/tools/build_pytorch_libs.py", line 248, in build_caffe2
    check_call(ninja_cmd, cwd=build_dir, env=my_env)
  File "/opt/anaconda/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja', 'install']' returned non-zero exit status 1.