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

Commit

Permalink
[MXNET-531] Integration Test for Scala (#11596)
Browse files Browse the repository at this point in the history
* Separate unit test and integration tests for Scala
  • Loading branch information
lanking520 authored and nswamy committed Jul 12, 2018
1 parent ea24c1c commit b786ead
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 30 deletions.
24 changes: 12 additions & 12 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -712,18 +712,6 @@ try {
}
}
},
'Scala: GPU': {
node('mxnetlinux-gpu') {
ws('workspace/ut-scala-gpu') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
unpack_lib('gpu', mx_dist_lib)
docker_run('ubuntu_gpu', 'unittest_ubuntu_gpu_scala', true)
publish_test_coverage()
}
}
}
},
'Clojure: CPU': {
node('mxnetlinux-cpu') {
ws('workspace/ut-clojure-cpu') {
Expand Down Expand Up @@ -979,6 +967,18 @@ try {
}
}
}
},
'Scala: GPU': {
node('mxnetlinux-gpu') {
ws('workspace/ut-scala-gpu') {
timeout(time: max_time, unit: 'MINUTES') {
init_git()
unpack_lib('gpu', mx_dist_lib)
docker_run('ubuntu_gpu', 'integrationtest_ubuntu_gpu_scala', true)
publish_test_coverage()
}
}
}
}
// Disable until fixed https://github.com/apache/incubator-mxnet/issues/11441
// 'dist-kvstore tests GPU': {
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,15 @@ scalapkg:
-Dcurrent_libdir="$(ROOTDIR)/lib" \
-Dlddeps="$(LIB_DEP) $(ROOTDIR)/lib/libmxnet.a")

scalatest:
scalaunittest:
(cd $(ROOTDIR)/scala-package; \
mvn verify -P$(SCALA_PKG_PROFILE),$(SCALA_VERSION_PROFILE) -Dcxx="$(CXX)" \
mvn integration-test -P$(SCALA_PKG_PROFILE),$(SCALA_VERSION_PROFILE),unittest -Dcxx="$(CXX)" \
-Dcflags="$(CFLAGS)" -Dldflags="$(LDFLAGS)" \
-Dlddeps="$(LIB_DEP) $(ROOTDIR)/lib/libmxnet.a" $(SCALA_TEST_ARGS))

scalaintegrationtest:
(cd $(ROOTDIR)/scala-package; \
mvn integration-test -P$(SCALA_PKG_PROFILE),$(SCALA_VERSION_PROFILE),integrationtest -Dcxx="$(CXX)" \
-Dcflags="$(CFLAGS)" -Dldflags="$(LDFLAGS)" \
-Dlddeps="$(LIB_DEP) $(ROOTDIR)/lib/libmxnet.a" $(SCALA_TEST_ARGS))

