Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[MXNET-1232] fix demo and add Eclipse support #13979

Merged
merged 5 commits into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1241,15 +1241,15 @@ 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
}

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
}
Expand Down
13 changes: 10 additions & 3 deletions docs/install/java_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what directory? Is this known or should you mention it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is known, mvn command could only execute in a folder that has a pom file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also add one line to explain that

```
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:
Expand All @@ -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>
Expand Down
52 changes: 0 additions & 52 deletions scala-package/mxnet-demo/java-demo/Makefile

This file was deleted.

30 changes: 19 additions & 11 deletions scala-package/mxnet-demo/java-demo/README.md
Original file line number Diff line number Diff line change
@@ -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=
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a repeat of before... why is this here?
Also this is a conversion instruction not a "run" instruction as the title suggests. Maybe you can include some screenshots of how you open the project in eclipse and build it, etc...

Copy link
Member Author

@lanking520 lanking520 Jan 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specifically for users trying to use Eclipse in their demo project
The latter step will just be click Eclipse and click import...

```

## Q & A
Expand All @@ -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.
38 changes: 31 additions & 7 deletions scala-package/mxnet-demo/java-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will always pick the cpu artifact. The existing code allows one to pick up the gpu artifacts as well.

https://github.com/apache/incubator-mxnet/blob/master/scala-package/mxnet-demo/scala-demo/Makefile#L35

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to simplify the process, I decided to get rid of the makefile entirely. To address your concern, I add a noteline in the README to inform then using GPU to run

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. removing makefile was a good riddance :)

I'm fine with adding it to the README.

</properties>
</profile>
</profiles>

<repositories>
<repository>
Expand All @@ -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>
Expand Down
56 changes: 0 additions & 56 deletions scala-package/mxnet-demo/scala-demo/Makefile

This file was deleted.

21 changes: 11 additions & 10 deletions scala-package/mxnet-demo/scala-demo/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions scala-package/mxnet-demo/scala-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
lanking520 marked this conversation as resolved.
Show resolved Hide resolved
</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>
Expand Down