Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

How effective is MKL?

rockballad
Beginner
330 Views
Hi all,

I just have a quick testing with a function in VML library. You can see here:


float *fA =new float[VEC_LEN];
float *fB1=new float[VEC_LEN];
float *fB2=new float[VEC_LEN];


Randomize();

for(int i=0;i fA=(float)(Random(-998));
}

struct time t1;
gettime(&t1);
for(int i=0;i fB1=(float)sin(fA);
}

struct time t2;
gettime(&t2);

vsSin(VEC_LEN,fA,fB2);

struct time t3;
gettime(&t3);


In average, (t3-t2) = (t2-t1) x 3 (it means VML is slower). I use an array upto 2,000,000 elements.

It's just a very simple test, but I don't see MKL is more effective (faster) than the standard library. Or didn't I use it effectively? Is it possible to optimize VML/MKL to improve the speed of running?

I'd like to hear from you.

Regards,
0 Kudos
2 Replies
TimP
Honored Contributor III
330 Views
What is this Random() ? One would expect an optimized sin() to be intended for arguments mostly between -Pi and Pi.
It would not be surprising to see the sinf() in the Intel svml library perform better than MKL SVML on a variety of real problems. I would have to guess you may be using a native x87 sin() on a machine which runs it better than average, as computing a double sin() and casting it to float would be slow in many cases. The native x87 sin() might be relatively efficient at range reduction on your machine.
0 Kudos
rockballad
Beginner
329 Views
Oh, it's the problem in using, not the library itself. The function Random(x) is to get a integer between 0 and x. When I set x a negative number, it returns a very big (random) number, sometimes negative. And as you said, I'm using an AMD Turion64, and maybe that made the bad result above.

Thanks for your comment.

Have a nice day!
0 Kudos
Reply