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

Parsing compiler name & version from Spack environment to include in the performance log file #262

Merged
merged 25 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3d72c50
Added compiler name & version to the performance log file
kaanolgu Jan 31, 2024
323ae11
Moving all changes to utils.py
kaanolgu Feb 2, 2024
b4f3658
spack_spec keys and values are printed apart from the compiler name a…
kaanolgu Feb 13, 2024
8ba7561
[NEW] Dictionary for spack_spec
kaanolgu Feb 26, 2024
b79f781
[NEW] MPI output
kaanolgu Feb 29, 2024
7b5e51e
Attempt to solve CI/test failed error
kaanolgu Feb 29, 2024
7a02712
Merge branch 'main' into ko/spack-spec-parser
kaanolgu Feb 29, 2024
f696cd5
[NEW] Concretized multiple spac_spec all in one dictionary
kaanolgu Mar 10, 2024
dd066c1
Merge branch 'ko/spack-spec-parser' of https://github.com/ukri-excali…
kaanolgu Mar 11, 2024
51c5713
[FIX] CI failing
kaanolgu Mar 11, 2024
49f2286
* MPI is moved into dictionary of each spec
kaanolgu Mar 21, 2024
4850d38
Merge branch 'main' into ko/spack-spec-parser
kaanolgu Mar 22, 2024
aed6bc2
[FIX] MPI to be string if present
kaanolgu Mar 25, 2024
5ac953f
Merge branch 'ko/spack-spec-parser' of github.com:ukri-excalibur/exca…
kaanolgu Mar 25, 2024
878aa5e
Update expected fields with unpacked names
tkoskela Mar 25, 2024
493c7bf
Install with -e
tkoskela Mar 25, 2024
3559fec
Minor formatting fixes.
pineapple-cat Mar 27, 2024
57767c7
Modified new key column insertion and added recursive flattening of r…
pineapple-cat Mar 27, 2024
c17b12e
Merge branch 'main' into ko/spack-spec-parser
pineapple-cat Mar 27, 2024
7c871e5
Fixed key columns return bug.
pineapple-cat Apr 9, 2024
9fbc4f1
Merge branch 'main' into ko/spack-spec-parser
kaanolgu Apr 9, 2024
cbcaeeb
Fix bug with unpacking nested dicts in column names - there might be …
ilectra Apr 10, 2024
2e46df8
Added unit test for key column unpacking.
pineapple-cat Apr 10, 2024
1177f71
Merge branch 'main' into ko/spack-spec-parser
pineapple-cat Apr 10, 2024
1272d8c
Debug unit test for recursive dictionary unpacking.
ilectra Apr 11, 2024
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
22 changes: 19 additions & 3 deletions benchmarks/modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from reframe.core.exceptions import BuildSystemError
from reframe.core.logging import getlogger
from reframe.utility.osext import run_command


import reframe.utility.osext as osext
import reframe.utility.sanity as sn
SYSFILE = 'systems/sysinfo.json' # interpreted relative to jupyter root

def get_jupyter_root():
Expand Down Expand Up @@ -243,6 +243,7 @@ def identify_build_environment(current_partition):
class SpackTest(rfm.RegressionTest):
build_system = 'Spack'
spack_spec = variable(str, value='', loggable=True)
spack_spec_dict = variable(str, value='', loggable=True)

@run_before('compile')
def setup_spack_environment(self):
Expand All @@ -267,11 +268,25 @@ def setup_spack_environment(self):
f'(cd {cp_dir}; find . \( -name "spack.yaml" -o -name "compilers.yaml" -o -name "packages.yaml" \) -print0 | xargs -0 tar cf - | tar -C {dest} -xvf -)',
f'spack -e {self.build_system.environment} config add "config:install_tree:root:{env_dir}/opt"',
]

cmd_spack_spec_dict = 'from spack import environment;\
spec_list = environment.active_environment().concretized_user_specs;\
kaanolgu marked this conversation as resolved.
Show resolved Hide resolved
key_list_for_each = [[*spec_list[i].variants.dict.keys()] for i in range(len(spec_list))];\
kaanolgu marked this conversation as resolved.
Show resolved Hide resolved
mpi_spec_dict = {"mpi" : tuple(spec["mpi"] for spec in spec_list if "mpi" in spec)};\
result_dict = {spec.name:{"compiler":{"name":spec.compiler.name,"version":spec.compiler.versions},"variants" :{key: spec.variants.dict[key].value for key in key_list_for_each[i]} } for i, spec in enumerate(spec_list)};\
result_dict.update(mpi_spec_dict);\
print(result_dict)'
self.postrun_cmds.append(f'echo "spack_spec_dict: $(spack -e {self.build_system.environment} python -c \'{cmd_spack_spec_dict}\')"')

# Keep the `spack.lock` file in the output directory so that the Spack
# environment can be faithfully reproduced later.
self.keep_files.append(os.path.realpath(os.path.join(self.build_system.environment, 'spack.lock')))


@run_after('run')
def get_full_variants(self):
with osext.change_dir(self.stagedir):
self.spack_spec_dict = sn.extractsingle(r'spack_spec_dict: \s*(.*)', self.stdout, 1).evaluate()

@run_before('compile')
def setup_build_system(self):
# The `self.spack_spec` attribute is the user-facing and loggable
Expand Down Expand Up @@ -301,6 +316,7 @@ def setup_build_job_num_cpus(self):
self.build_job.num_cpus_per_task = min(16, self.current_partition.processor.num_cpus)



if __name__ == '__main__':

#v = get_sysinfo(sys.argv[-1])
Expand Down
1 change: 1 addition & 0 deletions benchmarks/reframe_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,7 @@ def spack_root_to_path():
'%(check_environ)s|'
'%(check_extra_resources)s|'
'%(check_env_vars)s|'
'%(check_spack_spec_dict)s|'
'%(check_tags)s'
),
'format_perfvars': (
Expand Down
6 changes: 5 additions & 1 deletion post-processing/test_post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,15 @@ def test_read_perflog(run_sombrero):
# get dataframe from complete perflog
df = log_hand.read_perflog(sombrero_log_path)


EXPECTED_FIELDS = ["job_completion_time", "version", "info", "jobid", "num_tasks",
"num_cpus_per_task", "num_tasks_per_node", "num_gpus_per_node",
"flops_value", "flops_unit", "flops_ref", "flops_lower_thres",
"flops_upper_thres", "spack_spec", "test_name", "tasks", "cpus_per_task",
"system", "partition", "environ", "OMP_NUM_THREADS", "tags"]
"system", "partition", "environ", "OMP_NUM_THREADS",
"spack_spec_dict", "tags"]



# check example perflog file is read appropriately
# check all expected columns are present
Expand Down