IDL accesses indexes matrices with this fashion

index = column + (row)*(number_of_columns)

However, CUBLAS uses

index = row + (column)*(number_of_rows)

So how do I get CUBLAS to index the matrices properly?

:magic:

IDL accesses indexes matrices with this fashion

index = column + (row)*(number_of_columns)

However, CUBLAS uses

index = row + (column)*(number_of_rows)

So how do I get CUBLAS to index the matrices properly?

:magic:

yes, CUBLAS uses Fortran Memory Layout…

maybe you have to transpose all your matrices…

but if you just need to use GEMM routines,

ex… to obtain C = A * B, where A,B and C are in IDL-Memory Layout…

you can just use SGEMM (‘n’,‘n’) to multiply B * A

(you’ll obtain C in IDL-Memory Layout, without transpose).

Wooohooo… :wacko: it did it. I’ll be posting the code for this soon.

All this row-major or column-major is really confusing. Even IDL’s documentation got it wrong. Didn’t work for me.

Stumbled upon another issue, video memory. :o

I can easily over-allocate memory.

Can anyone refer me to materials that advices on how to compute C = A*B with dynamic sizes and still cope with limited video memory?

Cheers

Matrix multiplication can easiliy be split into multiplication of submatrices. So just calculate the required memory and in case you get too large split your multiplication into multiple calls.

Is there any examples online on this subject?