djl icon indicating copy to clipboard operation
djl copied to clipboard

Add a ND4J backend

Open wmeddie opened this issue 5 years ago • 7 comments

Description

ND4J, the accelerated linear algebra backend that powers Eclipse DeepLearning4J, should have all the necessary features to become a proper backend for DJL.

Will this change the current api? How?

No API changes should be necessary for the basics. If ND4J provides any opportunity an API enhancement we can discuss those as a separate issue.

Who will benefit from this feature?

DL4J has support for more native architectures (including ARM64 (Raspberry Pi/iOS/Android) and OpenPower) so it will allow people with those devices to take advantage of DJL. DL4J supports importing Keras, Tensorflow and ONNX models so if we design this correctly we can expand the types of pre-trained models the users can use.

References

  • I created a very bare bones first pass backend that's around as complete as the TensorFlow backend here: https://github.com/wmeddie/djl/tree/add-nd4j-backend/nd4j/engine As it becomes more complete I will provide a PR.

wmeddie avatar Dec 01 '19 06:12 wmeddie

Wow, that's great! Thanks for your interest in DJL. Hope to see your contribution soon :).

Recommendation:

  1. Please work carefully on the NDManager because that is the most effective layer to collect memory.
  2. The NDArray behavior may change through time since we are actively adding more ops into DJL.

lanking520 avatar Dec 01 '19 15:12 lanking520

Does this mean that it will also work in windows? I became really disappointed when I tried to build examples on my windows machine and I realized that it is impossible. And then probably I cannot use the entire library on my windows pc :( is there a way to go around this?

shilan avatar Dec 01 '19 15:12 shilan

Does this mean that it will also work in windows? I became really disappointed when I tried to build examples on my windows machine and I realized that it is impossible. And then probably I cannot use the entire library on my windows pc :( is there a way to go around this?

Currently, Windows is WIP. We will try to get there once we have MXNet 1.6 for Windows (MXNet Engine). For now, you can use docker to host it on Windows.

lanking520 avatar Dec 01 '19 15:12 lanking520

I also used WSL to build which works fine for CPU at least.

ND4J does work (and pretty much has always worked) on Windows so given that enough of the operations are added it could in theory be used. MXNet 1.6 might come out sooner though not sure on the timeline of that.

wmeddie avatar Dec 01 '19 15:12 wmeddie

I also used WSL to build which works fine for CPU at least.

great idea! never thought about that. However, I have never worked WSL before, hopefully it is straight forward to use :)

shilan avatar Dec 01 '19 19:12 shilan

@shilan You can try latest code now, it should work on Windows for both CPU/GPU now. Please notes windows support is still WIP, and only support limited cuda arch (sm_37, sm_70).

frankfliu avatar Dec 14 '19 05:12 frankfliu

@shilan did you get a chance to try out latest code ?

goswamig avatar Mar 15 '21 20:03 goswamig