Using nvgraph in Visual Studio

Hello.

I’m trying to use (include) the nvgraph library in visual studio 2015. Prior to that, I have been successfully using the CUDA library along with the Thrust library (although it was setup using the default visual studio project creator for cuda).

Looking at the documentation provided here: http://docs.nvidia.com/cuda/nvgraph/index.html#introduction, it says the following:

To use nvGRAPH you should be sure the nvGRAPH library is in the environment (PATH on Windows, LD_LIBRARY_PATH on Linux), "#include nvgraph.h" to your source files referencing the nvGRAPH API, and link your code using -lnvgraph on the command line, or add libnvgraph to your library dependencies. We have tested nvGRAPH using GCC 4.8 and higher on Linux, Visual Studio 2012 and Visual Studio 2014 on Windows.

I have done:

#include <nvgraph.h>

.

Furthermore, I have tried to add nvgraph.lib inside Project properties -> Linker -> Input -> Additional dependencies (here I see cudart.lib as well). I have also tried to add the include folder of CUDA in Project properties -> VC++ Directories- > Include directories.
I did however not include nvgraph in my Windows PATH (to be honest, I’m not sure what to include there either, the nvgraph.lib file?). Furthermore, I tried adding -lnvgraph in Project properties -> Linker -> Command line.

When I run my project I see the error: “Cannot open file nvgraph.lib”.

I would appreciate it if someone could point me how to include this library in visual studio.

There are nvgraph sample projects. Study one of those.

The methodology shouldn’t be any different than what is described here:

http://stackoverflow.com/questions/13570285/how-to-link-library-e-g-cublas-cusparse-for-cuda-on-windows/13588857#13588857

be sure that you are building an x64 project, not x86 or win32.

Thank you very much txbob! The problem was indeed that I did not set the project as x64!

Regarding the sample projects, I assume you mean these? http://docs.nvidia.com/cuda/nvgraph/index.html#nvgraph-code-examples

I was looking around for more projects or hints, but couldn’t find any other than those unfortunately.

I was referring to this one:

http://docs.nvidia.com/cuda/cuda-samples/index.html#nvgraph-single-source-shortest-path

It is part of the CUDA samples, which should have been installed when you installed CUDA on your machine.

The nvgraph sssp sample should be in the “same general place” as the vectorAdd, and other CUDA samples on your machine.

It should include a visual studio project file that you can inspect for settings.

Thanks a lot txbob! That’s very nice of you. I found them!