nvcc用于linux的默认主机编译器 [英] Default host compiler used by nvcc for linux

查看:767
本文介绍了nvcc用于linux的默认主机编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CUDA 4.0在Ubuntu 10.10与GTX 570(计算能力2.0),与GCC编译器套件。根据我的理解,在编译期间CUDA编译器驱动程序nvcc将 .cu 文件拆分为主机代码和设备代码,并调用主机编译器编译主机代码并编译设备代码单独。最后,它将生成的主机对象代码和设备PTX代码合并为单个可执行文件。

I am using CUDA 4.0 on Ubuntu 10.10 with GTX 570 (compute capcability 2.0), with the GCC compiler suite. As I understand it, during compilation the CUDA compiler driver nvcc splits the .cu files into host code and device code and calls the host compiler to compile the host code and compiles the device code separately. Finally it merges the generated host object code and the device PTX code into a single executable.

对于Linux系统,编译主机代码时调用的默认编译器是什么?是GCC套件的C编译器( gcc )还是C ++编译器( g ++

For Linux systems what is the default compiler that is invoked for compiling the host code? Is it the C compiler (gcc) or the C++ compiler (g++) of the GCC suite?

推荐答案

您想要 -ccbin 选项> nvcc ,例如要使用 icpc (Intel C ++编译器),请使用 nvcc -ccbin = icpc (假设

You want the -ccbin option for nvcc, e.g. to use icpc (the Intel C++ compiler), use nvcc -ccbin=icpc (assuming the icpc is available in your $PATH).

请在您的 $ PATH 传递一个C ++编译器( g ++ icpc 等),因为 nvcc 将代码视为C ++,即使它是C代码。

Note that you should always pass a C++ compiler (g++, icpc, etc.), since nvcc treats the code as C++, even when it's C code.

这篇关于nvcc用于linux的默认主机编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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