CUDA hello world MSVC

Started by
8 comments, last by ApochPiQ 12 years, 9 months ago
Hello,

I have bought book Cuda by example.
I have done everything required to run a simple CUDA program (downloaded drivers, SDK, tools etc).
And as written...

I write a code:



__global__ void kernel( void ){
}

int main (void) {

kernel<<<1,1>>>();
return 0;
}



And it of course doesn't work. It is written that I don't need to do anything special, just use Microsof Visual C++ express and compile this code.
The nVidia tools will do the rest.
Am I retarded or something, that I cannot make this work?


Thanks for help,
Regards
Advertisement
What do you mean "it doesn't work" ? Could you be a little more specific?

What do you mean "it doesn't work" ? Could you be a little more specific?

I get this message in visual studio.
1>------ Build started: Project: HelloWorld, Configuration: Debug Win32 ------
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>HelloWorld.cpp
1>c:\misery\moje projekty\cuda\helloworld\helloworld.cpp(6) : error C2144: syntax error : 'void' should be preceded by ';'
1>c:\misery\moje projekty\cuda\helloworld\helloworld.cpp(6) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Build log was saved at "file://c:\Misery\Moje projekty\CUDA\HelloWorld\Debug\BuildLog.htm"
1>HelloWorld - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

trying to compile it with nvcc doesn't work either I get error:
C:\Misery\Moje projekty\CUDA\HelloWorld>nvcc helloworld.cpp
nvcc fatal : Visual Studio configuration file '(null)' could not be found for installation at 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin/../..'

Again I wasted money... on GPU and on this book :blink:
Are you sure you're setting up the project correctly? AFAIK, you need to compile CUDA code with the CUDA compiler, "nvcc".

Also, I wouldn't say you've wasted your money... unless you're quitting after one simple error...


EDIT: sorry I didn't read the part about you compiling with nvcc... never mind. Will keep looking for solutions.
Check this out, there's a comment by "Mike" that might help you (last comment atm):

http://llpanorama.wo...t-cuda-program/

It explains one solution to the "nvcc fatal: Visual Studio configuration file (null)" error. It has something to do with needing to make a 32-bit build on a 64-bit machine.


These might help too:

http://llpanorama.wo...da-gets-easier/

http://stackoverflow.com/questions/2970493/cuda-linking-error-visual-express-2008-nvcc-fatal-due-to-null-configuration
Try installing Parallel NSight, for a possible quick fix.

IIRC the msbuild targets for 64 bit on msvc 2010 are broken/missing in the cuda sdk, but a working version comes with NSight.
[size="1"]

Also, I wouldn't say you've wasted your money... unless you're quitting after one simple error...


Thanks, for now I'm upset with that all and I will read this all stuff later.

Well I'm a scientist in fluid mechanics, and I must say that I have disposed of many books I've bought for quite lots of money.
I just threw them to garbage.
Most of books promise quite a lot of solutions but in fact they're no more than very general subject review.
Many authors just lie to ppl who buy their books, and that is the sad truth.
I don't give up easily, but I know that Cuda by example authors didn't do their job as they should.
Explanaiton about how to compile a program would be crucial for a beginner in CUDA.

And sometimes it is better to leave something at the beginning than waste a few months for learning how
to make something absolutely useless.

Thanks for answering :D

I don't give up easily
You copied 5 lines of code, then gave up.

"Easily" would actually mean putting in effort.

And sometimes it is better to leave something at the beginning than waste a few months for learning how [/quote]You typed 5 lines of code.

And months? I've been learning for a decade now and slowly a few small pieces are starting to make sense.


This is why consultants charge so much. Because their fee is a fraction of the cost needed to actually learn something.

Well I'm a scientist in fluid mechanics[/quote]

Let me guess. This programming stuff is beneath you and so trivial it's not worth spending your mental effort on.

[quote name='Misery' timestamp='1310573673' post='4834884']
I don't give up easily
You copied 5 lines of code, then gave up.

"Easily" would actually mean putting in effort.

And sometimes it is better to leave something at the beginning than waste a few months for learning how

[/quote]You typed 5 lines of code.

And months? I've been learning for a decade now and slowly a few small pieces are starting to make sense.


This is why consultants charge so much. Because their fee is a fraction of the cost needed to actually learn something.

Well I'm a scientist in fluid mechanics[/quote]

Let me guess. This programming stuff is beneath you and so trivial it's not worth spending your mental effort on.
[/quote]

LMAO
You seem very frustrated.
Some things are just not worth effort, that's all.
Don't take it personally. You know nothing about my work, and what I do. You are probably paid for programming
and I am not. I'm not educated programmer and often I need help, that's why i post at this forum. I wonder how
smart would you be if you had to learn tensor analyses and fluid mechanics yourself...
so don't fuss too much.

And if after 10 years of doing exactly one thing, you still are not (as you say) good in it...
well... I think you have made a wrong choice choosing this kind of work.
Alright, that's enough. Keep it on topic.

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

This topic is closed to new replies.

Advertisement