Changes to support Raspberry Pi #1455

Merged
merged 12 commits into from Nov 26, 2016

Projects

None yet

3 participants

@dschowta
Contributor

Here are the procedure followed to port to Raspberry PI:

	1. {In build machine machine}compile libnd4j
			git clone https://github.com/dschowta/libnd4j.git
		- For cross compilation use this link:http://stackoverflow.com/questions/19162072/installing-raspberry-pi-cross-compiler
		- 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 rp2"
	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 :
			export LIBND4J_HOME=<pathTond4JNI>
			
			# 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
			mvn clean  install -DskipTests -Dplatform=linux-arm -Dmaven.javadoc.skip=true -P linux,arm -pl '!:nd4j-cuda-8.0,!:nd4j-cuda-8.0-platform,!:nd4j-tests'
	6. {In build machine } Copy following jars from the build machine :
		mkdir myjarFolder &&  \
		cp nd4j-backends/nd4j-backend-impls/nd4j-native/target/nd4j-native-<version>.jar\
		nd4j-backends/nd4j-backend-impls/nd4j-native/target/nd4j-native-<version>-linux-arm.jar \
		nd4j-backends/nd4j-backend-impls/nd4j-native-platform/target/nd4j-native-platform-<version>.jar\
		nd4j-backends/nd4j-api-parent/nd4j-api/target/nd4j-api-<version>.jar\
		nd4j-backends/nd4j-api-parent/nd4j-native-api/target/nd4j-native-api-<version>.jar \
		myjarFolder/
	7. {In build machine }install these jars in maven using :
		mvn install:install-file -Dfile=<path to myjarFolder>\nd4j-native-<version>.jar -DgroupId=org.nd4j -DartifactId=nd4j-native -Dversion=<version> -Dpackaging=jar -DgeneratePom=true
		mvn install:install-file -Dfile=<path to myjarFolder>\nd4j-native-<version>-linux-arm.jar -DgroupId=org.nd4j -DartifactId=nd4j-native -Dversion=<version> -Dpackaging=jar -DgeneratePom=true -Dclassifier=linux-arm
		mvn install:install-file -Dfile=<path to myjarFolder>\nd4j-api-<version>.jar -DgroupId=org.nd4j -DartifactId=nd4j-api -Dversion=<version> -Dpackaging=jar -DgeneratePom=true
		mvn install:install-file -Dfile=<path to myjarFolder>\nd4j-native-platform-<version>.jar -DgroupId=org.nd4j -DartifactId=nd4j-native-platform -Dversion=<version> -Dpackaging=jar -DgeneratePom=true
		mvn install:install-file -Dfile=<path to myjarFolder>\nd4j-native-api-<version>.jar -DgroupId=org.nd4j -DartifactId=nd4j-native-api -Dversion=<version> -Dpackaging=jar -DgeneratePom=true
		
	8. {In build machine } build the source of dependant appllication with above (step 7) dependencies.
	9. {In raspbian }copy the generated jar of dependant application to raspberry
	10. {In raspbian }download the libraries inside the folders of build machine nd4j-backends/nd4j-backend-impls/nd4j-native/target/classes/org/nd4j/nativeblas/linux-arm/  to a permanent folder (if possible to a system folder)
	11.{In raspbian }export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<the path to libraryy>
	12. {In raspbian }java -jar myjar.jar
@SusanBot

Build triggered. sha1 is merged.

@SusanBot

Build started sha1 is merged.

@SusanBot

Build finished. 869 tests run, 20 skipped, 6 failed.

@SusanBot

Refer to this link for build results (access rights to CI server needed):
/job/nd4j_PR/367/

Build result: FAILURE

[...truncated 2.85 MB...] at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404)Caused by: java.io.FileNotFoundException: https://api.github.com/repos/deeplearning4j/nd4j/statuses/4218062c234905e80a99c974518541c8386392bc at sun.reflect.GeneratedConstructorAccessor48.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) at org.kohsuke.github.Requester.parse(Requester.java:524) at org.kohsuke.github.Requester._to(Requester.java:251) ... 12 moreCaused by: java.io.FileNotFoundException: https://api.github.com/repos/deeplearning4j/nd4j/statuses/4218062c234905e80a99c974518541c8386392bc at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at org.kohsuke.github.Requester.parse(Requester.java:514) ... 13 more

@saudet
Member
saudet commented Nov 23, 2016

Thanks for the contribution! The same as with libnd4j, the instructions are bit more complicated than they need to be, but looks fine to me. And the same couple of things:

  • The previous content of the README.md file is gone: Please restore the old README.md file and put your content into a new .md file (RaspberryPi2.md?)
  • Instead of "rp2", could we use "linux-armhf" as the platform name to be consistent with the JavaCPP Presets? Accordingly please use "linux-armhf" instead of "linux-arm" for JavaCPP.
