Tuesday, December 22, 2009

jblas release 1.0

Update: I released jblas-1.0.1 which also works on processors which only support SSE2 (e.g. older Athlon64 processors). Go to jblas.org and check it out!

I’ve just release jblas 1.0. For those of you who don’t know yet, jblas is a matrix library for Java which is based on the BLAS and LAPACK routines, currently using ATLAS and lapack-lite, for maximum performance.

I’m using jblas myself for most of my research together with a wrapper in jruby which I plan to release pretty soon as well.

In any case, here are the most important new features of release 1.0

  • Default jar file now contains all the libraries for Windows, Linux, and Mac OS X. Both 32 and 64 bit are supported (although right now, the 64 bit version for Windows is still missing. I’ll take care of that after the holidays). The libraries are built for the Core2 platform which in my experience gives the best combined performance on Intel and AMD processors (The Hammer or AMDk10h settings give slightly better performance on AMD, but inferior performance on the Intel platform).

  • New LAPACK functions GEEV (generalized Eigenvalues), GETRF (LU factorization), POTRF (Cholesky factorization) in NativeBlas.

  • Decompose class providing high-level access to LU and Cholesky factorization.

  • Improved support for standard Java framework: Matrix classes are serializable, matrix classes provide read-only AbstractList views for elements, rows, and vectors.

  • Permutation class for random permutations and subsets.

The new jar file also comes with a little command line tool for checking the installation and running a small benchmark. If you run java -server -jar jblas-1.0.jar on my machine (Linux, 32 bit, Core 2 Duo @ 2Ghz), you get


Simple benchmark for jblas

Running sanity benchmarks.

checking vector addition... ok
-- org.jblas CONFIG BLAS native library not found in path. Copying native library from the archive. Consider installing the library somewhere in the path (for Windows: PATH, for Linux: LD_LIBRARY_PATH).
-- org.jblas CONFIG Loading libjblas.so from /lib/static/Linux/i386/libjblas.so.
checking matrix multiplication... ok
checking existence of dsyev...... ok
checking XERBLA... ok
Sanity checks passed.

Each benchmark will take about 5 seconds...

Running benchmark "Java matrix multiplication, double precision".
n = 10 : 424.4 MFLOPS (1061118 iterations in 5.0 seconds)
n = 100 : 1272.6 MFLOPS (3182 iterations in 5.0 seconds)
n = 1000 : 928.5 MFLOPS (3 iterations in 6.5 seconds)

Running benchmark "Java matrix multiplication, single precision".
n = 10 : 445.0 MFLOPS (1112397 iterations in 5.0 seconds)
n = 100 : 1273.0 MFLOPS (3183 iterations in 5.0 seconds)
n = 1000 : 1330.9 MFLOPS (4 iterations in 6.0 seconds)

Running benchmark "ATLAS matrix multiplication, double precision".
n = 10 : 428.2 MFLOPS (1070428 iterations in 5.0 seconds)
n = 100 : 3293.9 MFLOPS (8235 iterations in 5.0 seconds)
n = 1000 : 5383.2 MFLOPS (14 iterations in 5.2 seconds)

Running benchmark "ATLAS matrix multiplication, single precision".
n = 10 : 465.2 MFLOPS (1162905 iterations in 5.0 seconds)
n = 100 : 5997.3 MFLOPS (14994 iterations in 5.0 seconds)
n = 1000 : 9186.6 MFLOPS (23 iterations in 5.0 seconds)

Resources:

10 comments:

dleskov said...

I get this on my Windows 2000 box:

E:\TEMP>java -server -jar jblas-1.0.jar
Simple benchmark for jblas

Running sanity benchmarks.

checking vector addition... ok
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ILLEGAL_INSTRUCTION (0xc000001d) at pc=0x1026826a, pid=560, tid=2152
#
# Java VM: Java HotSpot(TM) Server VM (1.6.0_03-b05 mixed mode)
# Problematic frame:
# C [jblas.dll+0x26826a]
#
# An error report file with more information is saved as hs_err_pid560.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

Mikio Braun said...

Hi dleskov,

thanks for your bug report. This is interesting... . In a bad way of course ;)

I've opened a ticket http://github.com/mikiobraun/jblas/issues/#issue/4, check back there for updates.

-M

Mikio Braun said...

Hi dleskov,

on my machine (Win XP) it runs ok. So either its a Win 2000 vs Win XP thing, or there are some dependencies on cygwin libraries left which I overlooked.

Can you attach or send the error file (something like "hs_err_....") which contains the stack frames?

Thanks,

-M

dleskov said...

Sure, just let me know where to send that file. You may find my email address near the bottom of this page.

I have also tried it on another machine which has XP and JDK 1.6.0_12, and it also failed, though the offset is different:

# C [jblas.dll+0x136424]

For the record, I have CygWin installed on both machines.

Mikio Braun said...

Hi,

I was just able to reproduce a similar crash on my old computer with an Athlon 64 processor. Probably the problem is that the Core2 settings assume SSE3, but some older processors don't support it... .

I'll look into that matter.

-M

Mikio Braun said...

Hello,

I managed to compile ATLAS for SSE2. I'll do some performance comparisons and will then release a SSE2 jar file which will also run on older machines. Right now it looks as if performance might be a bit lower than SSE3... .

I'll release the files in the next few days!

-M

Mikio Braun said...

Just to keep you posted... . I'm currently reworking such that jblas detects sse2/sse3 at runtime and loads the appropriate library automatically...

Mikio Braun said...

Alright, I just release 1.0.1 which has code in there for automatic detection of SSE2 vs. SSE3. Should now also run on older processors!

dleskov said...

No luck here with 1.0.1.

# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ILLEGAL_INSTRUCTION (0xc000001d) at pc=0x0c38826a, pid=664, tid=1476
#
# Java VM: Java HotSpot(TM) Server VM (1.6.0_03-b05 mixed mode)
# Problematic frame:
# C [jblas35552jblas.dll+0x26826a]

Mikio Braun said...

Hi dleskov,

sorry to hear that... . Could you email me the full output of "java -jar jblas-1.0.1.jar"?