Re: jni to optimize a java application using native mathematical libraries
- From: James Westby <jw2328@xxxxxxxxxx>
- Date: Tue, 04 Apr 2006 10:19:05 GMT
Dimitri Ognibene wrote:
Thanks James,
I've done exaclty the same considerations, the problem (mine specific
problem) is not if java is faster then c++, but to use optimized
libraries like GNU scientific library, that i didn't know till your
answer (thks), or Intel MKL, to replace mine non optimized, and not
truly able to optimize any further, code. In my lab we have used MKL
exp function instead of standard c implementation and we obtained a
speed up of 5 times in our neural network code, and we can't link
statically!!
Now, I'm sure that those libraries are faster then any code i'll ever
write, but I don't know if interfacing them with my already written
(130 classes) java system. I suppose, as I've said in my first post,
that in my specific application the use of an external library using
JNI will make the system much more complex (And difficult to mantain
and debug) and only a little faster.
That is a problem that you should avoid if possible. There is a trade-off between the speedup you can get and the increased complexity in maintaining the code.
I will be happier if I find a good java Math library, even if not asI've only moved one small part to C, the bit that was taking all the time when I profiled the code. Have you done that? I don't know of maths libraries in Java, it would like to know if there are any good ones.
good as MKL, and I've not to write boring JNI stuff, array copyng
methods and so on.
If I'm right you are translating your entire Matlab simulation to c, i
don't want to do this, at the moment, my coworker want, but I'm the
sw-engineer in the lab so.. much of the effort and of the decisions are
mine.. And i would like to find a compromise using some good Math
library to optimize the code where , as you said, 90% cpu of time is
spent, random, gaussian, sin and similar functions and perhaps Matrix
multiplication.. the use of java multidimensianl arrays isn't good,
I've tried to optimizing using code like:
Matrix multiplication is a slow operation, and probably a good candidate for optimistation, either by you or by swapping the code for something specialised (BLAS springs to mind, but I can only find a small mention to jBLAS by Google).
double matrix1[50][900];
double vector2[900];
for(int i =0;i<50;i++){
final double matrix_col[]=matrix[i];
for(int j=0;j<900;j++){
....}}
But only little speed up is gained..
And I don't have the time to find optimization tricks.. so a library
perhaps would be a better solution..
If you have any suggestion, please let me know
James
.
- Follow-Ups:
- Re: jni to optimize a java application using native mathematical libraries
- From: Dimitri Ognibene
- Re: jni to optimize a java application using native mathematical libraries
- References:
- jni to optimize a java application using native mathematical libraries
- From: dimitri . ognibene
- Re: jni to optimize a java application using native mathematical libraries
- From: Gordon Beaton
- Re: jni to optimize a java application using native mathematical libraries
- From: Dimitri Ognibene
- Re: jni to optimize a java application using native mathematical libraries
- From: Remon van Vliet
- Re: jni to optimize a java application using native mathematical libraries
- From: Roedy Green
- Re: jni to optimize a java application using native mathematical libraries
- From: James Westby
- Re: jni to optimize a java application using native mathematical libraries
- From: Dimitri Ognibene
- jni to optimize a java application using native mathematical libraries
- Prev by Date: Re: Gute Tutorials um Java zu lernen
- Next by Date: Making Java extinct!
- Previous by thread: Re: jni to optimize a java application using native mathematical libraries
- Next by thread: Re: jni to optimize a java application using native mathematical libraries
- Index(es):
Relevant Pages
|