Cuda编译器不工作与GCC 4.5 + [英] Cuda compiler not working with GCC 4.5 +

查看:205
本文介绍了Cuda编译器不工作与GCC 4.5 +的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Cuda的新人,我试图编译这个简单的 test_1.cu 文件:

I am new to Cuda, and I am trying to compile this simple test_1.cu file:

#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:

my 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,而不会弄乱一切?

How can I install a second version of gcc (4.4 -) along with 4.6 without messing everything up?

我发现了这个旧主题:

CUDA与我的gcc版本不兼容

答案是:


gcc 4.5和4.6不支持CUDA - 代码不能编译,
其余的工具链,包括cuda-gdb, t工作正常。

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.

您唯一的解决方案是安装一个gcc 4.4版本作为第二个
编译器。
您不能使用它们,并且限制是不可协商的。 (大多数发行版都允许)。有一个选项
nvcc --compiler-bindir,可以用来指向一个替代的
编译器。创建本地目录和make符号链接到
支持的gcc版本可执行文件。通过--compiler-bindir选项将本地目录传递给nvcc
,您应该能够编译
CUDA代码,而不影响系统的其余部分。

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命令完成的。

Doing some research online shows several methods for accomplishing this task. I just tested the method found here: http://www.vectorfabrics.com/blog/item/cuda_4.0_on_ubuntu_11.04 and it worked like a charm for me. It steps you through installing gcc 4.4 and creating scripts to run that version with nvcc. If you prefer trying the method mentioned in your post I'd recommend following that first link to install gcc4.4 and then create symbolic links as mentioned in your post. Creating symbolic links in Linux is accomplished by using the 'ln' command.

例如:

 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/ 。希望指向正确的方向。

This link gives a few examples of creating symbolic links on both Ubuntu and Windows: http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/. Hopefully that points you in the right direction.

这篇关于Cuda编译器不工作与GCC 4.5 +的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