LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Makefile for CUDA/C++ code (https://www.linuxquestions.org/questions/programming-9/makefile-for-cuda-c-code-815126/)

naaman 06-19-2010 10:29 AM

Makefile for CUDA/C++ code
 
Hi,

I'd like to write a Makefile for my CUDA/C++ code but I didn't know
how things work with CUDA, I mean there is a nvcc compiler but I don't know what I've got to do with this.
Do I have to firstly run nvcc and then g++ or only nvcc to compile my CUDA/C++ code ? I found nothing on the web explaining such basic things ....

Can you help me ?

thanks,

naaman 06-19-2010 11:00 AM

I understood how it works by myself ...
Firstly you have to give the compiler path so that nvcc find it (but by default it goes in /usr/bin/ to look for it, I think)
And you have to specify what programing language nvcc will deal with. By default nvcc use a C++ compiler.

So the both command are the same for most UNIX platforms :
Code:

nvcc -o mycodebin ./mycodesource.cpp
nvcc --compiler-bindir=/usr/bin --host-compilation 'C++' -o mycodebin ./mycodesoure.cpp

And you can give some options to the C/C++ compiler by using --compiler-options I guess


All times are GMT -5. The time now is 02:43 PM.