ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux – Cuda编译器不使用GCC 4.5

2019-10-03 01:00:43  阅读:245  来源: 互联网

标签:linux cuda gcc ubuntu nvidia


我是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/.希望这可以指向正确的方向.

标签:linux,cuda,gcc,ubuntu,nvidia
来源: https://codeday.me/bug/20191003/1845622.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有