while evaluating cusparse and some other sparse matrix libraries we encountered different
results for the following operation:
A * x
The following simple example matrix A (2,2) multiplied with the given vector X demonstrates this problem:
Matrix A: A = 0.939129173755645752; A = 0.799645721912384033; A = 0.814138710498809814; A = 0.594497263431549072; (We are using a matrix with no zero values here. The failure also appears while using other matrices with zero values) Vector X: x = 0.657200932502746582; x = 0.995299935340881348;
the result of the two operations:
cublasSgemv (...); cusparseScsrmv(...);
cuSPARSEcuBLAScompare test running.. --CUBLAS-- result of A*x: [1.427508711814880371, 1.117230892181396484] -CUSPARSE- result of A*x: [1.427508831024169922, 1.117231011390686035]
While testing the cusp library we encountered similar (mabe the same?) wrong results.
We then programmed the sparse matrix multiplication on the CPU and verified that CUBLAS works as expected.
To verify this we wrote an own sparse matrix multiplication kernel which also confirmed that CUBLAS works as expected.
The failure gets worse when using matrices with higher dimensions.
The observed behavior was tested on a GTX 480 (windows + linux) and 8800GTS (linux)
For everyone to test the behavior i attached a zip file with the code + makefile.
To be able to make the program without any issues its important to have the “CUDA Toolkit 3.2 RC” installed
as well as the “GPU Computing SDK code samples”. If you can make these examples without a problem you copy the
source to “GPU Computing SDK code samples”/C/src/ and then just go to the src/cuSPARSEcuBLAScompare/ directory and initiate make.
(This step is necessary because our makefile uses the nvidia samples common-makefile).
The resulting executable is in the same folder as the other sample executables.