From de0a9cef0f79bd5752ab8ef5864c90f7e87fe94c Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Wed, 4 Sep 2024 10:39:14 -0600 Subject: [PATCH 1/3] - Default run command fix: some systems don't allow mpirun from a login node so default MPI command changed to ''. This might be useful for short runs. - Script reports that it adds 'xterm -e' to MPI command if not already present and debug mode turned on. User might be using a different method for debugging MPI so this info is useful to report --- scm/src/run_scm.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index c14938fe..17d3cb36 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -32,10 +32,6 @@ # Path to default bin directory (relative to scm_root) DEFAULT_BIN_DIR = 'scm/bin' -# Default command string to run MPI apps (number of processes should be 1 since SCM is not set up to use more than 1 yet) -DEFAULT_MPI_COMMAND = 'mpirun -np 1' - - # Copy executable to run directory if true (otherwise it will be linked) COPY_EXECUTABLE = False @@ -125,7 +121,7 @@ parser.add_argument('--stop_on_error', help='when running multiple SCM runs, stop on first error', required=False, action='store_true') parser.add_argument('-v', '--verbose', help='set logging level to debug and write log to file', action='count', default=0) parser.add_argument('-f', '--file', help='name of file where SCM runs are defined') -parser.add_argument('--mpi_command', help='command used to invoke the executable via MPI (including options)', required=False) +parser.add_argument('--mpi_command', help='command used to invoke the executable via MPI (including options)', required=False, default=False) ############################################################################### # Functions and subroutines # @@ -465,7 +461,7 @@ def setup_rundir(self): raise Exception(message) else: case_nml['case_config']['runtime_mult'] = self._runtime_mult - + # If the number of levels is specified, set the namelist value if self._levels: case_nml['case_config']['n_levels'] = self._levels @@ -727,13 +723,16 @@ def setup_rundir(self): def launch_executable(use_gdb, gdb, mpi_command, ignore_error = False): """Configure model run command and pass control to shell/gdb""" + + # If mpi_command flag not passed default to '' to allow it to run on login nodes + if not mpi_command: + mpi_command = '' if use_gdb: - if not mpi_command: - mpi_command = DEFAULT_MPI_COMMAND + ' xterm -e ' + if mpi_command != '' and ('xterm' not in mpi_command): + logging.info("run_scm.py debug flag adds 'xterm -e' to MPI command") + mpi_command += ' xterm -e ' cmd = '(cd {scm_run} && {mpi_command} {gdb} {executable})'.format(scm_run=SCM_RUN, mpi_command=mpi_command, gdb=gdb, executable=EXECUTABLE) else: - if not mpi_command: - mpi_command = DEFAULT_MPI_COMMAND cmd = '(cd {scm_run} && time {mpi_command} {executable})'.format(scm_run=SCM_RUN, mpi_command=mpi_command, executable=EXECUTABLE) logging.info('Passing control to "{0}"'.format(cmd)) time.sleep(1) From 9eb5ab4aa52a3b83cfb744d27bd86156905ed187 Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Thu, 5 Sep 2024 13:09:46 -0600 Subject: [PATCH 2/3] Changes recommended by Mike K. to simplify default mpi_command logic --- scm/src/run_scm.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index 17d3cb36..0579a988 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -121,7 +121,7 @@ parser.add_argument('--stop_on_error', help='when running multiple SCM runs, stop on first error', required=False, action='store_true') parser.add_argument('-v', '--verbose', help='set logging level to debug and write log to file', action='count', default=0) parser.add_argument('-f', '--file', help='name of file where SCM runs are defined') -parser.add_argument('--mpi_command', help='command used to invoke the executable via MPI (including options)', required=False, default=False) +parser.add_argument('--mpi_command', help='command used to invoke the executable via MPI (including options)', required=False, default='') ############################################################################### # Functions and subroutines # @@ -724,9 +724,6 @@ def setup_rundir(self): def launch_executable(use_gdb, gdb, mpi_command, ignore_error = False): """Configure model run command and pass control to shell/gdb""" - # If mpi_command flag not passed default to '' to allow it to run on login nodes - if not mpi_command: - mpi_command = '' if use_gdb: if mpi_command != '' and ('xterm' not in mpi_command): logging.info("run_scm.py debug flag adds 'xterm -e' to MPI command") From 558011c4a263031de87b71850719be9c8ac5ef3c Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Fri, 6 Sep 2024 10:27:02 -0600 Subject: [PATCH 3/3] Update scm/src/run_scm.py New default to work on Hera. Derecho will require --mpi_command='' Co-authored-by: Michael Kavulich --- scm/src/run_scm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index 0579a988..eefb9831 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -121,7 +121,7 @@ parser.add_argument('--stop_on_error', help='when running multiple SCM runs, stop on first error', required=False, action='store_true') parser.add_argument('-v', '--verbose', help='set logging level to debug and write log to file', action='count', default=0) parser.add_argument('-f', '--file', help='name of file where SCM runs are defined') -parser.add_argument('--mpi_command', help='command used to invoke the executable via MPI (including options)', required=False, default='') +parser.add_argument('--mpi_command', help='command used to invoke the executable via MPI (including options)', required=False, default='mpirun -np 1') ############################################################################### # Functions and subroutines #