-1

したがって、行列の乗算を実行するコードがありますが、問題は、ライブラリ -lcublas とコンパイラ nvcc を使用するとゼロしか返されないことです。ただし、ライブラリ -lblas でコンパイラ g++ を使用すると、関数名を少し調整するだけで、コードはうまく動作します。

-lcublas ライブラリを使用して、GPU にないメモリから行列乗算を実行できますか?

0 を返すコードは次のとおりです。

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)

次のコマンドを使用してコンパイルします。nvcc program -lcublas

ただし、これは機能します。

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);

でコンパイルg++ program -lblas

4

1 に答える 1