Expand Down
14 changes: 7 additions & 7 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,7 @@ unittest_ubuntu_python3_quantization_gpu() {
unittest_ubuntu_cpu_scala() {
set -ex
make scalapkg USE_BLAS=openblas USE_DIST_KVSTORE=1
make scalatest USE_BLAS=openblas USE_DIST_KVSTORE=1
}

unittest_ubuntu_gpu_scala() {
set -ex
make scalapkg USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 USE_DIST_KVSTORE=1 SCALA_ON_GPU=1
make scalatest USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 SCALA_TEST_ON_GPU=1 USE_DIST_KVSTORE=1
make scalaunittest USE_BLAS=openblas USE_DIST_KVSTORE=1
}

unittest_ubuntu_cpu_clojure() {
Expand Down Expand Up @@ -724,6 +718,12 @@ integrationtest_ubuntu_gpu_cpp_package() {
cpp-package/tests/ci_test.sh
}

integrationtest_ubuntu_gpu_scala() {
set -ex
make scalapkg USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 USE_DIST_KVSTORE=1 SCALA_ON_GPU=1
make scalaintegrationtest USE_OPENCV=1 USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1 SCALA_TEST_ON_GPU=1 USE_DIST_KVSTORE=1
}

integrationtest_ubuntu_gpu_dist_kvstore() {
set -ex
export PYTHONPATH=./python/
Expand Down
5 changes: 3 additions & 2 deletions scala-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ make scalapkg
(Optional) run unit/integration tests by

```bash
make scalatest
make scalaunittest
make scalaintegrationtest
```

Or run a subset of unit tests by, e.g.,

```bash
make SCALA_TEST_ARGS=-Dsuites=org.apache.mxnet.NDArraySuite scalatest
make SCALA_TEST_ARGS=-Dsuites=org.apache.mxnet.NDArraySuite scalaunittest
```

If everything goes well, you will find jars for `assembly`, `core` and `example` modules.
Expand Down
14 changes: 14 additions & 0 deletions scala-package/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
<name>MXNet Scala Package - Core</name>

<profiles>
<profile>
<id>unittest</id>
<properties>
<skiptest>false</skiptest>
</properties>
</profile>
<profile>
<id>integrationtest</id>
<properties>
<skiptest>true</skiptest>
</properties>
</profile>
<profile>
<id>osx-x86_64-cpu</id>
<properties>
Expand Down Expand Up @@ -55,6 +67,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<skipTests>${skiptest}</skipTests>
<argLine>
-Djava.library.path=${project.parent.basedir}/native/${platform}/target \
-Dlog4j.configuration=file://${project.basedir}/src/test/resources/log4j.properties
Expand All @@ -74,6 +87,7 @@
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<skip>${skiptest}</skip>
</configuration>
<executions>
<execution>
Expand Down
13 changes: 13 additions & 0 deletions scala-package/examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
<name>MXNet Scala Package - Examples</name>

<profiles>
<profile>
<id>unittest</id>
<properties>
<skiptest>true</skiptest>
</properties>
</profile>
<profile>
<id>integrationtest</id>
<properties>
<skiptest>false</skiptest>
</properties>
</profile>
<profile>
<id>osx-x86_64-cpu</id>
<properties>
Expand Down Expand Up @@ -129,6 +141,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<skipTests>${skiptest}</skipTests>
<argLine>
-Djava.library.path=${project.parent.basedir}/native/${platform}/target \
-Dlog4j.configuration=file://${project.basedir}/src/test/resources/log4j.properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ class MNISTExampleSuite extends FunSuite with BeforeAndAfterAll {
private val logger = LoggerFactory.getLogger(classOf[MNISTExampleSuite])

test("Example CI: Test MNIST Training") {
// This test is CPU only
if (System.getenv().containsKey("SCALA_TEST_ON_GPU") &&
System.getenv("SCALA_TEST_ON_GPU").toInt == 1) {
logger.info("CPU test only, skipped...")
} else {

logger.info("Downloading mnist model")
val baseUrl = "https://s3.us-east-2.amazonaws.com/mxnet-scala/scala-example-ci"
val tempDirPath = System.getProperty("java.io.tmpdir")
Expand All @@ -60,7 +56,5 @@ class MNISTExampleSuite extends FunSuite with BeforeAndAfterAll {
Process("rm -rf " + modelDirPath) !

assert(output >= 0.95f)
}

}
}
13 changes: 13 additions & 0 deletions scala-package/infer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
<name>MXNet Scala Package - Inference</name>

<profiles>
<profile>
<id>unittest</id>
<properties>
<skiptest>false</skiptest>
</properties>
</profile>
<profile>
<id>integrationtest</id>
<properties>
<skiptest>true</skiptest>
</properties>
</profile>
<profile>
<id>osx-x86_64-cpu</id>
<properties>
Expand Down Expand Up @@ -55,6 +67,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<skipTests>${skiptest}</skipTests>
<argLine>
-Djava.library.path=${project.parent.basedir}/native/${platform}/target \
-Dlog4j.configuration=file://${project.basedir}/src/test/resources/log4j.properties
Expand Down
13 changes: 13 additions & 0 deletions scala-package/macros/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
<name>MXNet Scala Package - Macros</name>

<profiles>
<profile>
<id>unittest</id>
<properties>
<skiptest>false</skiptest>
</properties>
</profile>
<profile>
<id>integrationtest</id>
<properties>
<skiptest>true</skiptest>
</properties>
</profile>
<profile>
<id>osx-x86_64-cpu</id>
<properties>
Expand Down Expand Up @@ -103,6 +115,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<skipTests>${skiptest}</skipTests>
<environmentVariables>
<MXNET_BASEDIR>${project.parent.basedir}/init-native</MXNET_BASEDIR>
</environmentVariables>
Expand Down

0 comments on commit b786ead

Please sign in to comment.