Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
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.

IPP Java performance

andrewk88
Beginner
1,011 Views
Hi,
I modified original java sample to get some performance numbers by setting 1000x to value of 0 1D signal of length 1024 of float type (source codefollows below).
Surprisingly, a classic approach (REG. time) roughly 4x outperforms in CPU cycles an IPP based approach (IPP time). Very likely, I'm doing something wrong. Please comment!
Regards,
AndrewK
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.util.*;
import jipp.*;
class zero
{
static int j, k;
static long m_start, m_stop;
static float[] insig = new float[1024];
public static void main( String arg[] ) {
System.out.println( "cpu type = "+jipp.core.ippGetCpuType() );
System.out.println( "lib = "+jipp.core.ippGetLibVersion().Name );
m_start = jipp.core.ippGetCpuClocks();
for(k=1; k<=1000; k++)
jipp.sp.ippsSet_32f(0, insig, 1024);
m_stop = jipp.core.ippGetCpuClocks();
System.out.println( "IPP time = " + (double)(m_stop-m_start) + " CPU cycles");
m_start = jipp.core.ippGetCpuClocks();
for(k=1; k<=1000; k++)
for(j=0; j<1024; j++)
insig = (float) 0;
m_stop = jipp.core.ippGetCpuClocks();
System.out.println( "REG. time = " + (double)(m_stop-m_start) + " CPU cycles");
}
}
0 Kudos
6 Replies
andrewk88
Beginner
1,011 Views

...

... perhaps that is related to not properly aligned 1D signal buffer in memory?

Thanks again,

AndrewK

BTW, could you provide an example(s) source code in java how to allocatecorrectly aligned in memory1D and 2D buffers ?

0 Kudos
Vladimir_Dudnik
Employee
1,010 Views

Hi Andrew,

we tests this issue with following code

Code:

import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.util.*;
import jipp.*;

class zero
{
   static int j, k;
   static long m_start, m_stop;
   static float[] insig  = new float[1024];

   public static void main( String arg[] ) {
     System.out.println( "cpu  type = "+jipp.core.ippGetCpuType() );
     System.out.println( "lib       = "+jipp.sp.ippsGetLibVersion().Name );

     m_start = jipp.core.ippGetCpuClocks();
     for(k=1; k<=1000000; k++)
       jipp.sp.ippsSet_32f(0, insig, 1024);
     m_stop = jipp.core.ippGetCpuClocks();

     System.out.println( "IPP  time = " + (double)(m_stop-m_start)/(1000000.*1024) + " CPU cycles");

     m_start = jipp.core.ippGetCpuClocks();
     for(k=1; k<=1000000; k++)
      for(j=0; j<1024; j++)
       insig = (float) 0;
     m_stop = jipp.core.ippGetCpuClocks();

     System.out.println( "REG. time = " + (double)(m_stop-m_start)/(1000000.*1024) + " CPU cycles");
  }
}

And our results looks like
cpu type = 7
lib = ippsw7.dll
IPP time = 10.0496495234375 CPU cycles
REG. time = 11.0541241953125 CPU cycles

Please check ifPX(means generic C code) libraries were used in your test?

Regards,
Vladimir

0 Kudos
andrewk88
Beginner
1,011 Views

Hi Vladimir,

Thanks for providing your testing results.

Here are my results using your code

cpu type = 6
lib = ippsw7.dll
IPP time = 9.40602633203125 CPU cycles
REG. time = 11.1729733828125 CPU cycles

any my old code

cpu type = 6
lib = ippcore.dll
IPP time = 8.830512E7 CPU cycles
REG. time = 2.7357444E7 CPU cycles

Does it make any sense to you?

Best regards,

AndrewK

PS. Perhaps, using jipp.sp.ippsSet_32f() routine is notthe most reasonable way of performance evaluation:-)

0 Kudos
Vladimir_Dudnik
Employee
1,011 Views

Yes, I the difference is only in number of repetitions in measuring loop. And also name of library in your case is shown as ippcore.dll, it does not say which version of ipps library were used PX or W7.

Regards,
Vladimir

0 Kudos
andrewk88
Beginner
1,011 Views
... after changing name only of library to be printed out

cpu type = 6
lib = ippsw7.dll
IPP time = 1.0023372E7 CPU cycles
REG. time = 2.1228532E7 CPU cycles
Now, IPP is 2x faster ... instead of 4x slower ...
Andrew
0 Kudos
Vladimir_Dudnik
Employee
1,011 Views

Wow, that's interesting! I'm even don't know what can be reason for such a strange side effect. Anyway, now we know IPP should give benefits in performance:)

Regards,
Vladimir

0 Kudos
Reply