Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Default MPI Command #508

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions scm/src/run_scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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='mpirun -np 1')

###############################################################################
# Functions and subroutines #
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -727,13 +723,13 @@ 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 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)
Expand Down
Loading