Sign in to follow this  
Misery

CUDA hello world MSVC

Recommended Posts

Misery    354
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:

[code]

__global__ void kernel( void ){
}

int main (void) {

kernel<<<1,1>>>();
return 0;
}
[/code]


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

Share this post


Link to post
Share on other sites
Misery    354
[quote name='gsamour' timestamp='1310570984' post='4834863']
What do you mean "it doesn't work" ? Could you be a little more specific?
[/quote]
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:

Share this post


Link to post
Share on other sites
gsamour    140
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.

Share this post


Link to post
Share on other sites
gsamour    140
Check this out, there's a comment by "Mike" that might help you (last comment atm):

[url="http://llpanorama.wordpress.com/2008/05/21/my-first-cuda-program/"]http://llpanorama.wo...t-cuda-program/[/url]

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:

[url="http://llpanorama.wordpress.com/2010/06/18/cuda-gets-easier/"]http://llpanorama.wo...da-gets-easier/[/url]

[url="http://stackoverflow.com/questions/2970493/cuda-linking-error-visual-express-2008-nvcc-fatal-due-to-null-configuration"]http://stackoverflow.com/questions/2970493/cuda-linking-error-visual-express-2008-nvcc-fatal-due-to-null-configuration[/url]

Share this post


Link to post
Share on other sites
mrbastard    1577
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.

Share this post


Link to post
Share on other sites
Misery    354
[quote name='gsamour' timestamp='1310571793' post='4834870']
Also, I wouldn't say you've wasted your money... unless you're quitting after one simple error...
[/quote]

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

Share this post


Link to post
Share on other sites
Antheus    2409
[quote name='Misery' timestamp='1310573673' post='4834884']
I don't give up easily[/quote]You copied 5 lines of code, then gave up.

"Easily" would actually mean putting in effort.

[quote]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.

[quote]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.

Share this post


Link to post
Share on other sites
Misery    354
[quote name='Antheus' timestamp='1310574459' post='4834890']
[quote name='Misery' timestamp='1310573673' post='4834884']
I don't give up easily[/quote]You copied 5 lines of code, then gave up.

"Easily" would actually mean putting in effort.

[quote]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.

[quote]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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this