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

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

问题描述

我在带有 GTX 570(计算能力 2.0)的 Ubuntu 10.10 上使用 CUDA 4.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?

推荐答案

你想要 nvcc-ccbin 选项,例如要使用 icpc(英特尔 C++ 编译器),请使用 nvcc -ccbin=icpc(假设 icpc 在您的 $PATH 中可用).

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).

请注意,您应该始终传递 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 for linux 使用的默认主机编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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