You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by la...@apache.org on 2019/01/28 21:34:57 UTC
[incubator-mxnet] branch master updated: [MXNET-1232] fix demo and
add Eclipse support (#13979)
This is an automated email from the ASF dual-hosted git repository.
lanking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new c4080de [MXNET-1232] fix demo and add Eclipse support (#13979)
c4080de is described below
commit c4080def0ef36b4f69ae0927b31ced6dcba6f9df
Author: Lanking <la...@live.com>
AuthorDate: Mon Jan 28 13:34:40 2019 -0800
[MXNET-1232] fix demo and add Eclipse support (#13979)
* fix demo and add Eclipse support
* fix on docs
* fix typo
* Update docs/install/java_setup.md
Co-Authored-By: lanking520 <la...@live.com>
* add fixes in docs
---
ci/docker/runtime_functions.sh | 4 +-
docs/install/java_setup.md | 13 +++++--
scala-package/mxnet-demo/java-demo/Makefile | 52 -------------------------
scala-package/mxnet-demo/java-demo/README.md | 30 ++++++++------
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 | 21 +++++-----
scala-package/mxnet-demo/scala-demo/pom.xml | 25 ++++++++++++
8 files changed, 98 insertions(+), 141 deletions(-)
diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh
index f763137..d97da64 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 0075e92..ea4bb50 100644
--- a/docs/install/java_setup.md
+++ b/docs/install/java_setup.md
@@ -85,6 +85,13 @@ 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).
<hr>
+### Eclipse IDE Support
+You can convert your existing Maven project to a project that can run in Eclipse by:
+```
+mvn eclipse:eclipse
+```
+This can be done once you have your maven project properly configured.
+
## Source
The previously mentioned setup with Maven is recommended. Otherwise, the following instructions for macOS and Ubuntu are provided for reference only:
@@ -99,11 +106,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` folder:
```
-make scalapkg
-make scalainstall
+mvn package
+mvn install
```
This will install both the Java Inference API and the required MXNet-Scala package.
<hr>
diff --git a/scala-package/mxnet-demo/java-demo/Makefile b/scala-package/mxnet-demo/java-demo/Makefile
deleted file mode 100644
index 3811d75..0000000
--- 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 73e9284..5dfbf14 100644
--- a/scala-package/mxnet-demo/java-demo/README.md
+++ b/scala-package/mxnet-demo/java-demo/README.md
@@ -1,16 +1,18 @@
# 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
+You are required to use Maven to build the package with the following commands:
+```
+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](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=
@@ -71,9 +73,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
+```
+
+## Convert to Eclipse project (Optional)
+You can convert the maven project to the eclipse one by running the following command:
+```
+mvn eclipse:eclipse
```
## Q & A
@@ -87,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 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 [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/java-demo/pom.xml b/scala-package/mxnet-demo/java-demo/pom.xml
index b7502a6..05d04b9 100644
--- a/scala-package/mxnet-demo/java-demo/pom.xml
+++ b/scala-package/mxnet-demo/java-demo/pom.xml
@@ -8,6 +8,13 @@
<version>1.0-SNAPSHOT</version>
<name>MXNet Java Demo</name>
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <mxnet.version>[1.5.0-SNAPSHOT, )</mxnet.version>
+ <mxnet.scalaprofile>2.11</mxnet.scalaprofile>
+ </properties>
+
<profiles>
<profile>
<id>ci-nightly</id>
@@ -21,7 +28,30 @@
<mxnet.version>[1.5.0-SNAPSHOT, )</mxnet.version>
</properties>
</profile>
- </profiles>
+ <profile>
+ <id>osx-x86_64</id>
+ <activation>
+ <os>
+ <family>mac</family>
+ </os>
+ </activation>
+ <properties>
+ <mxnet.profile>osx-x86_64-cpu</mxnet.profile>
+ </properties>
+ </profile>
+ <profile>
+ <id>linux-x86_64</id>
+ <activation>
+ <os>
+ <family>unix</family>
+ <name>Linux</name>
+ </os>
+ </activation>
+ <properties>
+ <mxnet.profile>linux-x86_64-cpu</mxnet.profile>
+ </properties>
+ </profile>
+ </profiles>
<repositories>
<repository>
@@ -30,12 +60,6 @@
</repository>
</repositories>
- <properties>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- <mxnet.version>[1.5.0-SNAPSHOT, )</mxnet.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.mxnet</groupId>
diff --git a/scala-package/mxnet-demo/scala-demo/Makefile b/scala-package/mxnet-demo/scala-demo/Makefile
deleted file mode 100644
index 9f7f284..0000000
--- 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 1cc5a6d..b994a19 100644
--- a/scala-package/mxnet-demo/scala-demo/README.md
+++ b/scala-package/mxnet-demo/scala-demo/README.md
@@ -1,7 +1,15 @@
# 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,
+You are required to use maven to build the package, by running the following:
+```
+mvn package
+```
+This command will pick the default values specified in the pom file.
+
+Note: If you are planning to use GPU, please add `-Dmxnet.profile=linux-x86_64-gpu`
+
+### Use customized version set
which are shown below:
```Bash
export SCALA_VERSION_PROFILE=2.11 SCALA_VERSION=2.11.8
@@ -14,13 +22,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 +55,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:
+To clean up a Maven package, run the following:
```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 1d89f97..37d60d1 100644
--- a/scala-package/mxnet-demo/scala-demo/pom.xml
+++ b/scala-package/mxnet-demo/scala-demo/pom.xml
@@ -22,10 +22,35 @@
<mxnet.version>[1.5.0-SNAPSHOT, )</mxnet.version>
</properties>
</profile>
+ <profile>
+ <id>osx-x86_64</id>
+ <activation>
+ <os>
+ <family>mac</family>
+ </os>
+ </activation>
+ <properties>
+ <mxnet.profile>osx-x86_64-cpu</mxnet.profile>
+ </properties>
+ </profile>
+ <profile>
+ <id>linux-x86_64</id>
+ <activation>
+ <os>
+ <family>unix</family>
+ <name>Linux</name>
+ </os>
+ </activation>
+ <properties>
+ <mxnet.profile>linux-x86_64-cpu</mxnet.profile>
+ </properties>
+ </profile>
</profiles>
<properties>
+ <mxnet.scalaprofile>2.11</mxnet.scalaprofile>
<mxnet.version>[1.3.1, )</mxnet.version>
+ <scala.version>2.11.8</scala.version>
</properties>
<dependencies>