Getting started with CUDA

Started by
7 comments, last by stu2000 13 years, 4 months ago
Hello there,
I have been meaning to get started with CUDA for ages now and decided to buy this book:"CUDA by Example: An introduction to General Purpose GPU Programming". I had thought this would help me get started but to say that it is lacking information on how to get started is an understatement. Either that or I missed something.

It states that we need a C compiler and to download Microsoft Visual Studio. I take it I need to use (and already have) Visual studio C++ 2008? I cant seee one just for C, but can see one for C#. It also states that I need to download and install the CUDA development toolkit which I did and installed.

It came as no surprise that when i tried to build their example Hello World code,

Click here to view full size

it failed and didnt know what the hell to do.
Click here to view full size

I get the feeling there a couple more steps I need to perform on my IDE that the book does not mention at all. Either that or I should be using a different IDE, the book never really specifies. I take it that the code should be in a cpp file as well?

Any and all help appreciated.
For background info im running 64bit win7 with a nvidia 260gtx card.

Stu
Advertisement
This is not C++ code, it's CUDA code. There is a different compiler for it (nvcc).

See custom build step or similar.
I realise that its CUDA code but need a few more details. Ive added the custom build step but that still doesnt seem to be enough. I have found that i have that nvcc.exe on my computer which is a good sign. Is the file supposed to be .cu when developing as thats what the examples from the site are in. cu and .cuh. Unfortunately if i rename to .cu the option to compile gets faded out. Compiling as .cpp still results in errors with the custom build step. Also, all of their projects fail to open in my MSVC++ and have to load the src code directly, so i cant prove that compiler works like they suggest here: http://julianapena.com/2009/09/how-to-install-and-configure-cuda-on-windows/


#include <iostream>

__global__void kernel(void)
{
}

int main(void)
{
kernel<<<1,1>>>();
printf("Hello, World \n");
return 0;
}


Stu
What do you plan to use CUDA for? I'd urge you to consider OpenAL as it is an open standard, supported by more than just one company. It's also extremely similar to CUDA. If you plan to use it in games, you'd be alienating everyone with ATI/AMD.
Quote:Original post by Chris_F
What do you plan to use CUDA for? I'd urge you to consider OpenAL as it is an open standard, supported by more than just one company. It's also extremely similar to CUDA. If you plan to use it in games, you'd be alienating everyone with ATI/AMD.


s/OpenAL/OpenCL/
Or you could use OpenCL...
Using CUDA for very specialist server program, so not alienating AMD/ATI people. Definitely needs to be CUDA.
So once all custom build steps put in etc. i should be able to hit big green debug button and it work? I take it i call it a .cu file right?
Stu
The file should be a .cu file, yes.


nVidia's site should have a full walkthrough someplace on how to set up all the details.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Think im going to retry on 32 bit windows with a fresh set up. That will hopefully reduce the number of complicated factors.

This topic is closed to new replies.

Advertisement