From 850efa4bcc30c8a5e55086bb6d325aea678430bd Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Tue, 5 Jan 2021 22:57:14 +0100
Subject: [PATCH] Replace mpiexec by `$mpiexec` in `eddy_graph.sh`

The command might be different than just mpiexec.
---
 Tests/short_tests.json | 63 ++++++++++++++++++++++++++++++++++++++++++
 eddy_graph_in.sh       |  2 +-
 2 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/Tests/short_tests.json b/Tests/short_tests.json
index dbf10437..a667dc7e 100644
--- a/Tests/short_tests.json
+++ b/Tests/short_tests.json
@@ -763,7 +763,10 @@
     {
         "input": "&MAIN_NML /\n",
         "title": "Eddy_graph",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_1/SHP_triplet_noise"
@@ -773,7 +776,10 @@
         "input": "&MAIN_NML /\n",
         "description": "Same as Eddy_graph but with 2 processes.",
         "title": "Eddy_graph_2",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "2",
             "$src_dir/Tests/Input/Region_1/SHP_triplet_noise"
@@ -783,7 +789,10 @@
         "input": "&MAIN_NML MAX_DELTA = 2 /\n",
         "description": "Same as Eddy_graph but with max_delta = 2.",
         "title": "Eddy_graph_md2",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_1/SHP_triplet_noise"
@@ -793,7 +802,10 @@
         "input": "&MAIN_NML n_dates = 4/\n",
         "description": "Eddy_graph with a larger region.",
         "title": "Eddy_graph_region_2",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -803,7 +815,10 @@
         "input": "&MAIN_NML n_dates = 4/\n",
         "description": "Same as Eddy_graph_region_2 but with 2 processes.",
         "title": "Eddy_graph_region_2_2",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "2",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -813,7 +828,10 @@
         "input": "&MAIN_NML n_dates = 4, max_delta = 2/\n",
         "description": "Same as Eddy_graph_region_2 but with max_delta = 2.",
         "title": "Eddy_graph_r2md2",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -823,7 +841,10 @@
         "input": "&MAIN_NML n_dates = 4, max_delta = 3/\n",
         "description": "Same as Eddy_graph_region_2 but with max_delta = 3.",
         "title": "Eddy_graph_r2md3",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -833,7 +854,10 @@
         "input": "&MAIN_NML n_dates = 5, max_delta = 3/\n",
         "description": "Same as Eddy_graph_r2md3 but with n_dates = 5.",
         "title": "Eddy_graph_r2nd5md3",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -843,7 +867,10 @@
         "input": "&MAIN_NML n_dates = 5, max_delta = 4/\n",
         "description": "Same as Eddy_graph_r2nd5md3 but with max_delta = 4.",
         "title": "EGr2nd5md4",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -853,7 +880,10 @@
         "input": "&MAIN_NML n_dates = 6, max_delta = 4/\n",
         "description": "Same as EGr2nd5md4 but with n_dates = 6.",
         "title": "EGr2nd6md4",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -863,7 +893,10 @@
         "input": "&MAIN_NML n_dates = 6/\n",
         "description": "Same as EGr2nd6md4 but with max_delta = 1.",
         "title": "EGr2nd6md1",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -873,7 +906,10 @@
         "input": "&MAIN_NML n_dates = 6/\n",
         "description": "Same as EGr2nd6md1 but with 2 processes.",
         "title": "EGr2nd6md1np2",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "2",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -883,7 +919,10 @@
         "input": "&MAIN_NML n_dates = 6/\n",
         "description": "Same as EGr2nd6md1 but with 3 processes.",
         "title": "EGr2nd6md1np3",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "3",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -893,7 +932,10 @@
         "input": "&MAIN_NML /\n",
         "description": "Same as EGr2nd6md1 but with all the 15 dates.",
         "title": "EGr2nd15md1",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -903,7 +945,10 @@
         "input": "&MAIN_NML max_delta = 2 /\n",
         "description": "Same as EGr2nd15md1 but with max_delta = 2.",
         "title": "EGr2nd15md2",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -913,7 +958,10 @@
         "input": "&MAIN_NML max_delta = 3 /\n",
         "description": "Same as EGr2nd15md1 but with max_delta = 3.",
         "title": "EGr2nd15md3",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -923,7 +971,10 @@
         "input": "&MAIN_NML max_delta = 4 /\n",
         "description": "Same as EGr2nd15md1 but with max_delta = 4.",
         "title": "EGr2nd15md4",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -933,7 +984,10 @@
         "input": "&MAIN_NML max_delta = 4 /\n",
         "description": "Same as EGr2nd15md4 but with 2 processes.",
         "title": "EGr2nd15md4np2",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "2",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -943,7 +997,10 @@
         "input": "&MAIN_NML max_delta = 4 /\n",
         "description": "Same as EGr2nd15md4 but with 3 processes.",
         "title": "EGr2nd15md4np3",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "3",
             "$src_dir/Tests/Input/Region_2/SHP_triplet"
@@ -953,7 +1010,10 @@
         "input": "&MAIN_NML max_delta = 4 /\n",
         "description": "Same as EGr2nd15md4 but with a larger region.",
         "title": "EGr5np1",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "1",
             "$large_input_dir/SHP_triplet_region_5"
@@ -963,7 +1023,10 @@
         "input": "&MAIN_NML max_delta = 4 /\n",
         "description": "Same as EGr5np1 but with 3 processes. We get a different numbering of interpolated eddies.",
         "title": "EGr5np3",
+        "stdout": "eddy_graph_stdout.txt",
         "command": [
+            "env",
+            "mpiexec=$mpiexec",
             "$build_dir/eddy_graph.sh",
             "3",
             "$large_input_dir/SHP_triplet_region_5"
diff --git a/eddy_graph_in.sh b/eddy_graph_in.sh
index 3f553e61..956dc6e3 100755
--- a/eddy_graph_in.sh
+++ b/eddy_graph_in.sh
@@ -17,7 +17,7 @@ do
     ((rank += 1))
 done
 
-mpiexec -n $1 @CMAKE_BINARY_DIR@/eddy_graph $2
+${mpiexec:-mpiexec} -n $1 @CMAKE_BINARY_DIR@/eddy_graph $2
 
 cat >number_eddies.csv <<EOF
  "date subscript" "number of visible extrema" "number of interpolated eddies" 
-- 
GitLab