I want to compile a very basic hello world level Cuda program under Linux. I have three files:
- the kernel: helloWorld.cu
- main method: helloWorld.cpp
- common header: helloWorld.h
Could you write me a simple Makefile to compile this with nvcc and g++?
Thanks,
Gabor
My version, verbose but transparent:
Here is an example what my current project looks like. As you can see there is a few OpenGL libraries
then run
make ce
and./ce
Just in case, here's my variant. I use it to compile CUDA projects on Mac, but I think it will suit Linux too. It requires CUDA SDK.
I've never heard of Cuda before, but from the online documentation it looks as if X.cu is supposed to be compiled into X.o, so having helloWorld.cu and helloWorld.cpp is not a good idea. With your permission I'll rename the "kernel" helloKernel.cu, then this should work:
(Note that those leading spaces are tabs.)
If that works, try a slicker version: