I am on Ubuntu 12.04 LTS and have installed CUDA 5.5. I understand that without any CUDA/GPGPU elements in the code, nvcc behaves as a C/C++ compiler -- more like gcc, however is there any exception to this rule ? if not, then can I use nvcc as gcc for non-CUDA C/C++ codes ?

有帮助吗?

解决方案

No, nvcc doesn't behave like a C/C++ compiler for host code. What it does is the following:

  1. separate device from host code into two separate files
  2. compile device code (with nvcc, cudafe, ptxas)
  3. invoke gcc for host code

If no device code exists, nothing is done in steps 1) and 2). So nvcc is actually no compiler, it is a compiler driver which invokes the right compilers for every part in the right order. To answer your question, if you use nvcc to compile host code only, you still use gcc.

其他提示

It doesn't accept options to suppress warnings ( -W*)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top