diff --git a/Makefile b/Makefile index c6334fbd7103..cc7aebc9fb89 100644 --- a/Makefile +++ b/Makefile @@ -599,6 +599,13 @@ rpkg: mkdir -p R-package/inst/libs cp src/io/image_recordio.h R-package/src cp -rf lib/libmxnet.so R-package/inst/libs + + if [ -e "lib/libmkldnn.so.0" ]; then \ + cp -rf lib/libmkldnn.so.0 R-package/inst/libs; \ + cp -rf lib/libiomp5.so R-package/inst/libs; \ + cp -rf lib/libmklml_intel.so R-package/inst/libs; \ + fi + mkdir -p R-package/inst/include cp -rf include/* R-package/inst/include rm R-package/inst/include/dmlc diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index d97da64d9735..7820d3d02cdd 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -902,6 +902,36 @@ unittest_ubuntu_cpu_R() { make rpkgtest R_LIBS=/tmp/r-site-library } +unittest_ubuntu_minimal_R() { + set -ex + mkdir -p /tmp/r-site-library + # build R packages in parallel + mkdir -p ~/.R/ + build_ccache_wrappers + echo "MAKEFLAGS = -j"$(nproc) > ~/.R/Makevars + # make -j not supported + make rpkg \ + USE_BLAS=openblas \ + R_LIBS=/tmp/r-site-library + + R CMD INSTALL --library=/tmp/r-site-library R-package + # pick mlp as minimal R test + R_LIBS=/tmp/r-site-library \ + Rscript -e "library(mxnet); require(mlbench); \ + data(Sonar, package=\"mlbench\"); \ + Sonar[,61] = as.numeric(Sonar[,61])-1; \ + train.ind = c(1:50, 100:150); \ + train.x = data.matrix(Sonar[train.ind, 1:60]); \ + train.y = Sonar[train.ind, 61]; \ + test.x = data.matrix(Sonar[-train.ind, 1:60]); \ + test.y = Sonar[-train.ind, 61]; \ + model = mx.mlp(train.x, train.y, hidden_node = 10, \ + out_node = 2, out_activation = \"softmax\", \ + learning.rate = 0.1, \ + array.layout = \"rowmajor\"); \ + preds = predict(model, test.x, array.layout = \"rowmajor\")" +} + unittest_ubuntu_gpu_R() { set -ex mkdir -p /tmp/r-site-library diff --git a/ci/jenkins/Jenkins_steps.groovy b/ci/jenkins/Jenkins_steps.groovy index f1703ba8047a..5986eaf37ddc 100644 --- a/ci/jenkins/Jenkins_steps.groovy +++ b/ci/jenkins/Jenkins_steps.groovy @@ -927,6 +927,20 @@ def test_unix_r_cpu() { }] } +def test_unix_r_mkldnn_cpu() { + return ['R: MKLDNN-CPU': { + node(NODE_LINUX_CPU) { + ws('workspace/ut-r-mkldnn-cpu') { + timeout(time: max_time, unit: 'MINUTES') { + utils.unpack_and_init('mkldnn_cpu', mx_mkldnn_lib, true) + utils.docker_run('ubuntu_cpu', 'unittest_ubuntu_minimal_R', false) + utils.publish_test_coverage() + } + } + } + }] +} + def test_unix_perl_cpu() { return ['Perl: CPU': { node(NODE_LINUX_CPU) { diff --git a/ci/jenkins/Jenkinsfile_unix_cpu b/ci/jenkins/Jenkinsfile_unix_cpu index 234a65b3fac5..919381ebccd4 100644 --- a/ci/jenkins/Jenkinsfile_unix_cpu +++ b/ci/jenkins/Jenkinsfile_unix_cpu @@ -55,6 +55,7 @@ core_logic: { custom_steps.test_unix_clojure_integration_cpu(), custom_steps.test_unix_perl_cpu(), custom_steps.test_unix_r_cpu(), + custom_steps.test_unix_r_mkldnn_cpu(), custom_steps.test_unix_julia07_cpu(), custom_steps.test_unix_julia10_cpu(), custom_steps.test_unix_onnx_cpu(),