Hello,
I was running my code on CPU with no issue; I am now trying to run it on GPU or TPU but either way I am getting this error when running the jar after compiling:
java.lang.UnsatisfiedLinkError: no jnind4jcpu in java.library.path
I am confused why it is looking for a …cpu library. My best guess is that my pom file is wrong because I understood nothing of this page: CUDA (nd4j-cuda) | Deeplearning4j
My pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>floaters</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- only this works https://www.baeldung.com/deeplearning4j -->
<properties>
<dl4j.version>1.0.0-M2.1</dl4j.version> <!-- 1.0.0-rewrite -->
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>custom-repo</id>
<name>Custom Maven Repository</name>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>jaffree-repo</id>
<name>for video</name>
<url>https://central.sonatype.com/</url>
</repository>
</repositories>
<dependencies>
<!-- for video: http://jcodec.org/-->
<dependency>
<groupId>org.jcodec</groupId>
<artifactId>jcodec</artifactId>
<version>0.2.3</version>
</dependency>
<dependency>
<groupId>org.jcodec</groupId>
<artifactId>jcodec-javase</artifactId>
<version>0.2.3</version>
</dependency>
<!-- SLF4J API (transitively included by logback-classic) -->
<!-- Logback Classic (includes SLF4J binding + logback-core) -->
<!-- <dependency>-->
<!-- <groupId>ch.qos.logback</groupId>-->
<!-- <artifactId>logback-classic</artifactId>-->
<!-- <version>1.4.8</version> <!– Use the latest version –>-->
<!-- </dependency>-->
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-cuda-11.6-platform</artifactId>
<version>${dl4j.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>${dl4j.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>openblas</artifactId>
<version>0.3.19-1.5.7</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>openblas</artifactId>
<version>0.3.19-1.5.7</version>
<classifier>linux-x86_64</classifier>
</dependency>
<!-- DL4J cuDNN helpers: remove because does not actually exist -->
<!-- <dependency>-->
<!-- <groupId>org.deeplearning4j</groupId>-->
<!-- <artifactId>deeplearning4j-cuda-11.6</artifactId>-->
<!-- <version>${dl4j.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-ui</artifactId>
<version>${dl4j.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.46</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.46</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>dl.NCASdTester</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
run command:
!java -Dbackend.type=TPU -Djavacpp.platform.extension=-compile -Dfile.encoding=UTF-8 -classpath [some super long path copied from intellij]