-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[MXNET-1224]: improve scala maven jni build. #13493
Conversation
@frankfliu could you please explain what you intend to do. |
@mxnet-label-bot add [Scala, pr-work-in-progress] |
@nswamy this PR is intended to drop the requirement to have @frankfliu could you please check if you have the link for |
8b99ff3
to
abfd430
Compare
<compilerEndOption>-I${project.basedir}/../../../include</compilerEndOption> | ||
<compilerEndOption>${all_includes}</compilerEndOption> | ||
<compilerEndOption>${cflags}</compilerEndOption> | ||
<compilerEndOption>-I${MXNET_DIR}/include</compilerEndOption> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the C_FLAGS and LD_FLAGS defined and passed from the Makefile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I really like these changes!
scala-package/pom.xml
Outdated
@@ -39,6 +39,8 @@ | |||
<scala.version>2.11.8</scala.version> | |||
<scala.binary.version>2.11</scala.binary.version> | |||
<build.platform /> | |||
<cxx>g++</cxx> | |||
<dollor>$</dollor> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be dollar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, will fix this in next PR with maven build improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contributions @frankfliu !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @frankfliu I am still not confident to merge this PR, could you please provide a short README in the Scala package explains the backend build procedure:
-
- the reason you set these dependencies and why we limited to only dlmc, mshadow, dlpack? If I want to build with MKLDNN what will happen?
-
- Structure of the result jar file
<compilerEndOption>-I${MXNET_DIR}/3rdparty/dlpack/include</compilerEndOption> | ||
<compilerEndOption>-I${MXNET_DIR}/3rdparty/tvm/nnvm/include</compilerEndOption> | ||
<compilerEndOption>-DMSHADOW_USE_MKL=0 -DMSHADOW_USE_CUDA=0</compilerEndOption> | ||
<compilerEndOption>-g -O0 -fPIC -msse3 -mf16c</compilerEndOption> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we are using these build options? What are these for?
<compilerEndOption>-I${MXNET_DIR}/3rdparty/mshadow</compilerEndOption> | ||
<compilerEndOption>-I${MXNET_DIR}/3rdparty/dlpack/include</compilerEndOption> | ||
<compilerEndOption>-I${MXNET_DIR}/3rdparty/tvm/nnvm/include</compilerEndOption> | ||
<compilerEndOption>-DMSHADOW_USE_MKL=0 -DMSHADOW_USE_CUDA=0</compilerEndOption> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we make them =0, if we build with GPU what will happened?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a README.md file to describe compiler and linker flags.
@marcoabreu looks like the CI passed however not reflect on this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the readme and that make things clear! LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readme is super useful!
Thanks @frankfliu
* upstream/master: (38 commits) Feature/mkldnn static (apache#13628) Fix the bug of BidirectionalCell (apache#13575) Set install path for libmxnet.so dynamic lib on Mac OS (apache#13629) add batch norm test (apache#13625) Scripts for building dependency libraries of MXNet (apache#13282) fix quantize pass error when the quantization supported Op are excluded in the model (apache#13596) Optimize C++ API (apache#13496) Fix warning in waitall doc (apache#13618) [MXNET-1225] Always use config.mk in make install instructions (apache#13364) [MXNET-1224]: improve scala maven jni build and packing. (apache#13493) [MXNET-1155] Add scala packageTest utility (apache#13046) fix the Float not showing correctly problem (apache#13617) apache#13385 [Clojure] - Turn examples into integration tests (apache#13554) Add Intel MKL blas to Jenkins (apache#13607) Revert "[MXNET-1198] MXNet Java API (apache#13162)" Reducing the length of setup tutorial (apache#13306) [MXNET-1182] Predictor example (apache#13237) [MXNET-1187] Added Java SSD Inference Tutorial for website (apache#13201) add defaults and clean up the tests (apache#13295) [MXNET-1181] Added command line alternative to IntelliJ in install instructions (apache#13267) ...
Major JNI feature changes. Please find more info here: https://cwiki.apache.org/confluence/display/MXNET/Scala+maven+build+improvement
Major JNI feature changes. Please find more info here: https://cwiki.apache.org/confluence/display/MXNET/Scala+maven+build+improvement
Major JNI feature changes. Please find more info here: https://cwiki.apache.org/confluence/display/MXNET/Scala+maven+build+improvement
Major JNI feature changes. Please find more info here: https://cwiki.apache.org/confluence/display/MXNET/Scala+maven+build+improvement
Major JNI feature changes. Please find more info here: https://cwiki.apache.org/confluence/display/MXNET/Scala+maven+build+improvement
Description
Scala jni shared library requires compile flags inherited from make. But there is no way to enforce those flags to be the same as libmxnet.so was built. And current Scala package is built is manually. This is error prone can has caused issues in past.
This fix is trying make scala jni library not depends on any mxnet build flags, and dynamically link libmxnet.so directly. libmxnet-scala.so file will be compiled dynamically link to libmxnet.so, and allows load libmxnet.so from the same directory. Scala code is also updated to extract libmxnet.so file into temp folder and load it temp folder.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.