Skip to content

Commit 50e68d7

Browse files
committed
graph_target default is None
1 parent d618aa8 commit 50e68d7

File tree

7 files changed

+26
-22
lines changed

7 files changed

+26
-22
lines changed

polaris/ocean/convergence/forward.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ConvergenceForward(OceanModelStep):
2121

2222
def __init__(self, component, name, subdir, resolution, mesh, init,
2323
package, yaml_filename='forward.yaml', options=None,
24-
graph_target='graph.info', output_filename='output.nc',
24+
graph_target=None, output_filename='output.nc',
2525
validate_vars=None):
2626
"""
2727
Create a new step

polaris/ocean/ice_shelf/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self, component, min_resolution, name, subdir, sshdir=None):
5050
self.component = component
5151
self.min_resolution = min_resolution
5252

53-
def setup_ssh_adjustment_steps(self, mesh_filename, graph_filename,
53+
def setup_ssh_adjustment_steps(self, mesh_filename, graph_target,
5454
init_filename, config, config_filename,
5555
ForwardStep, package=None,
5656
yaml_filename='ssh_forward.yaml',
@@ -67,7 +67,7 @@ def setup_ssh_adjustment_steps(self, mesh_filename, graph_filename,
6767
mesh_filename : str
6868
the mesh filename (relative to the base work directory)
6969
70-
graph_filename : str
70+
graph_target: str
7171
the graph filename (relative to the base work directory)
7272
7373
init_filename : str
@@ -114,7 +114,7 @@ def setup_ssh_adjustment_steps(self, mesh_filename, graph_filename,
114114
else:
115115
ssh_forward = ForwardStep(
116116
component=component, min_resolution=min_resolution,
117-
indir=indir, graph_target=graph_filename,
117+
indir=indir, graph_target=graph_target,
118118
init_filename=current_init_filename, name=name,
119119
package=package, yaml_filename=yaml_filename,
120120
yaml_replacements=yaml_replacements)

polaris/ocean/model/ocean_model_step.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class OceanModelStep(ModelStep):
2424
def __init__(self, component, name, subdir=None, indir=None, ntasks=None,
2525
min_tasks=None, openmp_threads=None, max_memory=None,
2626
cached=False, yaml=None, update_pio=True, make_graph=False,
27-
mesh_filename=None, partition_graph=True,
28-
graph_target='graph.info'):
27+
mesh_filename=None, partition_graph=True, graph_target=None):
2928
"""
3029
Make a step for running the model
3130
@@ -84,9 +83,12 @@ def __init__(self, component, name, subdir=None, indir=None, ntasks=None,
8483
If so, the partitioning executable is taken from the ``partition``
8584
option of the ``[executables]`` config section.
8685
87-
graph_filename : str, optional
86+
graph_target : str, optional
8887
The name of the graph file to partition
8988
"""
89+
if graph_target is None:
90+
self.make_graph = True
91+
9092
super().__init__(
9193
component=component, name=name, subdir=subdir, indir=indir,
9294
ntasks=ntasks, min_tasks=min_tasks, openmp_threads=openmp_threads,

polaris/ocean/tasks/ice_shelf_2d/default/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(self, component, resolution, indir, init, config,
7373

7474
last_adjust_step = self.setup_ssh_adjustment_steps(
7575
mesh_filename=f'{init.path}/culled_mesh.nc',
76-
graph_filename=f'{init.path}/culled_graph.info',
76+
graph_target=f'{init.path}/culled_graph.info',
7777
init_filename=f'{init.path}/output.nc',
7878
config=config, config_filename='ice_shelf_2d.cfg',
7979
ForwardStep=SshForward,

polaris/ocean/tasks/internal_wave/default/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def __init__(self, component, indir, init, vadv_method='standard'):
3232
self.add_step(init, symlink='init')
3333

3434
self.add_step(
35-
Forward(component=component, indir=self.subdir, ntasks=None,
36-
min_tasks=None, openmp_threads=1,
35+
Forward(component=component, init=init, indir=self.subdir,
36+
ntasks=None, min_tasks=None, openmp_threads=1,
3737
run_time_steps=3, vadv_method=vadv_method))
3838

3939
self.add_step(

polaris/ocean/tasks/internal_wave/forward.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class Forward(OceanModelStep):
1414
run_time_steps : int or None
1515
Number of time steps to run for
1616
"""
17-
def __init__(self, component, name='forward', subdir=None, indir=None,
18-
ntasks=None, min_tasks=None, openmp_threads=1, nu=None,
19-
run_time_steps=None, vadv_method='standard'):
17+
def __init__(self, component, init, name='forward', subdir=None,
18+
indir=None, ntasks=None, min_tasks=None, openmp_threads=1,
19+
nu=None, run_time_steps=None, vadv_method='standard'):
2020
"""
2121
Create a new test case
2222
@@ -28,9 +28,12 @@ def __init__(self, component, name='forward', subdir=None, indir=None,
2828
name : str
2929
the name of the task
3030
31+
init : polaris.Step
32+
the initial state step
33+
3134
subdir : str, optional
3235
the subdirectory for the step. If neither this nor ``indir``
33-
are provided, the directory is the ``name``
36+
are provided, the directory is the ``name``
3437
3538
indir : str, optional
3639
the directory the step is in, to which ``name`` will be appended
@@ -59,16 +62,14 @@ def __init__(self, component, name='forward', subdir=None, indir=None,
5962
self.run_time_steps = run_time_steps
6063
super().__init__(component=component, name=name, subdir=subdir,
6164
indir=indir, ntasks=ntasks, min_tasks=min_tasks,
62-
openmp_threads=openmp_threads)
65+
openmp_threads=openmp_threads,
66+
graph_target=f'{init.path}/culled_graph.info')
6367

6468
# make sure output is double precision
6569
self.add_yaml_file('polaris.ocean.config', 'output.yaml')
6670

6771
self.add_input_file(filename='initial_state.nc',
68-
target='../../../init/initial_state.nc')
69-
70-
self.add_input_file(filename='graph.info',
71-
target='../../../init/culled_graph.info')
72+
target=f'{init.path}/initial_state.nc')
7273

7374
self.add_yaml_file('polaris.ocean.tasks.internal_wave',
7475
'forward.yaml')

polaris/ocean/tasks/internal_wave/rpe/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self, component, indir, init, config, vadv_method='standard'):
4444
# brings in to set up the steps
4545
self.set_shared_config(config, link='internal_wave.cfg')
4646
self.add_step(init, symlink='init')
47+
self.init = init
4748
self._add_rpe_and_analysis_steps()
4849

4950
def configure(self):
@@ -70,9 +71,9 @@ def _add_rpe_and_analysis_steps(self):
7071
for nu in nus:
7172
name = f'nu_{nu:g}'
7273
step = Forward(
73-
component=component, name=name, indir=self.subdir,
74-
ntasks=None, min_tasks=None, openmp_threads=1,
75-
nu=nu, vadv_method=self.vadv_method)
74+
component=component, name=name, init=self.init,
75+
indir=self.subdir, ntasks=None, min_tasks=None,
76+
openmp_threads=1, nu=nu, vadv_method=self.vadv_method)
7677

7778
step.add_yaml_file(
7879
'polaris.ocean.tasks.internal_wave.rpe',

0 commit comments

Comments
 (0)