Skip to content

Commit

Permalink
Updatr
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaasgoyal committed Jul 9, 2024
1 parent 571d2a7 commit 25038a0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/benchcab/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import multiprocessing
import operator
import os
from typing import Optional

from benchcab import internal
Expand Down
17 changes: 12 additions & 5 deletions src/benchcab/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from benchcab import internal
from benchcab.environment_modules import EnvironmentModules, EnvironmentModulesInterface
from benchcab.utils import get_logger
from benchcab.utils.fs import chdir, prepend_path
from benchcab.utils.fs import chdir, mkdir, prepend_path
from benchcab.utils.repo import GitRepo, LocalRepo, Repo
from benchcab.utils.subprocess import SubprocessWrapper, SubprocessWrapperInterface

Expand Down Expand Up @@ -97,14 +97,18 @@ def get_build_flags(self, mpi: bool, build_option: str, compiler_id: str) -> dic
build_flags["flags_init"] = ""
if "codecov" in build_option:
if compiler_id != "ifort":
msg = f"""For code coverage, the only supported compiler is Intel
msg = f"""For code coverage, the only supported compiler is `ifort`

Check warning on line 100 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L97-L100

Added lines #L97 - L100 were not covered by tests
User has {compiler_id} in their environment"""
raise RuntimeError(msg)

Check warning on line 102 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L102

Added line #L102 was not covered by tests

codecov_dir = self.get_coverage_dir()

Check warning on line 104 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L104

Added line #L104 was not covered by tests

self.logger.info("Building with Intel code coverage using PGO")

Check warning on line 106 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L106

Added line #L106 was not covered by tests
self.logger.debug(f"Analysis directory self as {codecov_dir}")

# `ifort` checks for pre-existing profile directories before compilation
mkdir(codecov_dir, parents=True, exist_ok=True)

Check warning on line 109 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L109

Added line #L109 was not covered by tests

self.logger.debug(f"Analysis directory set as {codecov_dir}")
build_flags["flags_init"] += f'"-prof-gen=srcpos -prof-dir={codecov_dir}"'

Check warning on line 112 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L111-L112

Added lines #L111 - L112 were not covered by tests

return build_flags

Check warning on line 114 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L114

Added line #L114 was not covered by tests
Expand Down Expand Up @@ -153,9 +157,12 @@ def build(self, modules: list[str], mpi: bool, build_option: str):

# $FC is loaded after compiler module is loaded,
# but we need runs/ dir relative to project rootdir
build_flags = self.get_build_flags(
mpi, build_option, os.environ.get("FC", "")
env_fc = os.environ.get("FC", "")
self.logger.debug(

Check warning on line 161 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L160-L161

Added lines #L160 - L161 were not covered by tests
f"Getting environment variable for compiler $FC = {env_fc}"
)
build_flags = self.get_build_flags(mpi, build_option, env_fc)
env_fc = None

Check warning on line 165 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L164-L165

Added lines #L164 - L165 were not covered by tests

with chdir(path_to_repo):
env = os.environ.copy()

Check warning on line 168 in src/benchcab/model.py

View check run for this annotation

Codecov / codecov/patch

src/benchcab/model.py#L167-L168

Added lines #L167 - L168 were not covered by tests
Expand Down
6 changes: 3 additions & 3 deletions src/benchcab/utils/pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"""Contains helper functions for manipulating PBS job scripts."""

from typing import TypedDict
from typing import Optional, TypedDict

from benchcab.utils import interpolate_file_template

Expand All @@ -23,8 +23,8 @@ def render_job_script(
modules: list,
benchcab_path: str,
pbs_config: PBSConfig,
verbose=False,
skip_bitwise_cmp=False,
verbose: Optional[bool] = False,
skip_bitwise_cmp: Optional[bool] = False,
) -> str:
"""Returns the text for a PBS job script that executes all computationally expensive commands.
Expand Down

0 comments on commit 25038a0

Please sign in to comment.