AnsweredAssumed Answered

Issues with clblasCgemm - complex matrix multiplication

Question asked by oznayang on Jun 20, 2014
Latest reply on Jun 20, 2014 by oznayang

Hello everybody,


I am trying to run a simple example of complex matrix multiplications employing the clblasCgemm() function. However, I keep receiving wrong outputs. Maybe I am having a problem with the function's parameters, but according to me, this shouldn't be the case.


First of all, I am using the 'latest' version of the clBLAS library (I downloaded it and built it on 18/06/2104, using VS 2013). The OS I'm using is a 64-bit Win8, but the clBLAS library, as well as the rest of the project, is built for an x86 configuration. The OpenCL version is 1.2, and the device I'm using is Tahiti, from the Southern Islands series.


The simple test program I'm running is a modified version of example_sgemm.c located in clBLAS: Examples. Attached to this post, you can find the actual code I am using where I multiply 2 complex matrices. When the imaginary components of the elements of the input matrices are zero, the imaginary components of the resulting matrix equal the real components. This shouldn't be the case, since the imaginary components should as well be zero. On the other hand, if I assign the input imaginary components a value different from zero, both resulting real and imaginary components are wrong. I have set both alpha and beta coefficients to one, all offsets to zero and zeroed the C matrix, as well as using a row-major ordering and no transposing.


As previously mentioned, a couple of output examples would be: (expressing the matrices in Matlab notation)


A = [1+0*i,  2+0*i; 3+0*i,  4+0*i];  B = [5+0*i,  6+0*i;  7+0*i,  8+0*i];  result = [19+19*i,  22+22*i;  43+43*i,  50+50*i], where I would expect  result = [19+0*i,  22+0*i;  43+0*i,  50+0*i]



A = [1+1*i,  2+1*i; 3+1*i,  4+1*i];  B = [5+2*i,  6+2*i;  7+2*i,  8+2*i];  result = [-3+33*i,  -2+38*i;  13+65*i,  18+74*i], where I would expect  result = [15+18*i,  18+20*i;  39+26*i,  46+28*i]


Again, according to me, the clblasCgemm() function arguments are correct. Still, it is the first time I employ the library, so there might be something wrong.


Any help on this issue will be greatly appreciated. Thanks.