NVIDIA / CUDALibrarySamples

CUDA Library Samples
Other
1.52k stars 318 forks source link

is `print_matrix()` wrong? #139

Open alex-lt-kong opened 1 year ago

alex-lt-kong commented 1 year ago

I examined the below lines from cublas_utils.h:

https://github.com/NVIDIA/CUDALibrarySamples/blob/f299986ecc990c49dce295e345f9e3ad95ded188/cuBLAS/utils/cublas_utils.h#L148-L155

Given that how a matrix is generated with the same util file:

https://github.com/NVIDIA/CUDALibrarySamples/blob/f299986ecc990c49dce295e345f9e3ad95ded188/cuBLAS/utils/cublas_utils.h#L233-L238

and I am wondering shouldn't line 151 be:

std::printf("%0.2f ", A[i * lda + j]); 

instead of:

std::printf("%0.2f ", A[j * lda + i]); 

?

(As my understanding of cuBLAS is limited, I didn't directly raise a PR, if the issue is confirmed, I am willing to do so)