在Mac上设置CUDA?

时间:2016-12-13 07:45:43

标签: macos shell parallel-processing cuda gpu

我按照NVIDIA网站上的说明在我的电脑上设置CUDA。我已完成“3.2安装”(http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html#installation)的所有操作。我不知道如何使用命令cuda-install-samples-8.0.sh,它说找不到命令。当我尝试运行make来编译一些示例时,我得到以下消息:

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
expr: syntax error
/Developer/NVIDIA/CUDA-8.0/bin/nvcc -ccbin g++ -I../../common/inc  -m64  -Xcompiler -arch -Xcompiler x86_64  -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o vectorAdd.o -c vectorAdd.cu
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).
nvcc fatal   : GNU C/C++ compiler is no longer supported as a host compiler on Mac OS X.
make: *** [vectorAdd.o] Error 1

我希望这与我没有设置环境变量有关。我有一台带有NVIDIA GeForce GT 650M GPU的MacBook Pro,所以我很确定我的电脑与CUDA兼容。

我已经安装了Xcode,并对其进行了更新,并确保安装了命令行工具。

Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

1 个答案:

答案 0 :(得分:-2)

可以在以下链接中找到答案https://github.com/nodejs/node-gyp/issues/569#issuecomment-255589932(bergerjac的回答)。另外可能会出现另一个错误,可能是

Unable to open output file 'vectorAdd.o': 'Error opening output file 'vectorAdd.o': Permission denied

因此我运行了以下命令

sudo chown -R your-user-name /Developer/NVIDIA/CUDA-7.0/samples

我认为它运作正常。