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

Update performance baselines #4508

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion CIME/baselines/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import gzip
import logging
from CIME.config import Config
from CIME.utils import expect
from CIME.utils import expect, get_src_root, get_current_commit, get_timestamp

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -238,7 +238,12 @@ def write_baseline_file(baseline_file, value):
value : str
Value to write.
"""
commit_hash = get_current_commit(repo=get_src_root())

timestamp = get_timestamp(timestamp_format="%Y-%m-%d_%H:%M:%S")

with open(baseline_file, "w") as fd:
fd.write(f"# sha:{commit_hash} date: {timestamp}\n")
fd.write(value)


Expand Down
11 changes: 7 additions & 4 deletions CIME/tests/test_unit_system_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import tempfile
import gzip
import re
from re import A
import unittest
from unittest import mock
Expand Down Expand Up @@ -508,14 +509,16 @@ def test_generate_baseline(self):
with open(baseline_dir / "cpl-tput.log") as fd:
lines = fd.readlines()

assert len(lines) == 1
assert lines[0] == "719.635"
assert len(lines) == 2
assert re.match("# sha:.* date:.*", lines[0])
assert lines[1] == "719.635"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, what do these numbers represent? Baseline SYPD on a particular machine or placeholder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default values are SYPD and memory highwater, both parsed from the coupler log.


with open(baseline_dir / "cpl-mem.log") as fd:
lines = fd.readlines()

assert len(lines) == 1
assert lines[0] == "1673.89"
assert len(lines) == 2
assert re.match("# sha:.* date:.*", lines[0])
assert lines[1] == "1673.89"

def test_kwargs(self):
case = mock.MagicMock()
Expand Down