From 4cbcace6aefebed98e10ca191670f50c69555531 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Fri, 22 Feb 2019 11:05:45 +0000
Subject: [PATCH] COB-49: added inter-node hello-world mpi test

---
 .gitattributes                                |  2 +
 .../mpi/mpi-hello-world-between-nodes.test    | 37 +++++++++++++++++++
 .../validation/cobalt/mpi/mpi-hello-world.c   |  1 +
 3 files changed, 40 insertions(+)
 create mode 100755 SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world-between-nodes.test
 create mode 120000 SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world.c

diff --git a/.gitattributes b/.gitattributes
index 8bd31d86729..d5d84364026 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -5551,6 +5551,8 @@ SubSystems/Online_Cobalt/validation/cep4/qpid/9315-no_auth.test -text
 SubSystems/Online_Cobalt/validation/cep4/slurm/available.test -text
 SubSystems/Online_Cobalt/validation/cep4/slurm/nhc.test -text
 SubSystems/Online_Cobalt/validation/cobalt/casacore/meastable.test eol=lf
+SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world-between-nodes.test eol=lf
+SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world.c -text
 SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-infiniband-between-nodes.test -text
 SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-to-all-nodes.test -text
 SubSystems/Online_Cobalt/validation/cobalt/network/resolvconf.test eol=lf
diff --git a/SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world-between-nodes.test b/SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world-between-nodes.test
new file mode 100755
index 00000000000..bd1ed1d4387
--- /dev/null
+++ b/SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world-between-nodes.test
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# this is a similar test as system/mpi/local-hello-world.test
+# but now we check the inter-cobalt-node basic mpi init/finalize functionality
+
+source $(dirname $0)/../../validation_utils.sh
+check_non_root_privileges
+
+# compile the simple mpi-hello-world
+mpicc $(readlink -f -n $(dirname $0))/mpi-hello-world.c -o /tmp/mpi-hello-world || exit 1
+
+# and copy it to all nodes
+for i in {201..213} ; do
+    NODE1=cbm$i.control.lofar
+    scp -q /tmp/mpi-hello-world $NODE1:/tmp/mpi-hello-world
+done
+
+
+EXIT_CODE=0
+
+# actual test over all node pairs
+for i in {201..213} ; do
+    NODE1=cbm$i.control.lofar
+    for j in {201..213} ; do
+        NODE2=cbm$j.control.lofar
+        RESULT=$(mpirun --tag-output -H $NODE1,$NODE2 /tmp/mpi-hello-world | sort | fgrep 'Hello world' | wc -l | grep '^2$')
+        if [ $? -eq 0 ] ; then
+            echo "mpirun hello-world works between $NODE1 and $NODE2"
+        else
+            echo "ERROR: mpirun hello-world failed between $NODE1 and $NODE2"
+            echo "$RESULT"
+            EXIT_CODE=1
+        fi
+    done
+done
+
+exit $EXIT_CODE
diff --git a/SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world.c b/SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world.c
new file mode 120000
index 00000000000..ad2d387cff2
--- /dev/null
+++ b/SubSystems/Online_Cobalt/validation/cobalt/mpi/mpi-hello-world.c
@@ -0,0 +1 @@
+../../system/mpi/mpi-hello-world.c
\ No newline at end of file
-- 
GitLab