Skip to content

Commit

Permalink
Merge pull request #260 from GoogleCloudPlatform/wrf_fom
Browse files Browse the repository at this point in the history
Fix WRF FOM time calculation
  • Loading branch information
douglasjacobsen authored Sep 12, 2023
2 parents 25c776c + 84f75f0 commit a9afb35
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions lib/ramble/ramble/test/end_to_end/experiment_excludes.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def test_wrfv4_exclusions(mutable_config, mutable_mock_workspace_path):
# Create fake figures of merit.
with open(os.path.join(exp_dir, 'rsl.out.0000'), 'w+') as f:
for i in range(1, 6):
f.write(f'Timing for main {i}{i}.{i}\n')
f.write(f'Timing for main: time 2019-11-27_00:00:00 on domain 1: {i}{i}.{i}\n')
f.write('wrf: SUCCESS COMPLETE WRF\n')

# Create files that match archive patterns
Expand All @@ -263,10 +263,10 @@ def test_wrfv4_exclusions(mutable_config, mutable_mock_workspace_path):

with open(text_results_files[0], 'r') as f:
data = f.read()
assert 'Average Timestep Time = 3.3 s' in data
assert 'Cumulative Timestep Time = 16.5 s' in data
assert 'Minimum Timestep Time = 1.1 s' in data
assert 'Maximum Timestep Time = 5.5 s' in data
assert 'Average Timestep Time = 33.3 s' in data
assert 'Cumulative Timestep Time = 166.5 s' in data
assert 'Minimum Timestep Time = 11.1 s' in data
assert 'Maximum Timestep Time = 55.5 s' in data
assert 'Avg. Max Ratio Time = 0.6' in data
assert 'Number of timesteps = 5' in data

Expand Down
10 changes: 5 additions & 5 deletions lib/ramble/ramble/test/end_to_end/explicit_zips.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def test_wrfv4_explicit_zips(mutable_config, mutable_mock_workspace_path):
# Create fake figures of merit.
with open(os.path.join(exp_dir, 'rsl.out.0000'), 'w+') as f:
for i in range(1, 6):
f.write(f'Timing for main {i}{i}.{i}\n')
f.write(f'Timing for main: time 2019-11-27_00:00:00 on domain 1: {i}{i}.{i}\n')
f.write('wrf: SUCCESS COMPLETE WRF\n')

# Create files that match archive patterns
Expand All @@ -244,10 +244,10 @@ def test_wrfv4_explicit_zips(mutable_config, mutable_mock_workspace_path):

with open(text_results_files[0], 'r') as f:
data = f.read()
assert 'Average Timestep Time = 3.3 s' in data
assert 'Cumulative Timestep Time = 16.5 s' in data
assert 'Minimum Timestep Time = 1.1 s' in data
assert 'Maximum Timestep Time = 5.5 s' in data
assert 'Average Timestep Time = 33.3 s' in data
assert 'Cumulative Timestep Time = 166.5 s' in data
assert 'Minimum Timestep Time = 11.1 s' in data
assert 'Maximum Timestep Time = 55.5 s' in data
assert 'Avg. Max Ratio Time = 0.6' in data
assert 'Number of timesteps = 5' in data

Expand Down
10 changes: 5 additions & 5 deletions lib/ramble/ramble/test/end_to_end/wrfv4_dry_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def test_wrfv4_dry_run(mutable_config, mutable_mock_workspace_path):
# Create fake figures of merit.
with open(os.path.join(exp_dir, 'rsl.out.0000'), 'w+') as f:
for i in range(1, 6):
f.write(f'Timing for main {i}{i}.{i}\n')
f.write(f'Timing for main: time 2019-11-27_00:00:00 on domain 1: {i}{i}.{i}\n')
f.write('wrf: SUCCESS COMPLETE WRF\n')

# Create files that match archive patterns
Expand Down Expand Up @@ -257,10 +257,10 @@ def test_wrfv4_dry_run(mutable_config, mutable_mock_workspace_path):
for text_result in text_results_files:
with open(text_result, 'r') as f:
data = f.read()
assert 'Average Timestep Time = 3.3 s' in data
assert 'Cumulative Timestep Time = 16.5 s' in data
assert 'Minimum Timestep Time = 1.1 s' in data
assert 'Maximum Timestep Time = 5.5 s' in data
assert 'Average Timestep Time = 33.3 s' in data
assert 'Cumulative Timestep Time = 166.5 s' in data
assert 'Minimum Timestep Time = 11.1 s' in data
assert 'Maximum Timestep Time = 55.5 s' in data
assert 'Avg. Max Ratio Time = 0.6' in data
assert 'Number of timesteps = 5' in data

Expand Down
2 changes: 1 addition & 1 deletion var/ramble/repos/builtin/applications/wrfv3/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _analyze_experiments(self, workspace):
'rsl.out.*'))

if file_list:
timing_regex = re.compile(r'Timing for main.*(?P<main_time>[0-9]+\.[0-9]*).*')
timing_regex = re.compile(r'Timing for main.*:\s+(?P<main_time>[0-9]+\.[0-9]*).*')
avg_time = 0.0
min_time = float('inf')
max_time = float('-inf')
Expand Down
2 changes: 1 addition & 1 deletion var/ramble/repos/builtin/applications/wrfv4/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _analyze_experiments(self, workspace):
'rsl.out.*'))

if file_list:
timing_regex = re.compile(r'Timing for main.*(?P<main_time>[0-9]+\.[0-9]*).*')
timing_regex = re.compile(r'Timing for main.*:\s+(?P<main_time>[0-9]+\.[0-9]*).*')
avg_time = 0.0
min_time = float('inf')
max_time = float('-inf')
Expand Down

0 comments on commit a9afb35

Please sign in to comment.