Syntax Highlighting for .cu Files:
Window -> Preferences -> in C/C++ -> File Types -> New -> enter "*.cu" and select "C++ Source File"
Working with NVidia's Makefiles:
Here we'll make a copy of NVidia's template project and set it up in Eclipse.
cd NVIDIA_CUDA_SDK/projects/
cp -r template/ foobar/
In Eclipse:
New -> C++ Project ->
- Project Name: "Foobar"
- uncheck "Use default location"
- Location: "/home/yourusername/NVIDIA_CUDA_SDK/projects/foobar"
- Project types: Executable -> Empty Project
in "C/C++ build" ->
- in "Builder Settings" tab -> uncheck "Generate Makefiles"
- Build Directory: "${workspace_loc:/foobar}"
- in "Behaviour" tab -> Build (incremental build):"" (delete "all")
- Add -> Name: "PATH" Value: "/usr/local/cuda/bin" -> OK
- Select PATH -> Edit -> Value: change ";/usr/local/cuda/bin" to ":/usr/local/cuda/bin"
Ctrl+b to build should work now.
In Makefile, replace "EXECUTABLE := template" with "EXECUTABLE := foobar" so it puts the executable in the right place.
To set up Eclipse to run it:
Run -> Run Configurations -> select "C/C++ Local Application" -> "New launch configuration (click the leftmost icon on the top) ->
- Name: "Foobar Release"
- Project: Foobar
- C/C++ Application: "/home/yourusername/NVIDIA_CUDA_SDK/bin/linux/release/foobar"
Try Ctrl+F11 to run.
At this point I got:
error while loading shared libraries: libcudart.so: cannot open shared object file: No such file or directory
Solution: (thanks to this guy)
sudo sh -c "echo /usr/local/cuda/lib >> /etc/ld.so.conf; ldconfig"
Ctrl+F11 works! Finally!!
I am trying to use FindCuda.cmake, but I haven't been able to get it working. Please post if you have figured out another way to use Eclipse with CUDA, or if this post helped, or if you see something unnecessary or which could be done more elegantly. Thanks!
Links:
FindCuda.cmake
NVidia Sample Makefiles working in Eclipse (on a Mac)
NVidia Forum thread asking for a CDT CUDA plugin

