NVCC options

Hello,

Is it possible to convert a program written in CUDA (.cu files) to C code(.c files), using nvcc options or any other way?
Well… I’ve tried the option (-cuda), which compiles to .cu.c, but it’s not what I wanted, what I need is to get the same cuda program but in C language…!

Thank you in advance

No, there is currently no straightforward way to convert an entire CUDA program into a form that will compile with a standard C compiler and run with anything resembling decent performance. (Device emulation sort of does what you are asking, but it still requires nvcc as the frontend. The resulting program has horrible CPU performance, though.)

Doing this conversion in such a way that the resulting program has good performance (though not as fast as CUDA, of course) is actually an ongoing research topic. There are a few papers that discuss some techniques, but there is no converter that can be used right now.

Are you trying to provide a fallback option for people who don’t have a CUDA device?

Thank you for your quick reply,

No, but I need to convert my cuda program to flowsheet, and I’ve got this software which generates flowcharts from C source code, but not from cuda, so I was thinking the best is to convert .cu to .c and then to flowchart(don’t make fun of me External Image , it could be silly…!)
Please let me know if you have got any useful advance.

Thank you again

Hmm. You could probably fake out your flowchart tool by copying your existing .cu file to a new .c file, and replacing the runtime kernel calls with the <<<>>> syntax with a normal looking function call to your kernel. The resulting file won’t compile in nvcc, but I doubt the flowchart tool will notice.