You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by lx...@apache.org on 2017/08/04 18:57:34 UTC
[incubator-mxnet] branch master updated: Attempting to add Perl
interface to Apache CI. (#7170)
This is an automated email from the ASF dual-hosted git repository.
lxn2 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 b230d17 Attempting to add Perl interface to Apache CI. (#7170)
b230d17 is described below
commit b230d1745fd8e5b01c9c741d9567e5561ea538cc
Author: Sergey Kolychev <se...@gmail.com>
AuthorDate: Fri Aug 4 11:57:31 2017 -0700
Attempting to add Perl interface to Apache CI. (#7170)
* attempting to add Perl interface to Apache CI.
* second attempt.
* forgot the test file.
* changed the working dir for tests, removed test that started to fail because upstream bug.
---
Jenkinsfile | 22 ++++++++++
perl-package/AI-MXNet/t/test_model_parallel.t | 62 ---------------------------
perl-package/test.sh | 16 +++++++
tests/ci_build/Dockerfile.cpu | 2 +
tests/ci_build/Dockerfile.gpu | 2 +
tests/ci_build/install/ubuntu_install_perl.sh | 4 ++
6 files changed, 46 insertions(+), 62 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e48ecf2..b3bf826 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -281,6 +281,28 @@ try {
}
}
},
+ 'Perl: CPU': {
+ node('mxnetlinux') {
+ ws('workspace/ut-perl-cpu') {
+ init_git()
+ unpack_lib('cpu')
+ timeout(time: max_time, unit: 'MINUTES') {
+ sh "${docker_run} cpu ./perl-package/test.sh /workspace/ut-perl-cpu /workspace/ut-perl-cpu"
+ }
+ }
+ }
+ },
+ 'Perl: GPU': {
+ node('mxnetlinux') {
+ ws('workspace/ut-perl-gpu') {
+ init_git()
+ unpack_lib('gpu')
+ timeout(time: max_time, unit: 'MINUTES') {
+ sh "${docker_run} gpu ./perl-package/test.sh /workspace/ut-perl-gpu /workspace/ut-perl-gpu"
+ }
+ }
+ }
+ },
'R: CPU': {
node('mxnetlinux') {
ws('workspace/ut-r-cpu') {
diff --git a/perl-package/AI-MXNet/t/test_model_parallel.t b/perl-package/AI-MXNet/t/test_model_parallel.t
deleted file mode 100644
index e20b208..0000000
--- a/perl-package/AI-MXNet/t/test_model_parallel.t
+++ /dev/null
@@ -1,62 +0,0 @@
-use strict;
-use warnings;
-use Test::More tests => 3;
-use AI::MXNet qw(mx);
-use AI::MXNet::TestUtils qw(reldiff);
-use AI::MXNet::Base;
-
-sub test_chain
-{
- my $n = 2;
- my $data1 = mx->sym->Variable('data1');
- my $data2 = mx->sym->Variable('data2');
- my $net;
- {
- local($mx::AttrScope) = mx->AttrScope(ctx_group=>'dev1');
- $net = $data1 + $data2;
- $net = $net * 3;
- }
-
- {
- local($mx::AttrScope) = mx->AttrScope(ctx_group=>'dev2');
- $net = $net + $data1;
- }
- my $arr;
- my $arr_grad;
- my $shape = [4, 5];
- {
- local($mx::Context) = mx->Context(mx->cpu(0));
- $arr = [map { mx->nd->empty($shape) } 0..$n-1];
- $arr_grad = [map { mx->nd->empty($shape) } 0..$n-1];
- }
-
- my $exec1 = $net->bind(
- ctx => mx->cpu(),
- args => $arr,
- args_grad => $arr_grad,
- group2ctx => { dev1 => mx->cpu(0), dev2 => mx->cpu(1) }
- );
- $arr->[0] .= 1;
- $arr->[1] .= 2;
- my $arr2 = [map { $_->copyto(mx->cpu()) } @$arr];
- my $arr_grad2 = [map { $_->copyto(mx->cpu()) } @$arr_grad];
- my $exec2 = $net->bind(
- ctx => mx->cpu(),
- args => $arr2,
- args_grad => $arr_grad2
- );
-
- $exec1->forward(1);
- $exec2->forward(1);
- ok(reldiff($exec1->outputs->[0]->aspdl, $exec2->outputs->[0]->aspdl) < 1e-6);
- my $out_grad = mx->nd->empty($shape, ctx => mx->cpu(1));
- $out_grad .= 1;
- $exec1->backward([$out_grad]);
- $exec2->backward([$out_grad->copyto(mx->cpu())]);
- zip(sub {
- my ($a, $b) = @_;
- ok(reldiff($a->aspdl, $b->aspdl) < 1e-6);
- }, $arr_grad, $arr_grad2);
-}
-
-test_chain();
diff --git a/perl-package/test.sh b/perl-package/test.sh
new file mode 100755
index 0000000..c83120f
--- /dev/null
+++ b/perl-package/test.sh
@@ -0,0 +1,16 @@
+MXNET_HOME=$1
+HOME=$2
+export LD_LIBRARY_PATH=${MXNET_HOME}/lib
+export PERL5LIB=${HOME}/perl5/lib/perl5
+
+cd ${MXNET_HOME}/perl-package/AI-MXNetCAPI/
+perl Makefile.PL INSTALL_BASE=${HOME}/perl5
+make install || exit -1
+
+cd ${MXNET_HOME}/perl-package/AI-NNVMCAPI/
+perl Makefile.PL INSTALL_BASE=${HOME}/perl5
+make install || exit -1
+
+cd ${MXNET_HOME}/perl-package/AI-MXNet/
+perl Makefile.PL INSTALL_BASE=${HOME}/perl5
+make test || exit -1
diff --git a/tests/ci_build/Dockerfile.cpu b/tests/ci_build/Dockerfile.cpu
index c9ba57c..c7bb0af 100644
--- a/tests/ci_build/Dockerfile.cpu
+++ b/tests/ci_build/Dockerfile.cpu
@@ -8,3 +8,5 @@ COPY install/ubuntu_install_scala.sh /install/
RUN /install/ubuntu_install_scala.sh
COPY install/ubuntu_install_r.sh /install/
RUN /install/ubuntu_install_r.sh
+COPY install/ubuntu_install_perl.sh /install/
+RUN /install/ubuntu_install_perl.sh
diff --git a/tests/ci_build/Dockerfile.gpu b/tests/ci_build/Dockerfile.gpu
index cd9986e..a2893a9 100644
--- a/tests/ci_build/Dockerfile.gpu
+++ b/tests/ci_build/Dockerfile.gpu
@@ -8,3 +8,5 @@ COPY install/ubuntu_install_scala.sh /install/
RUN /install/ubuntu_install_scala.sh
COPY install/ubuntu_install_r.sh /install/
RUN /install/ubuntu_install_r.sh
+COPY install/ubuntu_install_perl.sh /install/
+RUN /install/ubuntu_install_perl.sh
diff --git a/tests/ci_build/install/ubuntu_install_perl.sh b/tests/ci_build/install/ubuntu_install_perl.sh
new file mode 100755
index 0000000..da4df67
--- /dev/null
+++ b/tests/ci_build/install/ubuntu_install_perl.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+# install libraries for mxnet's perl package on ubuntu
+apt-get update && apt-get install -y libmouse-perl pdl cpanminus swig libgraphviz-perl
+cpanm -q Function::Parameters
--
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].