Use CUDA 8.0 with macOS Sierra (10.12)

NOTICE 注意

The latest version of CUDA8.63 is now working well with macOS Sierra 10.12.3, and there is no need to bother~

最新版本的CUDA8.63早已经和渣果Sierra10.12.3磨合的不错了,完全能够正常工作不用折腾了。

IGNORE THESE 已经兼容了不用看了

The moment I am typing, the latest version of CUDA is 8.0.4. It is the first version that provide the CUDA driver for macOS Sierra AKA 10.12.

我打字的这个时候,最新版本的CUDA8.0.4. 这是NVIDIA首次对macOS Sierra 也就是10.12 提供了CUDA驱动支持.

But there comes the bad news as usual that the latest version of CUDA is not compatible with clang 8.0.0, which is provided with Xcode8. So When trying to compile the sample apps, you will get the following error:

不过有个很悲伤的消息,就是这个最新版本的CUDA很自然的与最新版的Xcode8所提供的clang 8.0.0不兼容。所以当你安装完了那个巨大的Dmg之后 想编译CUDA提供的sample的时候就要遇到下面这个错误提示了:

nvcc fatal   : The version ('80000') of the host compiler ('Apple clang') is not supported

Someone downgrads to Xcode 7.* but still gets the following errors:

有的小伙伴尝试了降级到Xcode7.*,然后还是得到了一大堆错误:

 ...
make[1]: *** [asyncAPI.o] Error 2
make: *** [0_Simple/asyncAPI/Makefile.ph_build] Error 2

Luckily, I find that we can make the CUDA work with keeping both Xcode 8 and 7. I assume that you are using the Xcode8 as /Applications/Xcode.app and have no other versions of Xcode.

好在我探索了一下,找到一个思路来运行CUDA,并同时保留Xcode8和7。我假设你目前仅安装了Xcode8,路径和名字为/Applications/Xcode.app。

  • Rename /Applications/Xcode.app to Xcode8.app, so we can keep both of 8 and 7 without the confliction of their names.

    把已经安装的Xcode.app重命名成Xcode8.app,这样就跟等会我们要安装的Xcode7不发生名字的冲突了。

sudo mv /Applications/Xcode.app /Applications/Xcode8.app
sudo xcode-select --switch /Library/Developer/CommandLineTools
  • Run the command below to check the version of clang, which should be 7.3.0:

    然后进行一下版本测试吧,应该是7.3.0了:

clang -v

In my case I got this:

我这里得到的结果如下所示:

Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-ap ple-darwin16.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Then we can compile the sample app of CUDA. Those information are picked up fom This Post.

然后就可以编译CUDA提供的sample了。上面这些信息收集整理自 这个帖子

Category: Mac
Category
Tagcloud
Communicate VTK GeoPython Microscope IDE Story Poem ChromeBook Radio Scholar Linux Xcode Memory Data Book Camera Lens RTL-SDR Photo Software Programming Visualization Video VirtualBox Mac Moon Hardware QT Discuss Chat NAS DIY University Download Mount&Blade Junck VisPy Translation Kivy Conda Science Hackintosh Library Hack Server RaspberryPi Hate Pyenv Game MayaVi Raspbian Lesson Python Geology GlumPy CUDA Disease Telescope