From 15d0b6def73ef71ce1f8ba7d18871a7eae883e3a Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Mon, 20 Jul 2026 11:03:29 +0200 Subject: [PATCH 1/2] Add option to "emulate" McCode default 'Unix epoch' seed in mctest --- tools/Python/mctest/mctest.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/Python/mctest/mctest.py b/tools/Python/mctest/mctest.py index 92e3ebbb4..16741c18f 100644 --- a/tools/Python/mctest/mctest.py +++ b/tools/Python/mctest/mctest.py @@ -17,6 +17,7 @@ import platform import subprocess import io +from datetime import datetime sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from mccodelib import utils, mccode_config @@ -827,6 +828,10 @@ def main(args): elif args.s: seed = args.s[0] + if seed == "0" or seeed == "NULL": + # Emulate McCode 'epoch' seed, however applied to all active tests / sim runs... + seed = round((datetime.now() - datetime(1970, 1, 1)).total_seconds()) + if args.local: runLocal = args.local @@ -893,8 +898,8 @@ def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--ncount', nargs=1, help='ncount sent to %s' % (mccode_config.configuration["MCRUN"]) ) parser.add_argument('-n', nargs=1, help='ncount sent to %s' % (mccode_config.configuration["MCRUN"]) ) - parser.add_argument('--seed', nargs=1, help='seed sent to %s (default 1000)' % (mccode_config.configuration["MCRUN"]) ) - parser.add_argument('-s', nargs=1, help='seed sent to %s (default 1000)' % (mccode_config.configuration["MCRUN"]) ) + parser.add_argument('--seed', nargs=1, help='seed sent to %s (default 1000 - use 0/NULL to "randomize")' % (mccode_config.configuration["MCRUN"]) ) + parser.add_argument('-s', nargs=1, help='seed sent to %s (default 1000 - use 0/NULL to "randomize")' % (mccode_config.configuration["MCRUN"]) ) parser.add_argument('--mpi', nargs=1, help='mpi nodecount sent to %s' % (mccode_config.configuration["MCRUN"]) ) parser.add_argument('--openacc', action='store_true', help='openacc flag sent to %s' % (mccode_config.configuration["MCRUN"])) parser.add_argument('--config', nargs="?", help='test this specific config only - label name or absolute path') From 12b1d85dd7c4b087c9f813870a2de8a23da52487 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Mon, 20 Jul 2026 11:08:32 +0200 Subject: [PATCH 2/2] Fix typo --- tools/Python/mctest/mctest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Python/mctest/mctest.py b/tools/Python/mctest/mctest.py index 16741c18f..11b9596c5 100644 --- a/tools/Python/mctest/mctest.py +++ b/tools/Python/mctest/mctest.py @@ -828,7 +828,7 @@ def main(args): elif args.s: seed = args.s[0] - if seed == "0" or seeed == "NULL": + if seed == "0" or seed == "NULL": # Emulate McCode 'epoch' seed, however applied to all active tests / sim runs... seed = round((datetime.now() - datetime(1970, 1, 1)).total_seconds())