Compute-sanitizer error with cuBLAS

Hello,

I wanted to try to use the various tools in compute-sanitizer on my application which, mainly, uses cuBLAS.
I tried to run compute-sanitizer --tool memcheck ./myApp and compute-sanitizer --tool initcheck ./myApp and both commands output the following when I’m not calling cublasSgemm directly:

========= COMPUTE-SANITIZER
//some expected output from my application until one point
========= Error: process didn’t terminate successfully
========= Target application returned an error
========= ERROR SUMMARY: 0 errors

My main.cpp is basically:

int main()
{
        //prepare matrices A,B,C on GPU
        GPU::gemm('N', 'N', M, N, K, alpha, A.getDataGPU(), M, B.getDataGPU(), K, beta, C.getDataGPU(), M);
        //clean up
}

and the function GPU::gemm is defined in a gpu_cuda.cpp file:

void GPU::gemm(signed char transa, signed char transb, int m, int n, int k, float alpha, const float *A, int lda, const float *B, int ldb, float beta, float *C, int ldc)
{
        cublasStatus_t status = cublasSgemm(handle_cublas[0], getCublasOperation(transa), getCublasOperation(transb), m, n, k, &alpha, A, lda, B, ldb, &beta, C, ldc);
        if (status != CUBLAS_STATUS_SUCCESS)
                std::cerr << "cuBlasSgemm error: " << cublasGetStatusName(status) << "\n";
}

My program runs fine when I don’t use compute-sanitizer.
My program runs fine with compute-sanitizer if I replace the GPU::gemm call with:
cublasSgemm(GPU::handle_cublas[0], CUBLAS_OP_N, CUBLAS_OP_N, M, N, K, &alpha, A.getDataGPU(), M, B.getDataGPU(), K, &beta, C.getDataGPU(), M);

Both gpu_cuda.cpp and main.cpp are compiled with g++ so I don’t understand the problem.

I’m using CUDA toolkit 12.6 on Ubuntu 24.04:

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.35.03              Driver Version: 560.35.03      CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4070 ...    Off |   00000000:01:00.0 Off |                  N/A |
| N/A   38C    P3             11W /   35W |       8MiB /   8188MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
which compute-sanitizer 
/usr/local/cuda-12.6/bin/compute-sanitizer
ldd myApp
...
libcudart.so.12 => /usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.12 (0x00007643c8400000)
libcusolver.so.11 => /usr/local/cuda/targets/x86_64-linux/lib/libcusolver.so.11 (0x00007643c0a00000)
libcublas.so.12 => /usr/local/cuda/targets/x86_64-linux/lib/libcublas.so.12 (0x00007643ba200000)
libcusparse.so.12 => /usr/local/cuda/targets/x86_64-linux/lib/libcusparse.so.12 (0x00007643a8600000)
...

Thanks for the help!

Hi, @vlefevre

Sorry for the issue you met. Can you provide us the src file directly for repro ? Thanks !

Sorry for the noise. I finally found the problem in my many files and it turns out it was not related to compute-sanitizer. It is a problem that has been here for a while now: unitialized (cpu) array that did not produce any bug until I ran with compute-sanitizer, so it kind of did its job ;)
Can an admin delete my useless topic?

vlefevre

Thanks for the update ! I will close the topic directly.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.