I am newbie to CUDA and I was just trying to start using ‘cublas’. I had some trouble in getting my mind around the ‘Column major storage’ and ‘1 based indexing’ in cublas. But once i did, it seems to me that the macro’s given in the cublas library for changing the indexing wouldnt work. But since this is official NVIDIA, it is possible, that I have misunderstood what is actually required.
Consider the following array. Array = [ (0,0) (0,1) (0,2) (0,3) (1,0) (1,1) (1,2) (1,3) ]
This is an array as it would be used in C. So, in cublas, the corresponding index numbers would be…
Array = [ 1 3 5 7 2 4 6 8 ] right??
The macro given in cublas documentation is #define IDX2C(i, j, ld) = (((j) *(ld)) + i) ld - leading dimension: In this case the number of rows.
By this macro, the index of element (0,2) would be 2*2 + 0 = 4. But the index should actually be 5 right… Shouldnt the macro be #define IDX2C(i,j,ld) ((j * ld) + (i+1))??
Or have I understood it wrongly??