how to use cublas library

11,646

Solution 1

  1. The cublas documentation is contained here. So you should familiarize yourself with it.
  2. Try and run a sample program. There are samples in the CUDA samples that come with the CUDA 5 toolkit, or you can try the one here. Make sure you understand how to build and run that example.
  3. If you're still having trouble with your own program, post a new question here with the specifics. For example, if your program is giving error output, paste in the complete error output that you are getting, and paste in the code from your program that is generating that error output (at least). Preferably paste in your whole program, or a simple version that will reproduce the error.

The error you're getting right now looks like it should be coming from the compiler not from when you run the program. If so you simply need to tell the compiler where to find that header file. If you look at a cuda sample like this one, you can see from the included makefile how to tell the compiler where to look for header files.

Solution 2

There can be multiple things because of which you must be struggling to run a code which makes use of the CuBlas library.

  1. The most important thing is to compile your source code with -lcublas flag. It should look like nvcc -c example.cu -o example -lcublas
  2. Secondly, confirm whether you have Cublas Library in your system. As it says "cublas_v2.h file not present", try doing "whereis cublas_v2.h" or search manually for the file, if it is not there you need to install
    Cublas library from Nvidia's website.
  3. Confirm your Cuda Installation path and LD_LIBRARY_PATH Your cuda path should be /usr/local/cuda. and LD_LIBRARY_PATH should be /usr/local/cuda/lib64 OR /usr/local/cuda/lib.
Share:
11,646
user2167322
Author by

user2167322

Updated on June 14, 2022

Comments

  • user2167322
    user2167322 almost 2 years

    I'm novice to cuda. I want to use cublas functionality in cuda programs and would like to know the procedure on how to use it. As my program is giving error i.e. *"cublas_v2.h file not present"* when I try to run it on GPU.