我是Cuda的新手,我正在尝试编译这个简单的test_1.cu文件:
#include <stdio.h>
__global__ void kernel(void)
{
}
int main (void)
{
kernel<<<1,1>>>();
printf( "Hello, World!\n");
return 0;
}
使用这个:nvcc test_1.cu
我得到的输出是:
In file included from /usr/local/cuda/bin/../include/cuda_runtime.h:59:0,
from <command-line>:0:
/usr/local/cuda/bin/../include/host_config.h:82:2: error: #error -- unsupported GNU version! gcc 4.5 and up are not supported!
我的gcc –version:
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or fitness FOR A PARTIculaR PURPOSE.
如何安装第二个版本的gcc(4.4 – )和4.6而不会搞乱一切?
我找到了这个老话题:
CUDA incompatible with my gcc version
答案是:
gcc 4.5 and 4.6 are not supported with CUDA – code won’t compile and
the rest of the toolchain, including cuda-gdb, won’t work properly.
You cannot use them, and the restriction is non-negotiable.Your only solution is to install a gcc 4.4 version as a second
compiler (most distributions will allow that). There is an option to
nvcc –compiler-bindir which can be used to point to an alternative
compiler. Create a local directory and the make symbolic links to the
supported gcc version executables. Pass that local directory to nvcc
via the –compiler-bindir option, and you should be able to compile
CUDA code without effecting the rest of your system.
但我不知道该怎么做
解决方法:
在线进行一些研究显示了完成此任务的几种方法.我刚刚测试了这里找到的方法:http://www.vectorfabrics.com/blog/item/cuda_4.0_on_ubuntu_11.04,它对我来说就像一个魅力.它将引导您完成安装gcc 4.4并创建脚本以使用nvcc运行该版本.如果您更喜欢尝试帖子中提到的方法,我建议您按照第一个链接安装gcc4.4,然后创建帖子中提到的符号链接.在Linux中创建符号链接是使用’ln’命令完成的.
例如:
ln -s [source file/folder path] [linkpath]
此链接提供了一些在Ubuntu和Windows上创建符号链接的示例:http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/.希望这可以指向正确的方向.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。