49 comments:
It works for me now. Thanks. I used to do some of the steps differently.
Eclipse: 3.2.2
1) ld.conf set and ldconfig executed dirung the CUDA intallation.
2) created Standart C++ project.
3) set project name and changed default location as described.
4) next, on Make builder tab removed "all" target.
5) after the project creation right click on project and open properties menu and in "Include paths and symbols" add external include path /usr/local/cuda/bin
6) Run -> Run...->
C/C++ Local Application as you described add path do the binary.
Now it should work.
Sweet! Thanks for posting your steps.
RUN CUDA programs in eclipse under OS X 10.5.5
For CUDA 2.0, eclipse and macbook pro
Do all the previous settings (For compilation, etc), then
Right click on the project, open
Properties -> Run/Debug Settings
Edit the settings, go to "Environment"
add the following variable
"DYLD_LIBRARY_PATH"
with value "/usr/local/cuda/lib"
the run should work now.
Thanks a lot your post saved me so much time
Thanks for the great tips! Just a note for newbie OS X programmers (such as myself) - with Andres' tip, don't confuse "Environment Variables" under "C/C++ Build" with "Environment" under Run/Debug settings.
All the best!
Thanks. The post is great! Do you know how to run a CUDA project from Eclipse in emulation mode? where should we indicate the -deviceemu flag?
You're welcome! Sorry, I never did get CUDA emulation mode in Eclipse working. Please let me know if you do.
Sure! I got it
In the makefile you need to set
# Rules and targets#
emu=1
include ../../common/common.mk
This will build the project to an "emurelease" folder. Then you have to make sure that in "Run configurations" you take the program from this folder!
Sweet! Thanks for posting the solution!
Thanks a lot for your work!
Hi, I haven't found the folder /home/yourusername/NVIDIA_CUDA_SDK/bin/linux/release/foobar. Do I have to create one on /bin?
Thanks!
Thank you for the codes..
Its rocks!!!
@Patrica::
home/yourusername/NVIDIA_CUDA_SDK/bin/linux/release/foobar is the place for build file.
Please see the makefile which and edit the file name. Rename as foobar if there is template..which u may have copied from NVIDIA_CUDA_SDK projects
So you dont have to create any files inside release.. it comes after successful make..
Thanks for this little how to. I just started with CUDA and want to use eclipse for developing. I have done all your changes and copied the template to a folder called foobar. but when I try to strg+b i get an error, that there are no targets and no makefile... but the makefile is in my project inside the folger template...
any idea?
hmmm.. I'm not sure. I'm not set up with CUDA at the moment so I'm not in a position to investigate. ..But if/when you do figure out a solution, I'd be grateful if you posted it here. Thanks!
I use the FindCuda.cmake (svn branch 1171) without any problems in eclipse. Configure it with cmake to build an eclipse project file worked out of the box for me.
However, there is a drawback:
NVCC errors are not parsed correct, only cmake errors are reported.
Now my question:
Do you get the NVCC errors parsed the way you created your eclipse project?
hello guys, i got this
**** Build of configuration Release for project cuda_test ****
make
/bin/sh: /bin/sh: grep: not found
uname: not found
/bin/sh: uname: not found
/bin/sh: grep: not found
/bin/sh: tr: not found
/bin/sh: tr: not found
make: mkdir: Command not found
make: *** [makedirectories] Error 127
I following exactly the instruction. And I am using Eclipse 3.5 and CUDA 2.3.
TIA!
Dear likejie,
I made it working but this ain't the best way to do it (I'm sure;p).
Go to Project properties->
in C/C++ build -> Environment ->
Select PATH -> Edit -> Value: change ":/usr/local/cuda/bin" to ":/usr/bin"
and Apply everything
(if you now try to build you will get only "make: mkdir: Command not found")
Now take out the console and
cd /usr/bin
sudo ln -s /bin/mkdir
(we created a symlink to mkdir in your "PATH" folder)
now go back to eclipse and ctrl-b :)
It should only type "make"
I hope it did work. I dont thing it's the best way to do it, because I dont like changing things in system folder (security problems)
If you want the F11 (quick-run) button
not to trigger the debugger on program startup, there is an option in run configurations =>debugger-> uncheck stop on startup.
Curran : thnx for your tutorials :)
Hi
does any of you make it work on windows? im trying to set up an eclipse on windows for cuda, without success so far, I can't remove the tick from the "generate makefiles automatically" its all gray...
Using 64bitOS you may use 'lib64' instead of 'lib':
sudo sh -c "echo /usr/local/cuda/lib64 >> /etc/ld.so.conf; ldconfig"
MIC
Has anyone got debugging working in eclipse?
Great blog as for me. I'd like to read a bit more concerning this theme. Thanks for posting that data.
Sexy Lady
UK escorts
Perfect !!!
Thanks !!!
Hello,
we developed a plugin for eclipse which comfortably allows CUDA (and QT) development with some additional features... Check:
http://www.ai3.uni-bayreuth.de/software/eclipsecudaqt/index.php
Looking 4 any suggesion
**** Build of configuration Release for project cudates ****
make
make: *** empty string invalid as file name. Stop.
whatever...
i make mistakes following the steps
It s work! Thanks you for this nice explaination. But compiling my project take rely a lot of time :o
Hi, thats exactly what I was searching in this time...
I'm really interested in this post...I would like to know more about "Using Eclipse for CUDA Development".
Thanks!!!
Hello .. firstly I would like to send greetings to all readers. After this, I recognize the content so interesting about this article. For me personally I liked all the information. I would like to know of cases like this more often. In my personal experience I might mention a book called Generic Viagra in this book that I mentioned have very interesting topics, and also you have much to do with the main theme of this article.
Hi.
I successfully configured Eclipse with CUDA following your instructions.
On the other hand, I was also trying to configure Eclipse with OpenCV for the same project which is configured with CUDA.
The instructions are over here:
http://www.jestinstoffel.com/?q=node/112
But this image:
http://www.jestinstoffel.com/files/images/Screenshot-Properties%20for%20OpenCVDemo%20.preview.png
doesn't appear because with CUDA we have unchecked "Automatically generate makefile".
Can you please throw some light on CUDA+OpenCV on eclipse ?
In case of using cuda library, you can add cuda library directory in eclipse...
it's easier than your solution...
Really easy and it's standard solution when you using eclipse.
When you make...
C/C++ General->Paths and Symbols.
you can 'Add'
usr/local/cuda/lib
That's all you should do for library load for your project.
Although your suggestion was helpful to me thanks.
I'm trying to follow the instructions given in your post, but I get this error from Eclipse:
[code]make:***No targets specified and no makefile found. Stop[/code]
My SDK is installed in ~/NVIDIA_GPU_Computing_SDK. I don't see any directory named projects in it, so I assumed you meant the directory folder named 'C'.
Here's my tree structure: http://forums.nvidia.com/index.php?showtopic=186125&view=findpost&p=1185876
Nice post....thanks for sharing!!
I develop CUDA plug in for eclipse if you are interesting..!
ant.polastri@gmail.com
Great website, looks very clean and organized. Keep up the good work!
Great website, looks very clean and organized. And very interesting to read Your the article!
Goodness, there's really much effective info here!
do you still doubt about my words? you can try right now enterprise application integration
Last spring I enormously looked for resume writing assistance. Subsequent to extraordinarily lengthy exploration I saw College research papers for sale who did just the things I required. therefore guys you truly ought to examine where to buy essays
you have a very informative site.
and i must say you have use very truly words on your website.
Reviews of pharmacy
hi..
its james scott,
how may i get more information from your website.
GENERIC PROPECIA
this is the best blog i have ever seen.
find a lawyer
You have a very nice and informative site.
saudi airlines tickets
You do seem to have a lot going on, but I know you really like all of them. How would you ever choose what to provide up? And I would skip following your success.
Compra Oro Plata
Completely a wonderful article. You did a marvelous job. Thank you for taking this demand connected with previously mentioned reviewed theme. We are happy that we found ones article as well as the information which you talk about from the article within is fantastic. These records they can be handy for anybody. Keep the good work going.
james bond midnight blue tuxedo
Thanks for this post.We current service offerings include Software Development,Web & Graphic Development ,Online Marketing , Hosting & IT Management ,Telecom & Network Services,provider of Business Process Outsourcing,Wordpress,php web application,Joomla,Software Design & Development Bangladesh,Web Development. We have serviced and continuing to service countless businesses in Middle East and across the globe.
Your blog is very informative and gracefully
your guideline is very good.Thank you
Engineering college
Best engineering college in india
Private engineering college
pharmacy college
pharmacy college in india
top pharmacy college
Polytechnic college
Top polytechnic college
Top private polytechnic college
Top polytechnic colleges in India
Techanical colleges
Polytechnic college in india
Leading call center
Outbound call center india
Cheap Seo services india
Post a Comment