I am looking for help getting started with a project involving CUDA. My goal is to have a project that I can compile in the native g++ compiler but uses CUDA code. I understand that I have to compile my CUDA code in nvcc compiler, but from my understanding I can somehow compile the CUDA code into a cubin file or a ptx file.
Here are my questions:
- How do I use nvcc to compile into a cubin file or a ptx file? Don't I need a -c or something?
- Which file type do I want to use?
- What are the g++ commands to correctly compile and link the project together?
Assume the following:
- I have a file called "main.cpp" that has a main function in it and includes cuda.h.
- I have another file called "cudaFunc.cu" that has CUDA code in it. Let's say, for instance, that I want to add two integer arrays that exist in main.cpp.