Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Help! BLAS problem

galbimen
Beginner
668 Views
Hi, im Jack.

Im trying to convert to the MKL in my some source.
The problem is the difference between the output datas.

The original code is :

for(ix=0; ix for(iz=0; iz t[ix][iz] = a1*t1[ix][iz] + a2*t2[ix][iz];

Like this. and converting to MKL(BLAS) is :

for(ix=0; ix{
cblas_sscal(nz, a1, t1[ix], 1);
cblas_scopy(nz, t1[ix], 1, t[ix], 1);
cblas_saxpy(nz, a2, t2[ix], 1, t[ix], 1);
}
t, t1, t2 Array are varible of float type.The Output data is a little bit wrong.
But I need accuracy data becauseit isrelated withmy work.
I don't know where is wrong. Did I miss something to do ?
Please help me.
0 Kudos
3 Replies
TimP
Honored Contributor III
668 Views
If you require the effect of (double)a1*t1[ix][iz] + (double)a2*t[ix][iz] (K&R style evaluation, still default 2 decades later, for many C compilers), you are better off with the C code. If you want good performance, you should get the same numerical result, with much better performance than cblas, by compiling your C code with a vectorizing compiler, without the implicit promotion to double.
I find your style misleading, particularly without the data definitions.
0 Kudos
galbimen
Beginner
668 Views
Quoting - tim18
If you require the effect of (double)a1*t1[ix][iz] + (double)a2*t[ix][iz] (K&R style evaluation, still default 2 decades later, for many C compilers), you are better off with the C code. If you want good performance, you should get the same numerical result, with much better performance than cblas, by compiling your C code with a vectorizing compiler, without the implicit promotion to double.
I find your style misleading, particularly without the data definitions.

Thank you abt the advise.
Your saying is all correct. I want better performance than before.
But vectorizing or parallelizing things are already being tried by another team member.
My target is only converting to MKL. that's why i've been trying to do with MKL.

Now i wonder if cblas_saxpy function is workedby 2 dimentional array or not.
like :

t[ix][iz] += (float)a1*t1[ix][iz];
=> cblas_saxpy(nz, a1, t1[ix] ,1 , t[ix] , 1);

if i convert like this, i can't get same numerical results. is it impassible?
0 Kudos
Gennady_F_Intel
Moderator
668 Views
Quoting - galbimen
Hi, im Jack.

Im trying to convert to the MKL in my some source.
The problem is the difference between the output datas.

The original code is :

for(ix=0; ix for(iz=0; iz t[ix][iz] = a1*t1[ix][iz] + a2*t2[ix][iz];

Like this. and converting to MKL(BLAS) is :

for(ix=0; ix{
cblas_sscal(nz, a1, t1[ix], 1);
cblas_scopy(nz, t1[ix], 1, t[ix], 1);
cblas_saxpy(nz, a2, t2[ix], 1, t[ix], 1);
}
t, t1, t2 Array are varible of float type.The Output data is a little bit wrong.
But I need accuracy data becauseit isrelated withmy work.
I don't know where is wrong. Did I miss something to do ?
Please help me.

Galbimen,
The Output data is a little bit wrong.
What is the size of this difference?
What is the input data?
Can you get us the test case for the investigating the problem?
--Gennady

0 Kudos
Reply