Skip to content

Commit

Permalink
Merge pull request #1 from yanqingmen/scala
Browse files Browse the repository at this point in the history
add maven settings for linux
  • Loading branch information
yanqingmen committed Dec 16, 2015
2 parents 721cb54 + c5a358a commit cd471ba
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ mxnet-scala/src_managed/
mxnet-scala/project/boot/
mxnet-scala/project/plugins/project/

#scala target folders
scala-package/*/target/
scala-package/*/*/target/

# IDE specific
mxnet-scala/.scala_dependencies
mxnet-scala/.worksheet
Expand Down
6 changes: 6 additions & 0 deletions scala-package/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
<platform>osx-x86_64</platform>
</properties>
</profile>
<profile>
<id>Linux</id>
<properties>
<platform>linux-x86_64</platform>
</properties>
</profile>
</profiles>

<build>
Expand Down
107 changes: 107 additions & 0 deletions scala-package/native/linux-x86_64/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<project>

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ml.dmlc.mxnet</groupId>
<artifactId>mxnet-scala-native-parent</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>

<groupId>ml.dmlc.mxnet</groupId>
<artifactId>libmxnet-scala</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>MXNet Scala Package - Native Linux-x86_64</name>
<url>http://maven.apache.org</url>

<packaging>so</packaging>

<dependencies>
<dependency>
<groupId>ml.dmlc.mxnet</groupId>
<artifactId>mxnet-scala-core</artifactId>
<version>0.1-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<!-- trigger javah -->
<javahOS>linux</javahOS>
<compilerProvider>generic-classic</compilerProvider>
<compilerExecutable>g++</compilerExecutable>
<linkerExecutable>g++</linkerExecutable>
<sources>
<source>
<directory>../src/main/native</directory>
<fileNames>
<fileName>ml_dmlc_mxnet_native_c_api.c</fileName>
</fileNames>
</source>
</sources>
<compilerStartOptions>
<compilerStartOption>-std=c++0x</compilerStartOption>
</compilerStartOptions>
<compilerMiddleOptions>
<compilerMiddleOption>
-msse3 -funroll-loops -Wno-unused-parameter -Wno-unknown-pragmas
</compilerMiddleOption>
</compilerMiddleOptions>
<compilerEndOptions>
<compilerEndOption>-I../../../include/mxnet</compilerEndOption>
<compilerEndOption>-fPIC</compilerEndOption>
</compilerEndOptions>
<linkerStartOptions>
<linkerStartOption>-shared</linkerStartOption>
</linkerStartOptions>
<linkerMiddleOptions>
<linkerMiddleOption>
-fopenmp
</linkerMiddleOption>
<linkerMiddleOption>-Wl,--whole-archive</linkerMiddleOption>
<linkerMiddleOption>../../../lib/libmxnet.a</linkerMiddleOption>
<linkerMiddleOption>-Wl,-no-whole-archive</linkerMiddleOption>
<!--
<linkerMiddleOption>
-pthread -lm -lblas -lrt -fopenmp
</linkerMiddleOption>
<linkerMiddleOption>-Wl,-exported_symbol,_Java_*</linkerMiddleOption>
<linkerMiddleOption>-Wl,-x</linkerMiddleOption>
-->
</linkerMiddleOptions>
</configuration>

<executions>
<execution>
<id>javah</id>
<phase>generate-sources</phase>
<configuration>
<javahOS>linux</javahOS>
<javahProvider>default</javahProvider>
<javahOutputDirectory>${project.build.directory}/custom-javah</javahOutputDirectory>
<workingDirectory>${basedir}</workingDirectory>
<javahOutputFileName>ml_dmlc_mxnet_native_c_api.h</javahOutputFileName>
<javahClassNames>
<javahClassName>ml.dmlc.mxnet.LibInfo</javahClassName>
</javahClassNames>
</configuration>
<goals>
<goal>javah</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions scala-package/native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<arch>x64</arch>
</os>
</activation>
<modules>
<module>linux-x86_64</module>
</modules>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <jni.h>
#include "ml_dmlc_mxnet_native_c_api.h" // generated by javah
#include "c_api.h"
Expand Down
2 changes: 2 additions & 0 deletions scala-package/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@
we have to compile all the modules first.
Run in this way:
mvn clean package -P osx-x86_64 && mvn integration-test -P osx-x86_64
for linux:
mvn clean package -P Linux && mvn integration-test -P Linux
This is a temporary solution. -->
<phase>integration-test</phase>
<goals>
Expand Down

0 comments on commit cd471ba

Please sign in to comment.