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

Commit

Permalink
Support mkldnn for Scala.
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu committed Jan 8, 2019
1 parent 9723454 commit b8e16e4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
6 changes: 5 additions & 1 deletion scala-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Or run a subset of unit tests, for e.g.,

```bash
cd scala-package
mvn -DSCALA_TEST_ARGS=-Dsuites=org.apache.mxnet.NDArraySuite integration-test
mvn -Dsuites=org.apache.mxnet.NDArraySuite integration-test
```

If everything goes well, you will find jars for `assembly`, `core` and `example` modules.
Expand Down Expand Up @@ -196,3 +196,7 @@ More details about JVM Memory Management are available [here](https://github.com
License
-------
MXNet Scala Package is licensed under [Apache-2](https://github.com/apache/incubator-mxnet/blob/master/scala-package/LICENSE) license.

MXNet uses some 3rd party softwares. Following 3rd party license files are bundled inside Scala jar file:
* cub/LICENSE.TXT
* mkldnn/external/mklml_mac_2019.0.1.20180928/license.txt
14 changes: 14 additions & 0 deletions scala-package/assembly/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,22 @@
<include>libmxnet.so</include>
<include>libgfortran.so.3</include>
<include>libquadmath.so.0</include>
<include>libiomp5.so</include>
<include>libiomp5.dylib</include>
<include>libmklml_intel.so</include>
<include>libmklml.dylib</include>
<include>libmkldnn.so.0</include>
<include>libmkldnn.0.dylib</include>
</includes>
<outputDirectory>lib/native</outputDirectory>
</fileSet>
<fileSet>
<directory>${MXNET_DIR}/3rdparty</directory>
<includes>
<include>cub/LICENSE.TXT</include>
<include>mkldnn/external/mklml_mac_2019.0.1.20180928/license.txt</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ private[mxnet] object NativeLibraryLoader {
saveLibraryToTemp("libmxnet.so", "/lib/native/libmxnet.so", true)
saveLibraryToTemp("libgfortran.so.3", "/lib/native/libgfortran.so.3", false)
saveLibraryToTemp("libquadmath.so.0", "/lib/native/libquadmath.so.0", false)
saveLibraryToTemp("libiomp5.so", "/lib/native/libiomp5.so", false)
saveLibraryToTemp("libiomp5.dylib", "/lib/native/libiomp5.dylib", false)
saveLibraryToTemp("libmklml_intel.so", "/lib/native/libmklml_intel.so", false)
saveLibraryToTemp("libmklml.dylib", "/lib/native/libmklml.dylib", false)
saveLibraryToTemp("libmkldnn.so.0", "/lib/native/libmkldnn.so.0", false)
saveLibraryToTemp("libmkldnn.0.dylib", "/lib/native/libmkldnn.0.dylib", false)
val tempfile: File = saveLibraryToTemp(libname, libFileInJar, true)

loadLibraryFromFile(libname, tempfile)
Expand Down
2 changes: 1 addition & 1 deletion scala-package/init-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
</goals>
<configuration>
<executable>bash</executable>
<commandlineArgs>-c 'ln -sf ${MXNET_DIR}/lib/libmxnet.so ${project.build.directory}/libmxnet.so; ln -sf ${MXNET_DIR}/lib/libgfortran.so.3 ${project.build.directory}/libgfortran.so.3; ln -sf ${MXNET_DIR}/lib/libquadmath.so.0 ${project.build.directory}/libquadmath.so.0'</commandlineArgs>
<commandlineArgs>-c 'ln -sf ${MXNET_DIR}/lib/* ${project.build.directory}/'</commandlineArgs>
</configuration>
</execution>
</executions>
Expand Down
2 changes: 1 addition & 1 deletion scala-package/native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
</goals>
<configuration>
<executable>bash</executable>
<commandlineArgs>-c 'ln -sf ${MXNET_DIR}/lib/libmxnet.so ${project.build.directory}/libmxnet.so; ln -sf ${MXNET_DIR}/lib/libgfortran.so.3 ${project.build.directory}/libgfortran.so.3; ln -sf ${MXNET_DIR}/lib/libquadmath.so.0 ${project.build.directory}/libquadmath.so.0'</commandlineArgs>
<commandlineArgs>-c 'ln -sf ${MXNET_DIR}/lib/* ${project.build.directory}/'</commandlineArgs>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit b8e16e4

Please sign in to comment.