【发布时间】:2017-09-25 01:37:29
【问题描述】:
我正在使用 MacOS Sierra 10.12.4 并尝试使用 CUDA 兼容的 NVIDIA GeForce GT 750M 在我的 MacBook Pro(2013 年末)上运行 CUDA 8.0。
我按照NVIDIA installation guide 安装了Xcode 8.2 和相应的命令行工具,但是当我尝试编译示例时出现以下错误:
$ make -C 1_Utilities/deviceQuery
/Developer/NVIDIA/CUDA-8.0/bin/nvcc -ccbin clang++ -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 deviceQuery.o -c deviceQuery.cpp
nvcc 警告:“compute_20”、“sm_20”和“sm_21”架构已弃用,可能会在未来的版本中删除(使用 -Wno-deprecated-gpu-targets 来抑制警告)。
nvcc致命:不支持主机编译器('clang')的版本('30900')
make: *** [deviceQuery.o] 错误 1
这是我认为的问题所在:
“make”命令使用了错误的 clang,但我不知道如何更改/修复它。
在这里你可以看到我机器上的两个版本的clang:
$ clang --version
clang 版本 3.9.0 (tags/RELEASE_390/final)
目标:x86_64-apple-darwin16.5.0 线程模型:posix
安装目录:/opt/local/libexec/llvm-3.9/bin$ /usr/bin/clang --version
Apple LLVM 版本 8.0.0 (clang-800.0.42.1)
目标:x86_64-apple-darwin16.5.0
线程模型:posix 安装目录:/Applications/Xcode_8.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
如何让“make”命令默认使用文件夹 /usr/bin/clang 中正确的 clang 版本?
或者有没有办法通过添加一些参数/标签来告诉“make”命令显式使用文件夹/usr/bin/clang中的clang版本?
如果有帮助,这也是我的 ~/.bash_profile 的样子:
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# MacPorts Installer addition on 2016-09-26_at_12:06:30: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# colorful terminal
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
# CUDA
export PATH=/Developer/NVIDIA/CUDA-8.0.61/bin${PATH:+:${PATH}}
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-8.0.61/lib\
${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
【问题讨论】:
标签: cuda clang nvidia macos-sierra