From 2844bcc04aefc3d212b0c659b7dca367746e2b1d Mon Sep 17 00:00:00 2001 From: Qing Date: Wed, 23 Jan 2019 16:41:54 -0800 Subject: [PATCH 1/5] fix demo and add Eclipse support --- ci/docker/runtime_functions.sh | 4 +- docs/install/java_setup.md | 12 +++- scala-package/mxnet-demo/java-demo/Makefile | 52 ----------------- scala-package/mxnet-demo/java-demo/README.md | 24 +++++--- scala-package/mxnet-demo/java-demo/pom.xml | 38 ++++++++++--- scala-package/mxnet-demo/scala-demo/Makefile | 56 ------------------- scala-package/mxnet-demo/scala-demo/README.md | 19 +++---- scala-package/mxnet-demo/scala-demo/pom.xml | 25 +++++++++ 8 files changed, 91 insertions(+), 139 deletions(-) delete mode 100644 scala-package/mxnet-demo/java-demo/Makefile delete mode 100644 scala-package/mxnet-demo/scala-demo/Makefile diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index f7631374a638..d97da64d9735 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -1241,7 +1241,7 @@ nightly_tutorial_test_ubuntu_python2_gpu() { nightly_java_demo_test_cpu() { set -ex cd /work/mxnet/scala-package/mxnet-demo/java-demo - make java_ci_demo + mvn -Pci-nightly install bash bin/java_sample.sh bash bin/run_od.sh } @@ -1249,7 +1249,7 @@ nightly_java_demo_test_cpu() { nightly_scala_demo_test_cpu() { set -ex cd /work/mxnet/scala-package/mxnet-demo/scala-demo - make scala_ci_demo + mvn -Pci-nightly install bash bin/demo.sh bash bin/run_im.sh } diff --git a/docs/install/java_setup.md b/docs/install/java_setup.md index 0075e9205880..2b97c6e41186 100644 --- a/docs/install/java_setup.md +++ b/docs/install/java_setup.md @@ -85,6 +85,12 @@ Also, add the dependency which corresponds to your platform to the `dependencies The official Java Packages will be released with the release of MXNet 1.4 and will be available on [MXNet Maven package repository](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.mxnet%22).
+### Eclipse IDE Support +You can easily convert your maven project to Eclipse project by doing: +``` +mvn eclipse:eclipse +``` + ## Source The previously mentioned setup with Maven is recommended. Otherwise, the following instructions for macOS and Ubuntu are provided for reference only: @@ -99,11 +105,11 @@ The previously mentioned setup with Maven is recommended. Otherwise, the followi #### Build Java from an Existing MXNet Installation -If you have already built MXNet **from source** and are looking to setup Java from that point, you may simply run the following from the MXNet source root: +If you have already built MXNet **from source** and are looking to setup Java from that point, you may simply run the following from the MXNet `scala-package`: ``` -make scalapkg -make scalainstall +mvn package +mvn install ``` This will install both the Java Inference API and the required MXNet-Scala package.
diff --git a/scala-package/mxnet-demo/java-demo/Makefile b/scala-package/mxnet-demo/java-demo/Makefile deleted file mode 100644 index 3811d75d2091..000000000000 --- a/scala-package/mxnet-demo/java-demo/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -SCALA_VERSION_PROFILE := 2.11 - -ifeq ($(OS),Windows_NT) - UNAME_S := Windows -else - UNAME_S := $(shell uname -s) -endif - -ifeq ($(UNAME_S), Windows) - # TODO: currently scala package does not support windows - SCALA_PKG_PROFILE := windows -else - ifeq ($(UNAME_S), Darwin) - SCALA_PKG_PROFILE := osx-x86_64-cpu - else - SCALA_PKG_PROFILE := linux-x86_64 - ifeq ($(USE_CUDA), 1) - SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-gpu - else - SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-cpu - endif - endif -endif - -javademo: - (mvn install -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ - -Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE)) - -java_ci_demo: - (mvn -Pci-nightly install -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ - -Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE)) - -javaclean: - (mvn clean -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ - -Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE)) diff --git a/scala-package/mxnet-demo/java-demo/README.md b/scala-package/mxnet-demo/java-demo/README.md index 73e9284a96ef..8f0398cf4961 100644 --- a/scala-package/mxnet-demo/java-demo/README.md +++ b/scala-package/mxnet-demo/java-demo/README.md @@ -1,13 +1,13 @@ # MXNet Java Sample Project This is an project created to use Maven-published Scala/Java package with two Java examples. ## Setup -You can use the `Makefile` to make the Java package. Simply do the following: -```Bash -make javademo +User are required to use maven to build the package, by simply run +``` +mvn package ``` -This will load the default parameter for all the environment variable. -If you want to run with GPU on Linux, just simply add `USE_CUDA=1` when you run the make file - +This command will pick the default values specified in the pom file. + +### Use customized version set You can use the following instruction as an alternative to achieve the same result: User are required to use `mvn package` to build the package, which are shown below: @@ -71,9 +71,15 @@ If you want to test run on GPU, you can set a environment variable as follows: export SCALA_TEST_ON_GPU=1 ``` ## Clean up -Clean up for Maven package is simple, you can run the pre-configed `Makefile` as: +Clean up for Maven package is simple: ```Bash -make javaclean +mvn clean +``` + +## Run in Eclipse +You can convert the maven project to the eclipse one by simply do: +``` +mvn eclipse:eclipse ``` ## Q & A @@ -87,4 +93,4 @@ sudo apt install libopencv-imgcodecs3.4 Is there any other version available? You can find nightly release version from [here](https://repository.apache.org/#nexus-search;gav~org.apache.mxnet~~1.5.0-SNAPSHOT~~). -Please keep the same version in the Makefile or [above version](https://repository.apache.org/#nexus-search;gav~org.apache.mxnet~~~~) to run this demo. +Please keep the same version in the pom file or [above version](https://repository.apache.org/#nexus-search;gav~org.apache.mxnet~~~~) to run this demo. \ No newline at end of file diff --git a/scala-package/mxnet-demo/java-demo/pom.xml b/scala-package/mxnet-demo/java-demo/pom.xml index b7502a66c511..05d04b9e6c14 100644 --- a/scala-package/mxnet-demo/java-demo/pom.xml +++ b/scala-package/mxnet-demo/java-demo/pom.xml @@ -8,6 +8,13 @@ 1.0-SNAPSHOT MXNet Java Demo + + 1.8 + 1.8 + [1.5.0-SNAPSHOT, ) + 2.11 + + ci-nightly @@ -21,7 +28,30 @@ [1.5.0-SNAPSHOT, ) - + + osx-x86_64 + + + mac + + + + osx-x86_64-cpu + + + + linux-x86_64 + + + unix + Linux + + + + linux-x86_64-cpu + + + @@ -30,12 +60,6 @@ - - 1.8 - 1.8 - [1.5.0-SNAPSHOT, ) - - org.apache.mxnet diff --git a/scala-package/mxnet-demo/scala-demo/Makefile b/scala-package/mxnet-demo/scala-demo/Makefile deleted file mode 100644 index 9f7f2840e9a4..000000000000 --- a/scala-package/mxnet-demo/scala-demo/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -SCALA_VERSION_PROFILE := 2.11 -SCALA_VERSION := 2.11.8 - -ifeq ($(OS),Windows_NT) - UNAME_S := Windows -else - UNAME_S := $(shell uname -s) -endif - -ifeq ($(UNAME_S), Windows) - # TODO: currently scala package does not support windows - SCALA_PKG_PROFILE := windows -else - ifeq ($(UNAME_S), Darwin) - SCALA_PKG_PROFILE := osx-x86_64-cpu - else - SCALA_PKG_PROFILE := linux-x86_64 - ifeq ($(USE_CUDA), 1) - SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-gpu - else - SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-cpu - endif - endif -endif - -scalademo: - (mvn package -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ - -Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \ - -Dscala.version=$(SCALA_VERSION)) - -scala_ci_demo: - (mvn -Pci-nightly package -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ - -Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \ - -Dscala.version=$(SCALA_VERSION)) - -scalaclean: - (mvn clean -Dmxnet.profile=$(SCALA_PKG_PROFILE) \ - -Dmxnet.scalaprofile=$(SCALA_VERSION_PROFILE) \ - -Dscala.version=$(SCALA_VERSION)) \ No newline at end of file diff --git a/scala-package/mxnet-demo/scala-demo/README.md b/scala-package/mxnet-demo/scala-demo/README.md index 1cc5a6d42b95..5bf531ee5926 100644 --- a/scala-package/mxnet-demo/scala-demo/README.md +++ b/scala-package/mxnet-demo/scala-demo/README.md @@ -1,7 +1,13 @@ # MXNet Scala Sample Project This is an project created to use Maven-published Scala package with two Scala examples. ## Setup -User are required to use `mvn package` to build the package, +User are required to use maven to build the package, by simply run +``` +mvn package +``` +This command will pick the default values specified in the pom file. + +### Use customized version set which are shown below: ```Bash export SCALA_VERSION_PROFILE=2.11 SCALA_VERSION=2.11.8 @@ -14,13 +20,6 @@ These environment variable (`SCALA_PKG_PROFILE`, `SCALA_VERSION_PROFILE`, `SCALA should be set before executing the line above. To obtain the most recent MXNet version, please click [here](https://mvnrepository.com/search?q=org.apache.mxnet) - -You can also use the `Makefile` as an alternative to do the same thing. Simply do the following: -```Bash -make scalademo -``` -This will load the default parameter for all the environment variable. - If you want to run with GPU on Linux, just simply add `USE_CUDA=1` when you run the make file ## Run ### Hello World @@ -54,9 +53,9 @@ If you want to test run on GPU, you can set a environment variable as follows: export SCALA_TEST_ON_GPU=1 ``` ## Clean up -Clean up for Maven package is simple, you can run the pre-configed `Makefile` as: +Clean up for Maven package is simple, you can just run ```Bash -make scalaclean +mvn clean ``` ## Q & A diff --git a/scala-package/mxnet-demo/scala-demo/pom.xml b/scala-package/mxnet-demo/scala-demo/pom.xml index 1d89f97655d2..37d60d133c31 100644 --- a/scala-package/mxnet-demo/scala-demo/pom.xml +++ b/scala-package/mxnet-demo/scala-demo/pom.xml @@ -22,10 +22,35 @@ [1.5.0-SNAPSHOT, ) + + osx-x86_64 + + + mac + + + + osx-x86_64-cpu + + + + linux-x86_64 + + + unix + Linux + + + + linux-x86_64-cpu + + + 2.11 [1.3.1, ) + 2.11.8 From 215b480acdd69ecbc19e2f86e9c007d886a71c4b Mon Sep 17 00:00:00 2001 From: Qing Date: Thu, 24 Jan 2019 15:45:50 -0800 Subject: [PATCH 2/5] fix on docs --- docs/install/java_setup.md | 2 +- scala-package/mxnet-demo/java-demo/README.md | 6 ++++-- scala-package/mxnet-demo/scala-demo/README.md | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/install/java_setup.md b/docs/install/java_setup.md index 2b97c6e41186..1866555303ac 100644 --- a/docs/install/java_setup.md +++ b/docs/install/java_setup.md @@ -86,7 +86,7 @@ The official Java Packages will be released with the release of MXNet 1.4 and wi
### Eclipse IDE Support -You can easily convert your maven project to Eclipse project by doing: +You can easily convert you existing maven project to a project that can run in Eclipse by: ``` mvn eclipse:eclipse ``` diff --git a/scala-package/mxnet-demo/java-demo/README.md b/scala-package/mxnet-demo/java-demo/README.md index 8f0398cf4961..2b14ccd29de2 100644 --- a/scala-package/mxnet-demo/java-demo/README.md +++ b/scala-package/mxnet-demo/java-demo/README.md @@ -1,12 +1,14 @@ # MXNet Java Sample Project This is an project created to use Maven-published Scala/Java package with two Java examples. ## Setup -User are required to use maven to build the package, by simply run +User are required to use maven to build the package, by simply running ``` mvn package ``` This command will pick the default values specified in the pom file. +Note: If you are planning to use GPU, please add `-DSCALA_PKG_PROFILE=linux-x86_64-gpu` + ### Use customized version set You can use the following instruction as an alternative to achieve the same result: User are required to use `mvn package` to build the package, @@ -77,7 +79,7 @@ mvn clean ``` ## Run in Eclipse -You can convert the maven project to the eclipse one by simply do: +You can convert the maven project to the eclipse one by running ``` mvn eclipse:eclipse ``` diff --git a/scala-package/mxnet-demo/scala-demo/README.md b/scala-package/mxnet-demo/scala-demo/README.md index 5bf531ee5926..03615ec77339 100644 --- a/scala-package/mxnet-demo/scala-demo/README.md +++ b/scala-package/mxnet-demo/scala-demo/README.md @@ -1,12 +1,14 @@ # MXNet Scala Sample Project This is an project created to use Maven-published Scala package with two Scala examples. ## Setup -User are required to use maven to build the package, by simply run +User are required to use maven to build the package, by simply running ``` mvn package ``` This command will pick the default values specified in the pom file. +Note: If you are planning to use GPU, please add `-DSCALA_PKG_PROFILE=linux-x86_64-gpu` + ### Use customized version set which are shown below: ```Bash From de39a15e26bbbd012e1f97bdcb559648ba0c0181 Mon Sep 17 00:00:00 2001 From: Qing Date: Thu, 24 Jan 2019 15:50:47 -0800 Subject: [PATCH 3/5] fix typo --- scala-package/mxnet-demo/java-demo/README.md | 2 +- scala-package/mxnet-demo/scala-demo/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scala-package/mxnet-demo/java-demo/README.md b/scala-package/mxnet-demo/java-demo/README.md index 2b14ccd29de2..d8ca33dc8af6 100644 --- a/scala-package/mxnet-demo/java-demo/README.md +++ b/scala-package/mxnet-demo/java-demo/README.md @@ -7,7 +7,7 @@ mvn package ``` This command will pick the default values specified in the pom file. -Note: If you are planning to use GPU, please add `-DSCALA_PKG_PROFILE=linux-x86_64-gpu` +Note: If you are planning to use GPU, please add `-Dmxnet.profile=linux-x86_64-gpu` ### Use customized version set You can use the following instruction as an alternative to achieve the same result: diff --git a/scala-package/mxnet-demo/scala-demo/README.md b/scala-package/mxnet-demo/scala-demo/README.md index 03615ec77339..c072181d5954 100644 --- a/scala-package/mxnet-demo/scala-demo/README.md +++ b/scala-package/mxnet-demo/scala-demo/README.md @@ -7,7 +7,7 @@ mvn package ``` This command will pick the default values specified in the pom file. -Note: If you are planning to use GPU, please add `-DSCALA_PKG_PROFILE=linux-x86_64-gpu` +Note: If you are planning to use GPU, please add `-Dmxnet.profile=linux-x86_64-gpu` ### Use customized version set which are shown below: From 9021880c57048b55e6295c93d331043a7cf64ebc Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Thu, 24 Jan 2019 16:44:59 -0800 Subject: [PATCH 4/5] Update docs/install/java_setup.md Co-Authored-By: lanking520 --- docs/install/java_setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install/java_setup.md b/docs/install/java_setup.md index 1866555303ac..9c83bb79fc48 100644 --- a/docs/install/java_setup.md +++ b/docs/install/java_setup.md @@ -86,7 +86,7 @@ The official Java Packages will be released with the release of MXNet 1.4 and wi
### Eclipse IDE Support -You can easily convert you existing maven project to a project that can run in Eclipse by: +You can convert your existing Maven project to a project that can run in Eclipse by: ``` mvn eclipse:eclipse ``` From 447b821bbc463ead0a265ca5d3acc18f0a82cc55 Mon Sep 17 00:00:00 2001 From: Qing Date: Fri, 25 Jan 2019 10:59:34 -0800 Subject: [PATCH 5/5] add fixes in docs --- docs/install/java_setup.md | 3 ++- scala-package/mxnet-demo/java-demo/README.md | 14 +++++++------- scala-package/mxnet-demo/scala-demo/README.md | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/install/java_setup.md b/docs/install/java_setup.md index 9c83bb79fc48..ea4bb50329e8 100644 --- a/docs/install/java_setup.md +++ b/docs/install/java_setup.md @@ -90,6 +90,7 @@ You can convert your existing Maven project to a project that can run in Eclipse ``` mvn eclipse:eclipse ``` +This can be done once you have your maven project properly configured. ## Source @@ -105,7 +106,7 @@ The previously mentioned setup with Maven is recommended. Otherwise, the followi #### Build Java from an Existing MXNet Installation -If you have already built MXNet **from source** and are looking to setup Java from that point, you may simply run the following from the MXNet `scala-package`: +If you have already built MXNet **from source** and are looking to setup Java from that point, you may simply run the following from the MXNet `scala-package` folder: ``` mvn package diff --git a/scala-package/mxnet-demo/java-demo/README.md b/scala-package/mxnet-demo/java-demo/README.md index d8ca33dc8af6..5dfbf14e8df2 100644 --- a/scala-package/mxnet-demo/java-demo/README.md +++ b/scala-package/mxnet-demo/java-demo/README.md @@ -1,18 +1,18 @@ # MXNet Java Sample Project This is an project created to use Maven-published Scala/Java package with two Java examples. ## Setup -User are required to use maven to build the package, by simply running +You are required to use Maven to build the package with the following commands: ``` mvn package ``` -This command will pick the default values specified in the pom file. +This command will pick the default values specified in the [pom](https://github.com/apache/incubator-mxnet/blob/master/scala-package/mxnet-demo/java-demo/pom.xml) file. Note: If you are planning to use GPU, please add `-Dmxnet.profile=linux-x86_64-gpu` ### Use customized version set You can use the following instruction as an alternative to achieve the same result: -User are required to use `mvn package` to build the package, - which are shown below: +You may use `mvn package` to build the package, +using the following commands: ```Bash export SCALA_VERSION_PROFILE=2.11 export SCALA_PKG_PROFILE= @@ -78,8 +78,8 @@ Clean up for Maven package is simple: mvn clean ``` -## Run in Eclipse -You can convert the maven project to the eclipse one by running +## Convert to Eclipse project (Optional) +You can convert the maven project to the eclipse one by running the following command: ``` mvn eclipse:eclipse ``` @@ -95,4 +95,4 @@ sudo apt install libopencv-imgcodecs3.4 Is there any other version available? You can find nightly release version from [here](https://repository.apache.org/#nexus-search;gav~org.apache.mxnet~~1.5.0-SNAPSHOT~~). -Please keep the same version in the pom file or [above version](https://repository.apache.org/#nexus-search;gav~org.apache.mxnet~~~~) to run this demo. \ No newline at end of file +Please keep the same version in the pom file or [other versions in here](https://repository.apache.org/#nexus-search;gav~org.apache.mxnet~~~~) to run this demo. \ No newline at end of file diff --git a/scala-package/mxnet-demo/scala-demo/README.md b/scala-package/mxnet-demo/scala-demo/README.md index c072181d5954..b994a196b1f6 100644 --- a/scala-package/mxnet-demo/scala-demo/README.md +++ b/scala-package/mxnet-demo/scala-demo/README.md @@ -1,7 +1,7 @@ # MXNet Scala Sample Project This is an project created to use Maven-published Scala package with two Scala examples. ## Setup -User are required to use maven to build the package, by simply running +You are required to use maven to build the package, by running the following: ``` mvn package ``` @@ -55,7 +55,7 @@ If you want to test run on GPU, you can set a environment variable as follows: export SCALA_TEST_ON_GPU=1 ``` ## Clean up -Clean up for Maven package is simple, you can just run +To clean up a Maven package, run the following: ```Bash mvn clean ```