Permalink
Browse files

Changes to support Raspberry Pi (pull #1455)

  • Loading branch information...
1 parent 6a1b950 commit 752fe0c870957da5badefb302ba75fe42bd8c256 @dschowta dschowta committed with saudet Nov 26, 2016
View
@@ -0,0 +1,23 @@
+Please follow following instructions to build nd4j on raspberry PI:
+
+ 1. {In build machine] compile libnd4j as follows:
+ - $git clone https://github.com/dschowta/libnd4j.git
+ - For cross compilation use this link:http://stackoverflow.com/questions/19162072/installing-raspberry-pi-cross-compiler
+ - make sure to use the 4.9 version of gcc (raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-g++)
+ 3.[In build machine] build using "$./buildnativeoperations.sh -o linux-armhf"
+ 4. [In build machine] Install maven 3.3.9 (3.0.X does not work)
+ 5. [In build machine] followed instructions mentioned in https://deeplearning4j.org/buildinglocally :
+ a. $export LIBND4J_HOME=<pathTond4JNI>
+
+ b. Build and install nd4j to maven locally (using the forked nd4j specifically changed for raspberry pi)
+ $git clone https://github.com/dschowta/nd4j.git
+ $cd nd4j
+ c. Edit nd4j-backends\nd4j-backend-impls\nd4j-native\src\main\resources\org\bytedeco\javacpp\properties to update the paths of native toolchains
+
+ d. $mvn clean install -Djavacpp.platform=linux-armhf -DskipTests -Dmaven.javadoc.skip=true -pl '!:nd4j-cuda-8.0,!:nd4j-cuda-8.0-platform,!:nd4j-tests'
+
+ 7. [In build machine ] build the source of dependant appllication with above (step 7) dependencies.
+ 8. [In raspbian ]copy the generated jar of dependant application to raspberry
+ 9. [In raspbian ]download the libraries inside the folders of build machine nd4j-backends/nd4j-backend-impls/nd4j-native/target/classes/org/nd4j/nativeblas/linux-armhf/ to a permanent folder containing libs (if possible to a system folder)
+ 10.[In raspbian ] export the variable LD_LIBRARY_PATH to the path set in step 10: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<the path to libraryy>
+ 11. [In raspbian ]java -jar myjar.jar
@@ -43,6 +43,14 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-ppc64le}</classifier>
</dependency>
+ <!--
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${nd4j.backend}</artifactId>
+ <version>${project.version}</version>
+ <classifier>${javacpp.platform.linux-armhf}</classifier>
+ </dependency>
+ -->
</dependencies>
</project>
@@ -0,0 +1,29 @@
+platform=linux-armhf
+platform.path.separator=:
+platform.source.suffix=.cpp
+platform.root=../raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/
+platform.sysroot.prefix=--sysroot=
+platform.sysroot=arm-linux-gnueabihf/sysroot/
+platform.includepath.prefix=-I
+platform.includepath=arm-linux-gnueabihf/include/c++/4.9.3/:arm-linux-gnueabihf/sysroot/usr/include/
+platform.compiler=bin/arm-linux-gnueabihf-g++
+platform.compiler.cpp11=-std=c++11
+platform.compiler.default=
+platform.compiler.fastfpu=-ffast-math
+platform.compiler.nodeprecated=-Wno-deprecated-declarations
+platform.compiler.output=-O3 -g3 -Wall -fPIC -march=armv7-a -mfpu=vfp -mfloat-abi=hard -c -shared -s -o\u0020
+platform.linkpath.prefix=-L
+platform.linkpath=
+platform.link.prefix=-l
+platform.link.suffix=
+platform.link=
+platform.framework.prefix=-F
+platform.framework.suffix=
+platform.framework=
+platform.library.prefix=lib
+platform.library.suffix=.so
+platform.preloadpath=/home/almanac/raspberrypi/rootfs/usr/lib/:/home/almanac/raspberrypi/rootfs/usr/lib/arm-linux-gnueabihf/:/home/almanac/raspberrypi/rootfs/usr/lib/libblas/:/home/almanac/libnd4j/blasbuild/cpu/blas/
+platform.preload=gomp@.1:gfortran@.3:openblas@.0:blas@.3
+
+
+
@@ -36,6 +36,7 @@
<javacpp.platform.macosx-x86_64>macosx-x86_64</javacpp.platform.macosx-x86_64>
<javacpp.platform.windows-x86_64>windows-x86_64</javacpp.platform.windows-x86_64>
<javacpp.platform.linux-ppc64le>linux-ppc64le</javacpp.platform.linux-ppc64le>
+ <javacpp.platform.linux-armhf>linux-armhf</javacpp.platform.linux-armhf>
</properties>
@@ -216,7 +217,20 @@
<javacpp.platform.compiler>toolchains/x86-4.9/prebuilt/${os.name}-${os.arch}/bin/i686-linux-android-g++</javacpp.platform.compiler>
</properties>
</profile>
-
+ <profile>
+ <id>linux-armhf-default</id>
+ <activation>
+ <property>
+ <name>javacpp.platform</name>
+ <value>linux-armhf</value>
+ </property>
+ </activation>
+ <properties>
+ <javacpp.platform>linux-armhf</javacpp.platform>
+ <javacpp.platform.root>/home/almanac/raspberrypi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf</javacpp.platform.root>
+ <javacpp.platform.compiler>bin/arm-linux-gnueabihf-g++</javacpp.platform.compiler>
+ </properties>
+ </profile>
</profiles>
</project>
@@ -3,7 +3,7 @@
<parent>
<artifactId>nd4j-shade</artifactId>
<groupId>org.nd4j</groupId>
- <version>0.7.0</version>
+ <version>0.7.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jackson</artifactId>
View
@@ -136,6 +136,15 @@
<os.arch>x86_64</os.arch>
</properties>
</profile>
+ <profile>
+ <id>arm</id>
+ <activation>
+ <os><arch>arm</arch></os>
+ </activation>
+ <properties>
+ <os.arch>arm</os.arch>
+ </properties>
+ </profile>
<profile>
<id>release-sign-artifacts</id>

0 comments on commit 752fe0c

Please sign in to comment.