@SusanBot

Build triggered. sha1 is merged.

@SusanBot

Build started sha1 is merged.

@SusanBot

Build triggered. sha1 is merged.

@SusanBot

Build finished. 869 tests run, 20 skipped, 6 failed.

@SusanBot

Refer to this link for build results (access rights to CI server needed):
/job/nd4j_PR/368/

Build result: FAILURE

[...truncated 2.08 MB...] at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404)Caused by: java.io.FileNotFoundException: https://api.github.com/repos/deeplearning4j/nd4j/statuses/c7f6063f83fe8071a78f9760fe44b7a121cbe09f at sun.reflect.GeneratedConstructorAccessor48.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) at org.kohsuke.github.Requester.parse(Requester.java:524) at org.kohsuke.github.Requester._to(Requester.java:251) ... 12 moreCaused by: java.io.FileNotFoundException: https://api.github.com/repos/deeplearning4j/nd4j/statuses/c7f6063f83fe8071a78f9760fe44b7a121cbe09f at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at org.kohsuke.github.Requester.parse(Requester.java:514) ... 13 more

@SusanBot

Build started sha1 is merged.

@SusanBot

Build triggered. sha1 is merged.

@SusanBot

Build finished. 849 tests run, 20 skipped, 5 failed.

@SusanBot

Refer to this link for build results (access rights to CI server needed):
/job/nd4j_PR/369/

Build result: FAILURE

[...truncated 1.69 MB...] at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404)Caused by: java.io.FileNotFoundException: https://api.github.com/repos/deeplearning4j/nd4j/statuses/4d337bd984d20e50e9b54fb73bbf272317bc16a0 at sun.reflect.GeneratedConstructorAccessor48.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) at org.kohsuke.github.Requester.parse(Requester.java:524) at org.kohsuke.github.Requester._to(Requester.java:251) ... 12 moreCaused by: java.io.FileNotFoundException: https://api.github.com/repos/deeplearning4j/nd4j/statuses/4d337bd984d20e50e9b54fb73bbf272317bc16a0 at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at org.kohsuke.github.Requester.parse(Requester.java:514) ... 13 more

@SusanBot

Build started sha1 is merged.

@SusanBot

Build finished. 847 tests run, 20 skipped, 4 failed.

@SusanBot

Refer to this link for build results (access rights to CI server needed):
/job/nd4j_PR/371/

Build result: ABORTED

[...truncated 1.64 MB...] at hudson.model.Executor.run(Executor.java:404)Caused by: java.io.FileNotFoundException: https://api.github.com/repos/deeplearning4j/nd4j/statuses/1265d6f83db4f2129414d097ebf6a5e61afe9e0d at sun.reflect.GeneratedConstructorAccessor48.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890) at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) at org.kohsuke.github.Requester.parse(Requester.java:524) at org.kohsuke.github.Requester._to(Requester.java:251) ... 12 moreCaused by: java.io.FileNotFoundException: https://api.github.com/repos/deeplearning4j/nd4j/statuses/1265d6f83db4f2129414d097ebf6a5e61afe9e0d at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) at org.kohsuke.github.Requester.parse(Requester.java:514) ... 13 more[INFO] Final Memory: 53M/986M[INFO] ------------------------------------------------------------------------

@@ -43,6 +44,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-ppc64le}</classifier>
</dependency>
+ <dependency>
@saudet
saudet Nov 24, 2016 Member

Let's keep this in comment until we officially support this platform

pom.xml
@@ -261,8 +270,7 @@
<process-classes.skip> false</process-classes.skip> <!-- To skip native compilation phase: -Dprocess-classes.skip=true -->
<javacpp.platform>${os.name}-${os.arch}</javacpp.platform> <!-- For Android: -Dplatform=android-arm -->
<javacpp.platform.root /> <!-- -Dplatform.root=/path/to/android-ndk/ -->
- <javacpp.platform.compiler /> <!-- -Dplatform.compiler=/path/to/arm-linux-androideabi-g++ -->
@saudet
saudet Nov 24, 2016 Member

Not really important, but please fix the formatting while you're at it, such as here, but also in other places, replacing tab characters with an appropriate amount of spaces. Thanks!

@dschowta
dschowta Nov 24, 2016 Contributor

applied the changes

@saudet
saudet Nov 26, 2016 Member

Hum, formatting is still broken here?

@SusanBot

Build triggered. sha1 is merged.

@SusanBot

Build started sha1 is merged.

@SusanBot

Build finished. 1719 tests run, 39 skipped, 10 failed.

@SusanBot

Build triggered. sha1 is merged.

@SusanBot

Build started sha1 is merged.

@saudet saudet merged commit 752fe0c into deeplearning4j:master Nov 26, 2016
@SusanBot

Build finished. 1719 tests run, 39 skipped, 12 failed.

@SusanBot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment