Frage

So I have a code that performs matrix multiplicaiton, but the problem is it returns just zeroes when I use the library -lcublas and the compiler nvcc; however, the code runs great with just a few tweaks to function names when I use the compiler, g++ with the library -lblas.

Can you use the -lcublas library to perform matrix multiplication from memory that is not on the GPU?

Here's the code that returns 0's:

extern "C" //external reference to function so the code compiles
{
    double cublasDdot(int *n, double *A, int *incA, double *B, int *incB);
}

//stuff happens

    cout << "Calculating/printing the contents of Matrix C for ddot...\n";
            C[i][t]=cublasDdot(&n, partA, &incA, partB, &incB); //This thing isn't working for some reason (although it compiles just fine)

I compile it by using this command: nvcc program -lcublas

This does work however:

extern "C" //external reference to function so the code compiles
{
    double ddot_(int *n, double *A, int *incA, double *B, int *incB);
}

//stuff happens

C[i][t]=ddot_(&n, partA, &incA, partB, &incB);

compiled with g++ program -lblas

War es hilfreich?

Lösung

cublas requires a properly functioning CUDA GPU.

Probably you are doing no error checking. Read up on how to do error checking in the cublas manual. And look at some error checking sample code.

The ordinary usage of cublas requires data to be transferred to the GPU and results to be transferred back.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top