Frage

I am using Nvidia's example code for simpleCUBLAS. The example comes with a Makefile, or I can compile it like this:

g++ -m32 -I/usr/local/cuda/include -I. -o simpleCUBLAS.o -c simpleCUBLAS.cc g++ -m32 -o simpleCUBLAS simpleCUBLAS.o -L/usr/local/cuda/lib -l cudart -l cublas

(the files included by the "-I." are cuda_runtime.h helper_cuda.h helper_string.h)

This compiles and runs just fine. However, I would like to make this using Eclipse's Nsight editor for CUDA.

My Question is: How to I add these options to Eclipse (the -L/usr/local/cuda/lib -l cudart -l cublas, & the -I.) Nsight?

Other details: Am using Linux. I've seen some info elsewhere for Eclipse & c/c++ Project, BUT here I am using cuda c/c++ Project.

Thanks.

War es hilfreich?

Lösung

I don't think any of this is specific to Nsight Eclipse Edition. What you are trying to do are standard operations for any C/C++ project built using Eclipse. Nsight EE doesn't change these steps in any major way. You can get help easily enough on these topics using the built-in Eclipse help in Nsight EE. For example:

  • open help (select help...help contents)
  • in the search box type "add library"
  • click on the first item returned in the help search pane

All of your questions (adding library paths, adding libraries, adding include paths) have to do with the Project Properties. We can access these properties directly by:

  • Open the project in Nsight EE
  • In the project pane on the left, right-click on the project whose properties you wish to inspect/modify, then select "Properties" from the pop-up menu (the last item in the menu)
  • The project properties pane is now open.
  • Click on the triangle next to "General" in the properties dialog. This will open the "General" sub-menu.
  • Under General, click on "Paths and Symbols" The generic Eclipse help would have taken you this far.
  • Now click on "CUDA C" (Yes this is the one step that is different.)
  • The tabs across the top now include selections for things like "Includes", Libraries", "Library Paths" etc. By selecting any one of these tabs, you can add or modify the appropriate entries.
  • So as one example, let's add the cublas library. Select the "Libraries" tab.
  • Now click the "Add" button
  • Enter the name of the library. It is cublas, not lcublas, and not -lcublas
  • now click "OK", "Apply" and exit out of the properties, build your project, and confirm that -lcublas has been added to the build command
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top