You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by zh...@apache.org on 2017/12/25 20:49:24 UTC
[incubator-mxnet] branch master updated: Mkl fix pr (fix an issue
in prepare_mkl.sh and add test case) (#9153)
This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 3219620 Mkl fix pr (fix an issue in prepare_mkl.sh and add test case) (#9153)
3219620 is described below
commit 3219620874687f991e935def9b627f4fd0f3b3e2
Author: jinhuang415 <34...@users.noreply.github.com>
AuthorDate: Tue Dec 26 04:49:20 2017 +0800
Mkl fix pr (fix an issue in prepare_mkl.sh and add test case) (#9153)
* prepare_mkl.sh issue fix and add test case
* Fix test_mklml.py SA warning
* Add Jenkins test for MKLML and skip for non-linux OS
---
Jenkinsfile | 20 +++++++++++++++
prepare_mkl.sh | 2 +-
tests/python/cpu/test_mklml.py | 58 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 79 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 731e288..aee091f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -119,6 +119,22 @@ def python3_gpu_ut(docker_type) {
}
}
+// Python 2
+def python2_mklml_ut(docker_type) {
+ timeout(time: max_time, unit: 'MINUTES') {
+ sh "${docker_run} ${docker_type} find . -name '*.pyc' -type f -delete"
+ sh "${docker_run} ${docker_type} PYTHONPATH=./python/ nosetests-2.7 --with-timer --verbose tests/python/cpu"
+ }
+}
+
+// Python 3
+def python3_mklml_ut(docker_type) {
+ timeout(time: max_time, unit: 'MINUTES') {
+ sh "${docker_run} ${docker_type} find . -name '*.pyc' -type f -delete"
+ sh "${docker_run} ${docker_type} PYTHONPATH=./python/ nosetests-3.4 --with-timer --verbose tests/python/cpu"
+ }
+}
+
try {
stage("Sanity Check") {
timeout(time: max_time, unit: 'MINUTES') {
@@ -334,6 +350,7 @@ try {
init_git()
unpack_lib('mklml_cpu')
python2_ut('cpu_mklml')
+ python2_mklml_ut('cpu_mklml')
}
}
},
@@ -343,6 +360,7 @@ try {
init_git()
unpack_lib('mklml_gpu')
python2_gpu_ut('gpu_mklml')
+ python2_mklml_ut('gpu_mklml')
}
}
},
@@ -352,6 +370,7 @@ try {
init_git()
unpack_lib('mklml_cpu')
python3_ut('cpu_mklml')
+ python3_mklml_ut('cpu_mklml')
}
}
},
@@ -361,6 +380,7 @@ try {
init_git()
unpack_lib('mklml_gpu')
python3_gpu_ut('gpu_mklml')
+ python3_mklml_ut('gpu_mklml')
}
}
},
diff --git a/prepare_mkl.sh b/prepare_mkl.sh
index 97a1e49..e048f59 100755
--- a/prepare_mkl.sh
+++ b/prepare_mkl.sh
@@ -115,7 +115,7 @@ if [ -z $MKLROOT ]; then
fi
# Check what MKL lib we have in MKLROOT
-if [ -z `find $MKLROOT -name libmklml_gnu.so -o -name libmklml.dylib -print -quit` ]; then
+if [ -z `find $MKLROOT \( -name libmklml_gnu.so -o -name libmklml.dylib \) -print -quit` ]; then
USE_MKLML=0
elif [ -z `find $MKLROOT -name libmkl_core.so -print -quit` ]; then
USE_MKLML=1
diff --git a/tests/python/cpu/test_mklml.py b/tests/python/cpu/test_mklml.py
new file mode 100644
index 0000000..decd5b1
--- /dev/null
+++ b/tests/python/cpu/test_mklml.py
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+MKLML related test cases
+"""
+
+import logging
+import os
+from sys import platform
+
+def test_mklml_install():
+ """
+ This test will verify that MXNet is built/installed correctly when
+ compiled with Intel MKLML library. The method will try to import
+ the mxnet module and see if the mklml library is mapped to this
+ process's address space.
+ """
+ logging.basicConfig(level=logging.INFO)
+
+ if not platform.startswith('linux'):
+ logging.info("Bypass mklml install test for non-Linux OS")
+ return
+
+ try:
+ #pylint: disable=unused-variable
+ import mxnet as mx
+ except (ImportError, OSError) as e:
+ assert 0, "Import mxnet error: %s. Please double check your build/" \
+ "install steps or environment variable settings" % str(e)
+
+ pid = os.getpid()
+ rc = os.system("cat /proc/" + str(pid) + \
+ "/maps | grep libmklml_ > /dev/null")
+
+ if rc == 0:
+ logging.info("MXNet is built/installed correctly with MKLML")
+ else:
+ assert 0, "MXNet is built/installed incorrectly with MKLML, please " \
+ "double check your build/install steps or environment " \
+ "variable settings"
+
+if __name__ == '__main__':
+ test_mklml_install()
--
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].