How to write a basic cude program?
Hi all,

I am totally a greenhand here and with little programming experience.

After reading the programming guide and some examples, I got to understand a little about cuda however I still don't know how to wirte a basic program like "hello world!" with cuda. Why some example have xx.cu and xx_kenel.cu and xx_gold.cpp while some dont, some of the codes are just testing cuda as far as I see. I got confused.

My current task is to realize the particle swarm optimization algorithm with cuda but I dont know how to get started. If someone woule like to offer some help, I will be very greatful.

Thanks in advance.

Fei
Hi all,



I am totally a greenhand here and with little programming experience.



After reading the programming guide and some examples, I got to understand a little about cuda however I still don't know how to wirte a basic program like "hello world!" with cuda. Why some example have xx.cu and xx_kenel.cu and xx_gold.cpp while some dont, some of the codes are just testing cuda as far as I see. I got confused.



My current task is to realize the particle swarm optimization algorithm with cuda but I dont know how to get started. If someone woule like to offer some help, I will be very greatful.



Thanks in advance.



Fei

#1
Posted 09/30/2007 11:13 PM   
First, CUDA isn't capable of "hello world" since it doesn't have any output functionality itself. Of course you could write that in host code, but it's just not CUDA.
The xx xx_kernel xx_gold is just a programming style of nVidia. Maybe it originated from early stage of nvcc development or something. I personally prefer to write everything in one big file to avoid linking problems, but that's entirely a matter of style.
To get started, I'd suggest you implement some basic vector operations in CUDA, like adding up two big vectors.
First, CUDA isn't capable of "hello world" since it doesn't have any output functionality itself. Of course you could write that in host code, but it's just not CUDA.

The xx xx_kernel xx_gold is just a programming style of nVidia. Maybe it originated from early stage of nvcc development or something. I personally prefer to write everything in one big file to avoid linking problems, but that's entirely a matter of style.

To get started, I'd suggest you implement some basic vector operations in CUDA, like adding up two big vectors.

#2
Posted 10/01/2007 02:49 AM   
Thank you. I will try to do something out of it.
Thank you. I will try to do something out of it.

#3
Posted 10/01/2007 06:05 PM   
Here you can find a CUDA hello word: [url="http://courses.ece.uiuc.edu/ece498/al1/MPs.html"]http://courses.ece.uiuc.edu/ece498/al1/MPs.html[/url].
Take into account that it will only work in emulation.
Here you can find a CUDA hello word: http://courses.ece.uiuc.edu/ece498/al1/MPs.html.

Take into account that it will only work in emulation.

#4
Posted 10/01/2007 07:30 PM   
Thank you xcrow
Thank you xcrow

#5
Posted 10/01/2007 11:12 PM   
Scroll To Top