• Create Account

## CUDA hello world MSVC

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

9 replies to this topic

### #1Misery  Members

354
Like
0Likes
Like

Posted 13 July 2011 - 09:16 AM

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

### #2gsamour  Members

140
Like
0Likes
Like

Posted 13 July 2011 - 09:29 AM

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

### #3Misery  Members

354
Like
0Likes
Like

Posted 13 July 2011 - 09:34 AM

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

### #4gsamour  Members

140
Like
2Likes
Like

Posted 13 July 2011 - 09:43 AM

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.

### #5gsamour  Members

140
Like
2Likes
Like

Posted 13 July 2011 - 09:49 AM

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/

### #6mrbastard  Members

1576
Like
1Likes
Like

Posted 13 July 2011 - 10:12 AM

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.

### #7Misery  Members

354
Like
0Likes
Like

Posted 13 July 2011 - 10:14 AM

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.

### #8Antheus  Members

2409
Like
0Likes
Like

Posted 13 July 2011 - 10:27 AM

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

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

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

### #9Misery  Members

354
Like
-3Likes
Like

Posted 13 July 2011 - 11:00 AM

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

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

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

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.

### #10ApochPiQ  Moderators

21386
Like
0Likes
Like

Posted 13 July 2011 - 05:08 PM

Alright, that's enough. Keep it on topic.
Wielder of the Sacred Wands

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.