From 637d54420047972de33ee6b8604afd4c621213a2 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Tue, 25 Feb 2025 07:19:02 -0700 Subject: [PATCH 1/6] expand existing ex testing Signed-off-by: Jade Abraham --- util/cron/test-hpe-cray-ex-ofi.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/cron/test-hpe-cray-ex-ofi.bash b/util/cron/test-hpe-cray-ex-ofi.bash index a06d7ec4531f..2eacb08a39f6 100755 --- a/util/cron/test-hpe-cray-ex-ofi.bash +++ b/util/cron/test-hpe-cray-ex-ofi.bash @@ -11,4 +11,9 @@ export CHPL_NIGHTLY_TEST_CONFIG_NAME="hpe-cray-ex-ofi" export CHPL_RT_COMM_OFI_EXPECTED_PROVIDER="cxi" export CHPL_RT_MAX_HEAP_SIZE=16g -$UTIL_CRON_DIR/nightly -cron -examples -blog ${nightly_args} + +# test a small subset of all tests due to limited resources +# ideally, we should run the whole suite +export CHPL_NIGHTLY_TEST_DIRS="release/examples/ runtime/configMatters/ test/multilocale" + +$UTIL_CRON_DIR/nightly -cron -blog ${nightly_args} From 711171485d3ae6fb0f971ade808a8a3b9985ec61 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Tue, 25 Feb 2025 07:19:19 -0700 Subject: [PATCH 2/6] add a slurm hello world that uses sbatch Signed-off-by: Jade Abraham --- test/runtime/configMatters/launch/slurm/hello.chpl | 5 +++++ test/runtime/configMatters/launch/slurm/hello.execenv | 3 +++ test/runtime/configMatters/launch/slurm/hello.good | 4 ++++ test/runtime/configMatters/launch/slurm/hello.numlocales | 1 + 4 files changed, 13 insertions(+) create mode 100644 test/runtime/configMatters/launch/slurm/hello.chpl create mode 100644 test/runtime/configMatters/launch/slurm/hello.execenv create mode 100644 test/runtime/configMatters/launch/slurm/hello.good create mode 100644 test/runtime/configMatters/launch/slurm/hello.numlocales diff --git a/test/runtime/configMatters/launch/slurm/hello.chpl b/test/runtime/configMatters/launch/slurm/hello.chpl new file mode 100644 index 000000000000..4a6918716042 --- /dev/null +++ b/test/runtime/configMatters/launch/slurm/hello.chpl @@ -0,0 +1,5 @@ +config const numTasks = 2; +for l in Locales do + on l do + for tid in 0..#numTasks do + writeln("Hello from task", tid, "on locale", here.id, sep=" "); diff --git a/test/runtime/configMatters/launch/slurm/hello.execenv b/test/runtime/configMatters/launch/slurm/hello.execenv new file mode 100644 index 000000000000..e4128b2b9cf7 --- /dev/null +++ b/test/runtime/configMatters/launch/slurm/hello.execenv @@ -0,0 +1,3 @@ +# for slurm launchers, use sbatch +# otherwise, setting this environment variable should do nothing +CHPL_LAUNCHER_USE_SBATCH=1 diff --git a/test/runtime/configMatters/launch/slurm/hello.good b/test/runtime/configMatters/launch/slurm/hello.good new file mode 100644 index 000000000000..109c88964be9 --- /dev/null +++ b/test/runtime/configMatters/launch/slurm/hello.good @@ -0,0 +1,4 @@ +Hello from task 0 on locale 0 +Hello from task 1 on locale 0 +Hello from task 0 on locale 1 +Hello from task 1 on locale 1 diff --git a/test/runtime/configMatters/launch/slurm/hello.numlocales b/test/runtime/configMatters/launch/slurm/hello.numlocales new file mode 100644 index 000000000000..0cfbf08886fc --- /dev/null +++ b/test/runtime/configMatters/launch/slurm/hello.numlocales @@ -0,0 +1 @@ +2 From d1a27059c9aeb37ebe3d799347c927dd1f4c7fe4 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Tue, 25 Feb 2025 07:48:16 -0700 Subject: [PATCH 3/6] fix CHPL_NIGHTLY_TEST_DIRS Signed-off-by: Jade Abraham --- util/cron/test-hpe-cray-ex-ofi.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/cron/test-hpe-cray-ex-ofi.bash b/util/cron/test-hpe-cray-ex-ofi.bash index 2eacb08a39f6..d2c2ef28c459 100755 --- a/util/cron/test-hpe-cray-ex-ofi.bash +++ b/util/cron/test-hpe-cray-ex-ofi.bash @@ -14,6 +14,6 @@ export CHPL_RT_MAX_HEAP_SIZE=16g # test a small subset of all tests due to limited resources # ideally, we should run the whole suite -export CHPL_NIGHTLY_TEST_DIRS="release/examples/ runtime/configMatters/ test/multilocale" +export CHPL_NIGHTLY_TEST_DIRS="release/examples/ runtime/configMatters/ multilocale/" $UTIL_CRON_DIR/nightly -cron -blog ${nightly_args} From 84d4b514eea4b1540ddc01a5b87c35dad12b2628 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Tue, 25 Feb 2025 08:58:55 -0700 Subject: [PATCH 4/6] use sub_test to invoke launchcmd Signed-off-by: Jade Abraham --- .../runtime/configMatters/launch/slurm.skipif | 9 +++ .../configMatters/launch/slurm/hello.execenv | 3 - .../configMatters/launch/slurm/hello.notest | 1 + .../launch/slurm/hello.numlocales | 1 - .../configMatters/launch/slurm/sub_test | 59 +++++++++++++++++++ 5 files changed, 69 insertions(+), 4 deletions(-) create mode 100755 test/runtime/configMatters/launch/slurm.skipif delete mode 100644 test/runtime/configMatters/launch/slurm/hello.execenv create mode 100644 test/runtime/configMatters/launch/slurm/hello.notest delete mode 100644 test/runtime/configMatters/launch/slurm/hello.numlocales create mode 100755 test/runtime/configMatters/launch/slurm/sub_test diff --git a/test/runtime/configMatters/launch/slurm.skipif b/test/runtime/configMatters/launch/slurm.skipif new file mode 100755 index 000000000000..38a2a26c2c93 --- /dev/null +++ b/test/runtime/configMatters/launch/slurm.skipif @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import os + +launcher = os.getenv('CHPL_LAUNCHER', 'none') +if 'slurm' not in launcher: + print("True") +else: + print("False") diff --git a/test/runtime/configMatters/launch/slurm/hello.execenv b/test/runtime/configMatters/launch/slurm/hello.execenv deleted file mode 100644 index e4128b2b9cf7..000000000000 --- a/test/runtime/configMatters/launch/slurm/hello.execenv +++ /dev/null @@ -1,3 +0,0 @@ -# for slurm launchers, use sbatch -# otherwise, setting this environment variable should do nothing -CHPL_LAUNCHER_USE_SBATCH=1 diff --git a/test/runtime/configMatters/launch/slurm/hello.notest b/test/runtime/configMatters/launch/slurm/hello.notest new file mode 100644 index 000000000000..4078374a8f55 --- /dev/null +++ b/test/runtime/configMatters/launch/slurm/hello.notest @@ -0,0 +1 @@ +Tested by the sub_test script diff --git a/test/runtime/configMatters/launch/slurm/hello.numlocales b/test/runtime/configMatters/launch/slurm/hello.numlocales deleted file mode 100644 index 0cfbf08886fc..000000000000 --- a/test/runtime/configMatters/launch/slurm/hello.numlocales +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/runtime/configMatters/launch/slurm/sub_test b/test/runtime/configMatters/launch/slurm/sub_test new file mode 100755 index 000000000000..840c1bf238e3 --- /dev/null +++ b/test/runtime/configMatters/launch/slurm/sub_test @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + +import os +import subprocess as sp +import sys + +def main(): + print("[Starting subtest]") + d = os.path.dirname(os.path.abspath(__file__)) + chpl_home = os.getenv("CHPL_HOME") + if chpl_home is None: + print("[Error: CHPL_HOME not set]") + sys.exit(1) + + # force this test to use sbatch + os.environ["CHPL_LAUNCHER_USE_SBATCH"] = "true" + + # compile hello.chpl and run it using chpl_launchcmd + ret = sp.call(["chpl", "-o", "hello", "hello.chpl"]) + if ret != 0: + print("[Error compiling hello.chpl]") + sys.exit(1) + + launchcmd = os.path.join(chpl_home, "util", "test", "chpl_launchcmd.py") + outfile = os.path.join(d, "hello.exec.tmp") + with open(outfile, "w") as f: + ret = sp.call([launchcmd, "./hello", "-nl2"], stdout=f, stderr=sp.STDOUT) + if ret != 0: + print("[Error running hello.chpl]") + sys.exit(1) + + # check that the output is as expected + goodfile = os.path.join(d, "hello.good") + ret = sp.call(["diff", goodfile, outfile]) + if ret != 0: + print("[Error matching good file]") + sys.exit(1) + + print("[Success matching hello.chpl output]") + + print("[Finished subtest {}]".format(d)) + +def cleanup(ret): + def rm(file): + try: + os.unlink(file) + except: + pass + + rm("hello") + # only delete good file on success + if ret == 0: + rm("hello.exec.tmp") + +if __name__ == "__main__": + ret = main() + cleanup(ret) + + sys.exit(ret) From 62a299b6792a5068e8a4b547cf70cca898484a8a Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Tue, 25 Feb 2025 09:02:10 -0700 Subject: [PATCH 5/6] dont rely on path Signed-off-by: Jade Abraham --- test/runtime/configMatters/launch/slurm/sub_test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/runtime/configMatters/launch/slurm/sub_test b/test/runtime/configMatters/launch/slurm/sub_test index 840c1bf238e3..a0c24f60783e 100755 --- a/test/runtime/configMatters/launch/slurm/sub_test +++ b/test/runtime/configMatters/launch/slurm/sub_test @@ -11,12 +11,15 @@ def main(): if chpl_home is None: print("[Error: CHPL_HOME not set]") sys.exit(1) + + bin_subdir=sp.check_output([os.path.join(chpl_home, "util", "chplenv", "chpl_bin_subdir.py")], encoding='utf-8').strip() + chpl = os.path.join(chpl_home, "bin", bin_subdir, "chpl") # force this test to use sbatch os.environ["CHPL_LAUNCHER_USE_SBATCH"] = "true" # compile hello.chpl and run it using chpl_launchcmd - ret = sp.call(["chpl", "-o", "hello", "hello.chpl"]) + ret = sp.call([chpl, "-o", "hello", "hello.chpl"]) if ret != 0: print("[Error compiling hello.chpl]") sys.exit(1) From d438153db3ab26c66a87c78860f78c51cf9849dc Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Tue, 25 Feb 2025 09:04:16 -0700 Subject: [PATCH 6/6] fix nl2 for launchcmd Signed-off-by: Jade Abraham --- test/runtime/configMatters/launch/slurm/sub_test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtime/configMatters/launch/slurm/sub_test b/test/runtime/configMatters/launch/slurm/sub_test index a0c24f60783e..5d08052fe24d 100755 --- a/test/runtime/configMatters/launch/slurm/sub_test +++ b/test/runtime/configMatters/launch/slurm/sub_test @@ -27,7 +27,7 @@ def main(): launchcmd = os.path.join(chpl_home, "util", "test", "chpl_launchcmd.py") outfile = os.path.join(d, "hello.exec.tmp") with open(outfile, "w") as f: - ret = sp.call([launchcmd, "./hello", "-nl2"], stdout=f, stderr=sp.STDOUT) + ret = sp.call([launchcmd, "./hello", "-nl", "2"], stdout=f, stderr=sp.STDOUT) if ret != 0: print("[Error running hello.chpl]") sys.exit(1)