Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Java and IPP

pascal_bamford
Beginner
1,154 Views
A while ago (around v1.0 I think), there was talk of a Java interface to IPP (on the website at least). To many this may sound ridiculous, but I have been using IPP in Java with great success via JNI wrappers. In fact I have been developing a general purpose image analysis package, based on IPP, in Java, that is both quick and portable. I put some guff on the wrapping part ofthis here:
Only problem is that writing the wrapper functions is non-trivial (I wrote a dedicated parser for the IPP *.h files, but it isn't robust).
Are there any plans at Intel to do something similar (but properly!), or has someone thought better of it since the early days?
Pascal.
P.S. Do multiple posts increase your chances of getting the book?!!
0 Kudos
14 Replies
Intel_C_Intel
Employee
1,154 Views

Hi Pascal,

what particular Java do you want?

Regards,
Vladimir

0 Kudos
pascal_bamford
Beginner
1,154 Views

I may have got the meaning of your question wrong, but it shouldn't matter which version of Java... 1.4.0 introduced the nio package which is handy for 'exposing' IPP-allocated memory to Java (for copying into BufferedImages etc. - see the website in original post), but other than that it is a JNI task which as far as I know has been pretty stable...

Pascal (fellow Scorpions fan)
0 Kudos
Gururaj_N_Intel
Employee
1,154 Views

Pascal, How many IPP functions are you going to be using and in which IPP functional domains? e.g. image, audio etc.

The overhead of JNI is not trivial, as you know. Since IPPs are primitives, a lot of cycles gained in optimized performance is lost because of the JNI overhead of calling an IPP function.

I suggest you to try this: group multiple calls to primitive functions into one JNI call if it is possible for your usage scenario.This will help reduce the JNI overhead if you can pack as many native calls as possible into one JNI call. Try to use managed memory instead of unmanaged memory where possible. Java env lets you access managed mem from unmanaged (or native) code.

If you are interested in .NET, the C# wrappers (using P/Invoke) for IPP functionsis available as part of ourIPP 4.0 release, but we don't have Java (JNI) wrappers yet. C# wrappers are available on premier.intel.com.

0 Kudos
Intel_C_Intel
Employee
1,154 Views

Actually, I mean whichimplementation of Java you are interested in? You know, there are several ones.

Vladimir

0 Kudos
pascal_bamford
Beginner
1,154 Views
Good point. I use IPP almost exclusively for image processing on largeish images (at least 1k by 1k). I've noticed that the JNI overhead is negligible compared to the actual image processing for this and thus quite happily call individual functions rather than grouping them together.
0 Kudos
andrewk88
Beginner
1,154 Views
Hello Pascal,
You've done really fantastic work !
Regards,
Andrew
PS. Are you planning on doing the same for 1D part of IPP (if not maybe I will)
0 Kudos
pascal_bamford
Beginner
1,154 Views
Thanks, Andrew. I have wrapped the functions ipps.h, but I haven't posted them on the website. I can send them to you, if you like.
As with the other wrappers, they contain errors due to my imperfect parser. Testing, or at least eyeballing, each function is proving to be too much work for me.
My motivation for the original post to this forum was to encourage others (but preferably Intel!) to do this work in a more organised way than I can. If you have plans for a better 'go' at this then please keep me/us informed!!!
If anyone else is interested, I and the people that have contacted me like the idea of Java IPP wrappers because:
1. They speed development as only Java codeneeds to be written to access the fast IPP routines (i.e. no mixed C/JNI and Java)
2. People use IPP to speed up slow operations, e.g. image processing on large images, where the JNI overhead is negligable. This makes itworthwhile to wrap each individual function rather than lumping together several in a single JNI call.
0 Kudos
andrewk88
Beginner
1,154 Views
Hi Pascal,
Yes, I totally agree with your reasons and motivation. Some time ago, I was really frustrated with a performance of image processing in Java environment, but I still like a "beauty of Java", especially for GUIs. That's why I really appreciate your integration of "beauty and beast (aka IPP)"and would be very interested in getting access to your java wrapper for 1D IPPS library. Sorry to say, but currently I don't have a plan for making it "a better way" as my major motivation is to createas soon as possible "a convenient and flexible R&D environment"for video processing algorithms as motion estimation, rescaling, deinterlacing, ...
Best regards,
Andrew
0 Kudos
Vladimir_Dudnik
Employee
1,154 Views
Hi,
thanks very much for your effort on this. Yes, we also thinking in this direction. I believe we will add Java wrappers in the future IPP releases.
Regards,
Vladimir
0 Kudos
borix
Beginner
1,154 Views
It will be JNI interface (jdk 1.5) provided in IPP 5.0 for all IPP domains. please expect overhead of the JNI though
0 Kudos
smartknight
Beginner
1,154 Views
Hi,
Thanks for this java information.
Thanks,
0 Kudos
rktumuluri
Beginner
1,154 Views
Could you advise on a date ?.

Regards
/rk
0 Kudos
Vladimir_Dudnik
Employee
1,154 Views
Hi,
we can't say about exact date of the next release but it planned to be somewhere at Q1 of this year.
Regards,
Vladimir
0 Kudos
jackson_multicore
1,154 Views
Quoting - pascal_bamford
Hellow Andrew,
I am jackson. I had installed ipp for linux and got the java sample code also but i am unable to run the java code.I need a procedure how to run the java code in linux environment.










Thanks, Andrew. I have wrapped the functions ipps.h, but I haven't posted them on the website. I can send them to you, if you like.
As with the other wrappers, they contain errors due to my imperfect parser. Testing, or at least eyeballing, each function is proving to be too much work for me.
My motivation for the original post to this forum was to encourage others (but preferably Intel!) to do this work in a more organised way than I can. If you have plans for a better 'go' at this then please keep me/us informed!!!
If anyone else is interested, I and the people that have contacted me like the idea of Java IPP wrappers because:
1. They speed development as only Java code needs to be written to access the fast IPP routines (i.e. no mixed C/JNI and Java)
2. People use IPP to speed up slow operations, e.g. image processing on large images, where the JNI overhead is negligable. This makes it worthwhile to wrap each individual function rather than lumping together several in a single JNI call.

0 Kudos
Reply