Rowan Ackerman
Rowan Ackerman

Reputation: 23

How do I install/use nd4j?

I've been working on a project for a while and determined that it would be made much faster with the use of nd4j. I have spent many hours trying to use this library, but I always find more dependencies and errors.

I started in Processing, but when I discovered that nd4j suggested the use of Maven, I switched to Eclipse. I'm not very familiar with Eclipse or Maven, so I'm sure there's some fairly easy way to get all of the dependencies for nd4j and I just haven't figured it out yet.

Does anyone know where can find all of the required jars for nd4j or how I can use it in Eclipse (or Processing)?

Again, I'm not familiar with Eclipse or Maven, so step by step instructions would be great.

Thanks so much!

If any further information would be useful, I would be happy to provide it.

Upvotes: 0

Views: 3369

Answers (1)

Adam Gibson
Adam Gibson

Reputation: 3205

Nd4j itself is just a library. You don't really "install" it. What I'm about to say is also in our docs at https://deeplearning4j.konduit.ai. If you can't find something, I would appreciate feedback on the github repo: https://github.com/eclipse/deeplearning4j/issues

All you do is include which backend you want to use. A backend is a library which implements the nd4j interface and interfaces with a native backend which consists of a combination of a c++ library and blas/lapack bindings.

Of note here is usually when folks are new to the library they sometimes just don't know maven. If you are not familiar with maven/gradle I would recommend you get familiar with them. We don't support downloading 1 off jars and trying to mix/match them on your own in eclipse. This is due to all the combinations of dependencies you can use to make the library fit your use case. Of course this has its own trade offs.

Learning maven is a bit outside the scope of this post but I would recommend the maven quickstart or the guide for your IDE. Eclipse/Intellij have great maven integration and I would suggest you learn it. Most of the java ecosystem assumes that you know this for consuming their libraries.

If maven/gradle is well understood then you need to pick whether to use CPU or GPU. For simplicity, I assume you will want to use a cpu backend. In that case, once you have maven/gradle setup use the latest version found on maven central. In this case, you'll want the nd4j-native-platform artifact. This will allow you to declare 1 line in your pom.xml that will configure/download all the dependencies for you. That will usually look like:

<dependency>
  <groupId>org.nd4j</groupId>
  <artifactId>nd4j-native-platform</artifactId>
  <version>1.0.0-M1.1</version>
</dependency>

I would look at maven central itself to see what the latest version will be at a given time though: https://search.maven.org/artifact/org.nd4j/nd4j-native-platform/1.0.0-M1.1/jar

Upvotes: 0

Related Questions