ccudanvcc

Can i execute Kernel Function in C without nvcc compiler


i have a question (CUDA) can i execute kernel function at C without nvcc compiler? i had this question asked and they told me that it can be done if you call Call directly from CUDA driver API with C, just is way harder.

But i want feedback from other people too.


Solution

  • Currently, using the packaged nvidia-supplied toolchains, if you write CUDA code in C, the device compiler (nvcc) will be required at some point to, at a minimum, convert this C source code to valid PTX. After that point, the toolkit (which includes nvcc) is not absolutely necessary. PTX code can be JIT-compiled by the driver (which is separate from the toolkit) to executable code for whatever GPU is being used. And the process of launching an appropriately written kernel (perhaps JIT-compiled from PTX) can be accomplished using only calls into the driver API.

    The runtime API was created, in part, because it can simplify the process and make the overall code creation process appear to be similar to what a typical C/C++ programmer is used to.