在Mac上设置CUDA



我正在按照NVIDIA网站上的说明进行操作,以在计算机上设置CUDA。我已经完成了所有内容,直到" 3.2安装"(http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-os-os-x/index.html#installation)。我不确定如何使用命令cuda-install-samples-8.0.sh,它说找不到命令。当我尝试运行以编译一些样本时,我会收到以下消息:

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

我希望这与我没有设置环境变量有关。我有一个MacBook Pro,其中包括NVIDIA GEFORCE GT 650M GPU,所以我很确定我的计算机与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

可以通过以下链接找到答案https://github.com/nodejs/node-gyp/issues/569#issuecomment-2555589932(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

我相信它可以正常工作。

最新更新