linux cuda 如何编译器,linux – Cuda编译器不使用GCC 4.5

我是Cuda的新手,我正在尝试编译这个简单的test_1.cu文件:

#include

__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 :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而不会搞乱一切?

我找到了这个老话题:

答案是:

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]

标签:linux,cuda,gcc,ubuntu,nvidia

来源: https://codeday.me/bug/20191003/1845622.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值