Skip to content

Commit 51d1aa7

Browse files
rtodlingashiklom
andauthored
Add perhost opt for mpi execs (#517)
* Add perhost opt for mpi execs * fix attempt to get perhost from config * show perhost in log * Update src/swell/utilities/run_jedi_executables.py Co-authored-by: Alexey Shiklomanov <alexey.shiklomanov@gmail.com> * Update src/swell/tasks/run_jedi_variational_executable.py Co-authored-by: Alexey Shiklomanov <alexey.shiklomanov@gmail.com> * Update src/swell/utilities/run_jedi_executables.py Co-authored-by: Alexey Shiklomanov <alexey.shiklomanov@gmail.com> * compilation fix --------- Co-authored-by: Alexey Shiklomanov <alexey.shiklomanov@gmail.com>
1 parent 4383c31 commit 51d1aa7

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

src/swell/tasks/run_jedi_variational_executable.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def execute(self) -> None:
3838
observations = self.config.observations()
3939
jedi_forecast_model = self.config.jedi_forecast_model(None)
4040
generate_yaml_and_exit = self.config.generate_yaml_and_exit(False)
41+
perhost = self.config.perhost(None)
4142

4243
# Set the observing system records path
4344
self.jedi_rendering.set_obs_records_path(self.config.observing_system_records_path(None))
@@ -163,7 +164,7 @@ def dict_to_ordereddict(d):
163164
if not generate_yaml_and_exit:
164165
self.logger.info('Running '+jedi_executable_path+' with '+str(np)+' processors.')
165166
run_executable(self.logger, self.cycle_dir(), np, jedi_executable_path,
166-
jedi_config_file, output_log_file)
167+
jedi_config_file, output_log_file, perhost)
167168
else:
168169
self.logger.info('YAML generated, now exiting.')
169170

src/swell/tasks/task_questions.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,16 @@ path_to_gsi_nc_diags:
825825
- GetGsiNcdiag
826826
type: string
827827

828+
perhost:
829+
ask_question: true
830+
default_value: None
831+
models:
832+
- geos_atmosphere
833+
prompt: What is the number of processors per host?
834+
tasks:
835+
- RunJediVariationalExecutable
836+
type: integer
837+
828838
produce_geovals:
829839
ask_question: true
830840
default_value: defer_to_model

src/swell/utilities/render_jedi_interface_files.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def __init__(
105105
'npy_proc',
106106
'number_of_iterations',
107107
'packet_ensemble_members',
108+
'perhost',
108109
'skip_ensemble_hofx',
109110
'swell_static_files',
110111
'total_processors',

src/swell/utilities/run_jedi_executables.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,32 @@ def run_executable(
112112
np: int,
113113
jedi_executable_path: str,
114114
jedi_config_file: str,
115-
output_log: str
115+
output_log: str,
116+
perhost: Optional[int] = None
116117
) -> None:
117118

118119
# Run the JEDI executable
119120
# -----------------------
120-
logger.info('Running '+jedi_executable_path+' with '+str(np)+' processors.')
121121

122-
command = ['mpirun', '-np', str(np), jedi_executable_path, jedi_config_file]
122+
if perhost is None:
123+
logger.info(f"Running {jedi_executable_path} with {str(np)} processors.")
124+
command = [
125+
'mpirun',
126+
'-np', str(np),
127+
jedi_executable_path,
128+
jedi_config_file
129+
]
130+
else:
131+
logger.info(
132+
f"Running {jedi_executable_path} with {str(np)} processors & perhost {str(perhost)}"
133+
)
134+
command = [
135+
'mpirun',
136+
'-np', str(np),
137+
'-perhost', str(perhost),
138+
jedi_executable_path,
139+
jedi_config_file
140+
]
123141

124142
# Run command
125143
# -----------

0 commit comments

Comments
 (0)