Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I compile a cuda program without having a cuda device

Tags:

Is it possible to compile a CUDA program without having a CUDA capable device on the same node, using only NVIDIA CUDA Toolkit...?

like image 874
DEV Avatar asked Nov 25 '13 07:11

DEV


People also ask

Can I compile CUDA without Nvidia GPU?

Hi, even if you dont have dedicated Nvidia GPU card in your laptop or computer, you can execute CUDA programs online using Google Colab.

How do I compile a CUDA program?

In order to compile CUDA code files, you have to use nvcc compiler. Cuda codes can only be compiled and executed on node that have a GPU. Heracles has 4 Nvidia Tesla P100 GPUs on node18. Cuda Compiler is installed on node 18, so you need ssh to compile cuda programs.

Is Nvidia Cuda necessary?

Applications that use the driver API only need the CUDA driver library ("nvcuda. dll" under Windows), which is included as part of the standard NVIDIA driver install. Applications that use the runtime API also require the runtime library ("cudart.

What is required to run CUDA program on a computer system?

To use CUDA on your system, you will need the following installed: A CUDA-capable GPU. A supported version of Microsoft Windows. A supported version of Microsoft Visual Studio.


1 Answers

The answer to your question is YES.

The nvcc compiler driver is not related to the physical presence of a device, so you can compile CUDA codes even without a CUDA capable GPU. Be warned however that, as remarked by Robert Crovella, the CUDA driver library libcuda.so (cuda.lib for Windows) comes with the NVIDIA driver and not with the CUDA toolkit installer. This means that codes requiring driver APIs (whose entry points are prefixed with cu, see Appendix H of the CUDA C Programming Guide) will need a forced installation of a "recent" driver without the presence of an NVIDIA GPU, running the driver installer separately with the --help command line switch.

Following the same rationale, you can compile CUDA codes for an architecture when your node hosts a GPU of a different architecture. For example, you can compile a code for a GeForce GT 540M (compute capability 2.1) on a machine hosting a GT 210 (compute capability 1.2).

Of course, in both the cases (no GPU or GPU with different architecture), you will not be able to successfully run the code.

For the early versions of CUDA, it was possible to compile the code under an emulation modality and run the compiled code on a CPU, but device emulation is since some time deprecated. If you don't have a CUDA capable device, but want to run CUDA codes you can try using gpuocelot (but I don't have any experience with that).

like image 157
Vitality Avatar answered Nov 12 '22 23:11

Vitality