From 4e134dc1a96540e9d73e75deee58012a8f97f23c Mon Sep 17 00:00:00 2001 From: pearce8 Date: Mon, 11 Dec 2023 13:16:09 -0600 Subject: [PATCH 1/2] Thicket postprocessing We will use Thicket for postprocessing performance results. - Caliper options used for the runs dictate what data is available in the .cali files after the run. - We will probably want a "mode" of thicket per "mode" of Caliper. - Working towards several dashboards: --- performance over time --- scaling --- repo/thicket/modifier.py | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 repo/thicket/modifier.py diff --git a/repo/thicket/modifier.py b/repo/thicket/modifier.py new file mode 100644 index 000000000..599a919c5 --- /dev/null +++ b/repo/thicket/modifier.py @@ -0,0 +1,68 @@ +# Copyright 2022-2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +from ramble.modkit import * + + +class Caliper(SpackModifier): + """Define a modifier for Caliper""" + + name = "caliper" + + tags('profiler', 'performance-analysis') + + maintainers('olgapearce') + + mode('spot', description='Mode for collecting time') + + env_var_modification('CALI_CONFIG', 'spot(output={experiment_run_dir}/{experiment_name}.cali)', method='set', modes=['spot']) + + _log_file = '{experiment_run_dir}/.caliper_fom' + _cali_datadir = '{experiment_run_dir}/{experiment_name}.cali' + _target_fom_name = '{target_fom_name}' + + # This will feed into an external profiler/data aggregator + # FIXME: Is this correct? + archive_pattern('{experiment_run_dir}/{experiment_name}.cali') + + software_spec('caliper', spack_spec='caliper') + + required_package('caliper') + + figure_of_merit('{target_fom_name}', fom_regex='{target_fom_name} = (?P.*)', log_file=_log_file, + units='', group_name='fom') + + # FIXME: This should be provided by the system + # Handle this in Spack? + def _load_thicket(self): + # the plot thickets!!! + import matplotlib.pyplot as plt + + import sys + import platform + + input_deploy_dir_str = "/usr/gapps/spot/dev/" + machine = platform.uname().machine + + sys.path.append(input_deploy_dir_str + "/hatchet-venv/" + machine + "/lib/python3.9/site-packages") + sys.path.append(input_deploy_dir_str + "/hatchet/" + machine) + sys.path.append(input_deploy_dir_str + "/thicket-playground-dev") + + # TODO: add hooks to customize this function per experiment + # add additional python scripts in configs? + def _prepare_analysis(self, workspace): + self._load_thicket() + + import hatchet as ht + import thicket as tt + + with open(self.expander.expand_var(self._log_file), 'w+') as f: + target_fom_name = self.expander.expand_var(self._target_fom_name) + t_ens = tt.Thicket.from_caliperreader(self.expander.expand_var(self._cali_datadir)) + fom = t_ens.metadata[target_fom_name].iloc[0] + f.write("{} = {:.6E}".format(target_fom_name, fom)) From 853fcebee48f2e726f781421090c43e1c21414ea Mon Sep 17 00:00:00 2001 From: "Olga T. Pearce" Date: Thu, 28 Dec 2023 15:32:34 -0800 Subject: [PATCH 2/2] fixing license --- repo/thicket/modifier.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) mode change 100644 => 100755 repo/thicket/modifier.py diff --git a/repo/thicket/modifier.py b/repo/thicket/modifier.py old mode 100644 new mode 100755 index 599a919c5..ebe9aa1a4 --- a/repo/thicket/modifier.py +++ b/repo/thicket/modifier.py @@ -1,14 +1,11 @@ -# Copyright 2022-2023 Google LLC +#!/bin/bash +# Copyright 2023 Lawrence Livermore National Security, LLC and other +# Benchpark Project Developers. See the top-level COPYRIGHT file for details. # -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. +# SPDX-License-Identifier: Apache-2.0 from ramble.modkit import * - class Caliper(SpackModifier): """Define a modifier for Caliper""" @@ -54,7 +51,7 @@ def _load_thicket(self): sys.path.append(input_deploy_dir_str + "/thicket-playground-dev") # TODO: add hooks to customize this function per experiment - # add additional python scripts in configs? + # add additional python scripts in configs? def _prepare_analysis(self, workspace): self._load_thicket()