I am trying to install pytorch with gpu support on my MacBook Pro following official instructions.
Things go smoothly until an error occurred:
[ 70%] Building NVCC (Device) object caffe2/CMakeFiles/caffe2_gpu.dir/__/aten/src/THC/caffe2_gpu_generated_THCTensorMath.cu.o
nvcc fatal : The version ('90000') of the host compiler ('Apple clang') is not supported
nvcc fatal : The version ('90000') of the host compiler ('Apple clang') is not supported
CMake Error at caffe2_gpu_generated_THCBlas.cu.o.Release.cmake:219 (message):
Error generating
/Users/username/Dev/pytorch-gpu/pytorch/build/cCaMfafkee2 /ECrMraokre Faitle sc/acfaffef2e_2g_pgup_ug.ednierr/a_t_e/da_tTeHnC/Sslrece/pT.HcCu/..o/.cRaeflfeea2s_eg.pcum_agkeen:e2r1a9t e(dm_eTsHsCaBglea)s:.
It seems that CUDA and clang are not working well together.
I searched over internet and found these posts, but they did not solve my problem:
Here's my environment:
I am answering my own question.
Incorrect CUDA installation on macOS could be a nightmare. The versions of CUDA, Xcode, clang and macOS really matter. Here are some of the official tested ones:
+------+--------------+------------+---------------------------------+--------+
| CUDA | Xcode | Apple LLVM | Mac OSX Version (native x86_64) | Yes/No |
+------+--------------+------------+---------------------------------+--------+
| 8.0 | 7.2 | 7.0.3 | 10.11 | YES |
| 8.0 | 7.2 | 7.0.3 | 10.12 | NO |
| 8.0 | 8.2 | 8.0.0 | 10.11 | NO |
| 8.0 | 8.2 | 8.0.0 | 10.12 | YES |
| 9.0 | 8.3.3 | 8.1.0 | 10.12 | YES |
| 9.1 | 9.2 | 9.0.0 | 10.13.3 | YES |
| 9.2 | 9.2 | 9.0.0 | 10.13.5 | YES |
| 10.0 | 9.4 | 9.0.0 | 10.13.6 | YES |
| 10.1 | 10.1 (10B61) | 10.0.0 | 10.13.6 (17G2307) | YES |
+------+--------------+------------+---------------------------------+--------+
For CUDA Releases before 8.0, please search for NVIDIA CUDA INSTALLATION GUIDE FOR MAC OS X plus the CUDA version number, there should be a table of version matching in that PDF file.