Live data from Hacker News

Neanderthal vs. ND4J – Native Performance, Java and CPU

dragan.rocks

21–27 of 27 posts

Re: Neanderthal vs. ND4J – Native Performance, Java and CPU

#21

Earlier quoted context omitted.

You're right. In that particular case, ND4J comes to Neanderthal's speed. But only in that particular case; and even then ND4J is still not faster than Neanderthal. My initial quest was to find out whether ND4J can be faster than Neanderthal, and I still couldn't find a case where it is. Although, to my defense, the option in question here is very poorly documented. I've found the ND4J tutorial page where it's mentio…

Fair point we are fixing now: https://github.com/deeplearning4j/deeplearning4j-docs/issues... We will be sending out a doc for this by next week with these updates. Thanks a lot for playing ball here. Beyond that, can you clarify what you mean? Do you mean just the gemm op? For that, that's the only case that mattered for us. We will be documenting the what/how/why of this in our docs. Beyond that, I'm not convinced…

Sure. I agree. You as a company have to look at your bottom line above all. Nothing wrong with that.

Please also note that Neanderthal also has hundreds of operations. The set of use cases where it scratches itches might be wider and more general than you think.

The reasons I'm showcasing matrix multiplications are:

1. That's what you used in the comparison. 2. It is a good proxy for the overall performance. If matrix multiplication is poor, other operations tend to be even poorer :)

Anyway, as I said, I'll be glad to compare other operations that ND4J excells at, or that anyone think are important.

I would also like to see ND4J's comparisons with Tensorflow or Numpy, or PyTorch, or, JVM based MXNet.

Re: Neanderthal vs. ND4J – Native Performance, Java and CPU

#22

Earlier quoted context omitted.

Fair point we are fixing now: https://github.com/deeplearning4j/deeplearning4j-docs/issues... We will be sending out a doc for this by next week with these updates. Thanks a lot for playing ball here. Beyond that, can you clarify what you mean? Do you mean just the gemm op? For that, that's the only case that mattered for us. We will be documenting the what/how/why of this in our docs. Beyond that, I'm not convinced…

Sure. I agree. You as a company have to look at your bottom line above all. Nothing wrong with that. Please also note that Neanderthal also has hundreds of operations. The set of use cases where it scratches itches might be wider and more general than you think. The reasons I'm showcasing matrix multiplications are: 1. That's what you used in the comparison. 2. It is a good proxy for the overall performance. If matri…

Yeah we definitely need to spend some more time on benchmarks after all it's said and done.

That being said, while gemm is one op, it's a lot more than just jni back and forth that use other libraries. What matters here are also things like convolutions, pair wise distance calculations, element wise ops, etc.

There's nuance there.

There are multiple layers here to consider:

1. The JNI interop managed via javacpp (relevant to this discussion)

2. Every op has allocation vs in place trade offs to consider

3. For our python interface, we have yet another layer to benchmark there (we use pyjnius for jumpy the python interface for nd4j)

4. Op implementations for the cuda kernels and the custom cpu ops we wrote. (That's where our avx512 and avx2 jars matter for example)

For the subset we are comparing against, it's basically making sure we wrap the blas calls properly. That's definitely something we should be doing.

We've profiled that and chose the pattern you're seeing above with f ordering.

That is where we are fast and chose to optimize for. You are faster in those other cases and have laid that out very well.

Again, there's still a lot that was learned here and I will post the doc when we get it out there to make that less painful next time.

You made a great post here and really laid out the trade offs.

I wish we had more time to run benchmarks beyond timing for our own use cases, if we had smaller scope we would definitely focus on every case you're mentioning here. We likely will revisit this at some point if we find it worth it.

In general, our communications and docs can always be improved (especially our internals like our memory allocation)

Re: your last point we do do this kind of benchmarking with tensorflow. For example: https://www.slideshare.net/agibsonccc/deploying-signature-ve... (see slide 3 and also the broader slides for an idea of how we profile deep learning for apps using the jvm)

We need to do a better job of maintaining these things though. We don't keep it up to date and don't profile as much as we should. It has diminishing returns after a certain point vs building other features.

I'm hoping a CI build to generate these things is something we get done this year so we can both prevent performance regressions and have consistent numbers we can publish for the docs.

Once the python interface is done that will be easier to do and justify since most of our "competition" is in python.

Re: Neanderthal vs. ND4J – Native Performance, Java and CPU

#23
The DL4J folks are a joke. They make a ton of outrageous claims then and they tell you you're getting it all wrong when you try to call them on it. I know they need to justify their nonsense so SkyMind can sucker someone into an acquisition, but they're not fooling anyone. At best they can claim it's as fast as what one person built in their spare time....

Re: Neanderthal vs. ND4J – Native Performance, Java and CPU

#24

DL4J contributor here. I spoke with our team so the differences in performance are likely explained by array ordering. ND4J, for good reason, requires F ordering because of limitations in cuBLAS. While I haven't had the opportunity to closely examine the Neanderthal comparison (I'm also not a clojure user), the likely explanation is that there's an implicit ordering impacting this. Deeplearning4j is written around F…

When will you just admit the initial claim about ND4J being faster than Neanderthal was bogus?

Re: Neanderthal vs. ND4J – Native Performance, Java and CPU

#25
post #2

Author here. I'm open for discussion. The source is in the text, but conveniently accessible here: https://github.com/uncomplicate/neanderthal/blob/master/exam...

Is there a guide for getting neanderthal running with MKL on Windows? I tried my best but I'm not smart enough to get passed the require statement.

Re: Neanderthal vs. ND4J – Native Performance, Java and CPU

#26
post #25
post #2

Author here. I'm open for discussion. The source is in the text, but conveniently accessible here: https://github.com/uncomplicate/neanderthal/blob/master/exam...

Is there a guide for getting neanderthal running with MKL on Windows? I tried my best but I'm not smart enough to get passed the require statement.

Yes:

https://neanderthal.uncomplicate.org/articles/getting_starte...

And just to be sure, choose option 2 under that heading (add the folder with appropriate dlls to PATH)

Re: Neanderthal vs. ND4J – Native Performance, Java and CPU

#27

DL4J contributor here. I spoke with our team so the differences in performance are likely explained by array ordering. ND4J, for good reason, requires F ordering because of limitations in cuBLAS. While I haven't had the opportunity to closely examine the Neanderthal comparison (I'm also not a clojure user), the likely explanation is that there's an implicit ordering impacting this. Deeplearning4j is written around F…

Here's our updated benchmarks. Thanks to Dragan for the cooperation!

Benchmarking ND4J and Neanderthal (Scientific Computing in Java and Clojure)

https://www.dubs.tech/blog/benchmarking-nd4j-and-neanderthal...

Post reply on HN