MetOffice / MetOffice/fab

Improvements to defining profiling modes

Open
#599 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
9
Forks
9
Avg merge
12d 12h
Merged PRs (30d)
2

Description

ATM, an application script (or site-specific config file) needs to define the profiles for all compilers, and preprocessors, e.g. typically something like:
```
for compiler in (tr[Category.C_COMPILER] +
tr[Category.C_PREPROCESSOR] +
tr[Category.FORTRAN_COMPILER] +
tr[Category.FORTRAN_PREPROCESSOR] +
tr[Category.LINKER]):
compiler.define_profile("base", inherit_from="")
for profile in self.get_valid_profiles():
compiler.define_profile(profile, inherit_from="base")
```

In hindsight, the ability to define profiling modes per tool seems not to be useful. If a new tools is added that needs profiling flags (like the recent change to the preprocessor, #596), application scripts need to be updated.

I suggest to replace this with using static functions in `ProfileFlags`. This would simplify the above code to something like:
```
ProfileFlags.define_profile("base", inherit_from="")
for profile in self.get_valid_profiles():
ProfileFlags.define_profile(profile, inherit_from="base")
```
and that especially makes it easier if new tools are added that need profile-specific modes.

Contributor guide

Open the contributing guide

Research direction

Start by locating ProfileFlags and the current compiler, preprocessor, and linker define_profile calls in application scripts or site-specific configuration. Trace how profiles are inherited and applied to each tool, then verify that centralizing the definitions preserves existing profiling behavior and allows newly added tools to use profile-specific modes without script updates.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.