The difference between the two is that when solving PDEs, accuracy is paramount, so even using single precision is a bit of a compromise, whereas in machine learning, the trend seems to be to use half-precision or lower, sacrificing accuracy for speed.
For classical numerical computing, e.g. solving PDEs or linear equations, Java may not be the best choice, e.g. see the following paper:
How Java's Floating Point Hurts Everyone Everywhere:
The speed depends on the blas implementation.
Nd4j has a concept of "backends". Nd4j backends allow us to sub in different blas implementations as well as different ways of doing operations.
We have a data buffer type that allows people to specify floating point or double. Those data buffers then have an allocation type that can be javacpp pointers,nio byte buffers (direct/offheap) or normal arrays
We are also currently working on surprassing the jvm's memory limits ourselves via javacpp's pointers. That allows us to have 64 bit addressing which people normally have access to in c++.
Every current jvm matrix lib that uses net lib java or jblas is going to have problems with jvm communications as well. The reason for this is passing around java arrays and byte buffers is slower than how we handle it which is via passing longs (raw pointer addresses) around that are addressed via unsafe or allocated in jni where we retain the pointer address directly. We expose that to our native operators.
We are solving this by writing our own c++ backend called libnd4j that supports cuda as well as normal openmp optimized for loops for computation.
We also offer a unified interface to cublas and cblas (which is implemented by openblas as well as mkl) FWIW, I more or less agree with you, but it doesn't mean it shouldn't exist.
JVM based environments can bypass the jvm just like python does now.
The fundamental problem with the jvm is no one just took what works on other platforms and mapped the concepts 1 to 1.
Our idea with nd4j is to not only allow people to write their own backends, but also provide a sane default platform for numerical computing on the jvm. Things like garbage collection shouldn't be a hindrance for what is otherwise a great platform for bigger workloads (hadoop,spark,kafka,..)
In summary, we know the jvm has been bad till now - it's our hope for fixing that.
I find it interesting in the Numpy comparison no mention of the BLAS Numpy is linked to is mentioned, but it is for Nd4j. Numpy is highly dependent on a good BLAS and the basic Netlib one isn't that great.
Yes we have double precision - we have a default data type with the data buffer.
If you're curious how we do storage: https://github.com/deeplearning4j/nd4j/blob/master/nd4j-buff...
We have allocation types and data types.
Data types are double/float/int (int is mainly for storage)
Allocation types are the storage medium which can be arrays,byte buffers or what have you.
If you have a problem with the docs - I highly suggest filing an issue on our site: https://github.com/deeplearning4j/nd4j/issues
We actually appreciate eedback like this thank you.
For net lib java, it links against any blas implementation you give it. It has this idea of a JNILoader which can dynamically link against the fallback blas (which you mentioned)
or typically openblas or mkl. The problem there can actually be licensing though. The spark project runs in to this: https://issues.apache.org/jira/browse/SPARK-4816
If we don't mention on the site, it's probably because we haven't thought about it or haven't gotten enough feedback on something.
Unfortunately, we're still in heavy development mode.
FWIW, we have one of the most active gitter channels out there. You can come find me anytime if you're interested in getting involved.
I'm aware the software engineering logistics that go into doing sparse right which is why I held off
We are mainly targeting deep learning with this but sparse is becoming important enough for us to add it.
As for disparate standards I managed to work past that for cublas/blas.
I'm not going to let it stop me from doing it right. If you want to help us fix it we are hiring ;).
There's the NIST sparse blas, and MKL has a similar but not exactly compatible version. These never really took off in adoption (MKL's widely used of course, but I'd wager these particular functions are not). What sparse lapack are you talking about?
> If you want to help us fix it we are hiring ;).
We were at the same dinner a couple weeks ago actually. I'm enjoying where I am using Julia and LLVM, not sure if you could pay me enough to make me want to work on the JVM.
[1] - http://spark.apache.org/docs/latest/mllib-data-types.html
We have this concept of a backend where we had net lib java and jblas, but both are horribly slow/limited and need some updating which is why we added our approach to this.
If a new matrix framework comes out, I will just write a backend for it and allow people to keep the same dsl.
Breeze also isn't usable from java: http://stackoverflow.com/questions/27246348/using-breeze-fro...
FWIW, we also support both row and column major (you can specify the data as well as ordering) very similar to numpy.
If you come use nd4j, it will mainly be for a dsl that encourages vectorization just like any other numerical language.
The JVM has a lot of matrix library fragmentation.
And the JVM's costs in terms of deployment and startup times aren't very attractive for scientific workloads. You wouldn't gain as much in a migration from Python or Matlab to Java (or any other JVM language) as you would to C++ (or increasingly Julia), since you'll likely still need access to the same native libraries and JNI is kind of a pain.
But in julia, its written in julia. There are even julia native tensor and matrix ops.