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

Feature/compare califiles #318

Merged
merged 203 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 202 commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
0de6c53
update radiuss-spack-config submodule
gardner48 Feb 6, 2023
84629d0
update uberenv submodule
gardner48 Feb 6, 2023
6377fc6
update spack to v0.19.0
gardner48 Feb 6, 2023
5a5a554
run spack clean
gardner48 Feb 6, 2023
f2a8845
Revert "run spack clean"
gardner48 Feb 6, 2023
6dd2a25
build pipeline with clang 13.0.0
yu-nix Feb 8, 2023
cf4e427
add corona files to gitlab-ci
yu-nix Feb 8, 2023
00f0931
add corona to proper stage
yu-nix Feb 8, 2023
4e29127
fix corona template
yu-nix Feb 8, 2023
9c417e8
build sundials without mpi
yu-nix Feb 8, 2023
f021bea
add brackets around amdgpu_target
yu-nix Feb 8, 2023
3e8a5a5
add target feature support to AMDGPU_TARGET
yu-nix Feb 8, 2023
c3e55e3
turn on verbose build
yu-nix Feb 8, 2023
dcccb4f
remove extra amd features
yu-nix Feb 8, 2023
02667cb
remove lassen, quartz jobs. Manually set amdgpu_target
yu-nix Feb 8, 2023
d2c1546
modify sundials package.py to have amdgpu_target addition mimic cuda_…
yu-nix Feb 8, 2023
221c373
update uberenv to v1.0.0
gardner48 Feb 9, 2023
bcf709e
update to latest radiuss-spack-configs
gardner48 Feb 9, 2023
2db41e3
update spack commit to v0.19.0
gardner48 Feb 9, 2023
4e281ba
fix typo, update permissions
gardner48 Feb 9, 2023
4941ea3
fix typo
gardner48 Feb 9, 2023
f0dce5f
disable some tests, remove chmod update
gardner48 Feb 9, 2023
2e755e0
remove chmod update
gardner48 Feb 9, 2023
2be344d
add spack-debug
gardner48 Feb 9, 2023
1e0fd82
remove chmod commands
gardner48 Feb 9, 2023
1eb78df
switch to lassen tests
gardner48 Feb 9, 2023
21c04b3
comment out chmods
gardner48 Feb 9, 2023
71708b7
comment out chmods
gardner48 Feb 9, 2023
cd4343c
get the first value in amdgpu_target
yu-nix Feb 9, 2023
1b3d338
remove commented out code, turn off verbose build
yu-nix Feb 9, 2023
8bd8c5c
use original concretizer
gardner48 Feb 9, 2023
ccdbac0
Revert "use original concretizer"
gardner48 Feb 9, 2023
0118048
use spack v0.18.1
gardner48 Feb 9, 2023
421dd62
swap clang version for 15.0.0
yu-nix Feb 28, 2023
83bb72f
update spack to v0.19.1 (latest release as of this commit)
balos1 Feb 28, 2023
fcc41ae
re-enable quartz
balos1 Feb 28, 2023
8f64282
revert build_and_test.sh to develop
balos1 Feb 28, 2023
f6aa871
make it easier to update gitlab ci Spack, document it more clearly
balos1 Feb 28, 2023
0c9ac8e
remove raja, camp
balos1 Mar 1, 2023
5d4bcc0
specify suite-sparse version due to spack bug
balos1 Mar 2, 2023
954da46
need clang 12.0.1 on quartz
balos1 Mar 2, 2023
2c7480d
need netlib-lapack from develop due to bug
balos1 Mar 2, 2023
360ee52
try openblas instead of netlib-lapack with clang
balos1 Mar 2, 2023
012c03e
sync sundials spack package
balos1 Mar 2, 2023
012bf28
try setting superlu_dist libraries direct
balos1 Mar 2, 2023
281bc27
re-enable gcc build on lassen
balos1 Mar 4, 2023
8ef3180
try old way of enabling superlu-dist
balos1 Mar 7, 2023
1898190
temporarily disable quartz and turn on shared spack
balos1 Mar 7, 2023
53d85c5
Revert "temporarily disable quartz and turn on shared spack"
balos1 Mar 8, 2023
7dd3d4f
disable superlu-dist on lassen for the moment
balos1 Mar 8, 2023
203c743
merge submodule update
yu-nix Mar 9, 2023
819c160
finish merge. update corona command to flux
yu-nix Mar 9, 2023
3ec6e07
add sundials+magma+raja job for corona
yu-nix Mar 9, 2023
6ca0d24
add precision to corona tpls job
yu-nix Mar 10, 2023
e523cbf
remove raja due to cuda error
yu-nix Mar 10, 2023
b7ce7f5
fix raja build issue
yu-nix Mar 10, 2023
bb20d20
switch conditional to check hostname
yu-nix Mar 13, 2023
41fc36e
add cmake variables to enable custom MPI executable prefix
yu-nix Mar 15, 2023
e7f98c2
add SUNDIALS_TEST_MPIRUN_COMMAND to cmake variables
yu-nix Mar 17, 2023
bc580e7
add scheduler variant to package.py
yu-nix Mar 20, 2023
7661fad
turn on mpi for base corona job
yu-nix Mar 20, 2023
2fdfcf0
add petsc to quartz jobs, disable for xl compiler on lassen
yu-nix Mar 24, 2023
2458890
turn off petsc for quartz_intel_tpls
yu-nix Mar 24, 2023
e176be5
add hypre sub spec to use internal superlu
yu-nix Mar 24, 2023
77d1456
restrict hypre version
yu-nix Mar 24, 2023
66f4a4d
lower hypre version
yu-nix Mar 27, 2023
da4dcfb
store benchmark cali files in sundials workspace
yu-nix Mar 27, 2023
2d3815f
add back benchmarks variant
yu-nix Mar 29, 2023
b0f1cc3
complete merge from develop
yu-nix Mar 29, 2023
b533df0
add profile-examples variant to package.py
yu-nix Mar 31, 2023
b7f4f3d
add examples test command in build_and_bench
yu-nix Apr 3, 2023
986fe05
turn off adiak in benchmark ci spec
yu-nix Apr 3, 2023
24cbee4
update developer docs with info on the CPT suite
balos1 Apr 3, 2023
815ad40
fix syntax error in build_and_bench
yu-nix Apr 3, 2023
7a8a989
complete merge
yu-nix Apr 3, 2023
2545e89
add ls for debugging
yu-nix Apr 3, 2023
78a9792
add benchmark cmake macro and cmake options
yu-nix Apr 21, 2023
2b9c44a
adjust cali config to be compatible with spot
yu-nix Apr 21, 2023
265f5cd
add benchmark macro calls to benchmark CMakeLists
yu-nix Apr 21, 2023
ed35ddc
add benchmark macro to nvector raja
yu-nix Apr 21, 2023
8b487b6
separate cali files by benchmark and parameters
yu-nix Apr 21, 2023
098c37d
add benchmark macro to rest of nvector benchmarks
yu-nix Apr 21, 2023
417ec4d
change NUM_NODES to NUM_CORES for clarity
yu-nix Apr 28, 2023
82a5f97
add adiak option to cmake and adiak specific code
yu-nix Apr 28, 2023
30fed8e
merge develop into persistent-benchmarking
yu-nix Apr 28, 2023
4cc8d45
add Adiak to Sundials
yu-nix May 16, 2023
dc56b58
turn off all runs for this branch
yu-nix May 17, 2023
7472cbf
remove nvector from make: Nothing to be done for 'benchmarks'.
yu-nix May 18, 2023
71764b3
add SundialsAdiak.cmake
yu-nix May 18, 2023
3ab28a8
add output dir for benchmark cali files
yu-nix May 18, 2023
98a555f
add custom adiak metadata
yu-nix May 18, 2023
fe718b3
call SUNMemoryHelper_Create after initlaizing the proflier root in main
balos1 May 19, 2023
e250d6c
use cpp sundials::Context
balos1 May 19, 2023
87a3b23
c++ wrapper for sundials_memory; adjust advection caliper calls to ha…
yu-nix May 22, 2023
cbcbe9d
modify cali_dir to be read from env
yu-nix May 23, 2023
b83194f
add a default dir to SUNDIALS_CALI_DIR
yu-nix May 23, 2023
a429c5a
rename SUNDIALS_CALI_DIR to SUNDIALS_CALIPER_OUTPUT_DIR
yu-nix May 24, 2023
b92c281
replace SUNDIALS_CALIPER_OUTPUT_DIR with SUNDIALS_TEST_OUTPUT_DIR
yu-nix May 24, 2023
b848d7b
add cmake command to reconfigure cali output dir
yu-nix May 25, 2023
49f5abe
add docs on SPOT, HIP
yu-nix May 25, 2023
6e51a81
add adiak to package.py
yu-nix May 25, 2023
3a0d070
correct cmake command in build_and_test.sh
yu-nix May 25, 2023
859d458
add sundials version to set of adiak values
yu-nix May 25, 2023
d4c8116
remove sundials version from testRunner
yu-nix May 26, 2023
5873f5e
swap order of libraries to link with adiak
yu-nix May 30, 2023
bb60ebc
add adiak cmake variables to documentation
yu-nix May 30, 2023
37b1f14
change order of dl libs for adiak
yu-nix May 31, 2023
33d2538
a few cmake fixes for setting up adiak
balos1 Jun 1, 2023
016fc6d
I dont think we need to specify include directories anymore
balos1 Jun 1, 2023
ca487eb
move adiak/caliper linking to sundials_add_library
balos1 Jun 1, 2023
dd3a275
remove caliper/adiak linking from individual packages
balos1 Jun 1, 2023
f362e0f
adjust CALI_CONFIG to only SPOT for test_runner
yu-nix Jun 5, 2023
9a9e2d6
update for rocmcc 5.5.0
yu-nix Jun 5, 2023
e9bcef4
add job to test CI_JOB_ID to metadata
yu-nix Jun 5, 2023
bc3123b
fix ci_job_id to be usable as variable in c files
yu-nix Jun 5, 2023
7308c2e
remove rocm loading; put test output into unique directories
yu-nix Jun 5, 2023
5f4d730
add HIP cmake options to documentation
yu-nix Jun 5, 2023
b3af82a
add spack version to adiak metadata
yu-nix Jun 7, 2023
8349dca
move unique run folders to within Testing
yu-nix Jun 7, 2023
6c089bd
add tpls to adiak metadata
yu-nix Jun 9, 2023
4235222
fix a typo
yu-nix Jun 9, 2023
915b9f9
add tpl list to adiak metadata
yu-nix Jun 12, 2023
b353245
add MPI version and remove irrelevent metadata
yu-nix Jun 12, 2023
d91c7d3
update radiuss
yu-nix Jun 12, 2023
c43f83b
fix typo
yu-nix Jun 12, 2023
0251158
add more compiler metadata
yu-nix Jun 15, 2023
59d829e
add docs on local spot usage
yu-nix Jun 16, 2023
a48259d
add documentation on setting up documentation
yu-nix Jun 20, 2023
1bc7937
update answers
yu-nix Jun 20, 2023
d9feeba
define ci_job_id with timestamp if gitlab id not available
yu-nix Jun 21, 2023
52a56ba
add ci job start time
yu-nix Jun 21, 2023
92ba518
fix default case of ci_job_start_time
yu-nix Jun 21, 2023
5c8fd58
remove ci from variables to make more generic
yu-nix Jun 22, 2023
19c82b4
reorganize caliper benchmark structure
yu-nix Jun 22, 2023
e457298
add documenation on benchmarking
yu-nix Jun 22, 2023
da288cf
add calidir option to testRunner
yu-nix Jun 22, 2023
669ee5e
remove hatchet script
yu-nix Jul 3, 2023
d8268d3
complete merge of develop
yu-nix Jul 3, 2023
af8c80f
move parameters to raja CMakeLists.txt
yu-nix Jul 3, 2023
793f5d2
update identifiers for MPI only raja benchmarks
yu-nix Jul 3, 2023
ff6a14b
fix parameters for make benchmark for advection_reaction_3D_raja
yu-nix Jul 3, 2023
83ea500
update docs
yu-nix Jul 3, 2023
d127b13
fix sphinx warnings
yu-nix Jul 3, 2023
89c1f7a
set caliper output dir in package.py
yu-nix Jul 3, 2023
bcd0b90
fix syntax of docs
yu-nix Jul 3, 2023
555662c
remove profile job
yu-nix Jul 3, 2023
14e259e
add test name to metadata
yu-nix Jul 5, 2023
58de98f
add preliminary python script to process caliper files
yu-nix Jul 7, 2023
8c9c921
add file limit and output file check
yu-nix Jul 11, 2023
0708c4b
add preliminary data visualization for benchmarks
yu-nix Jul 14, 2023
e89060d
Merge branch 'develop' into feature/persistent-benchmarking
balos1 Jul 20, 2023
320e3c4
Update doc/sundials_developers/source/testing/Spot.rst
yu-nix Jul 20, 2023
9f4fcd6
Update .gitlab-ci.yml
yu-nix Jul 20, 2023
18d73af
Update .gitlab-ci.yml
yu-nix Jul 20, 2023
fe4abdb
Update .gitlab/spack_packages/sundials/package.py
yu-nix Jul 20, 2023
b800401
Update include/sundials/sundials_context.h
yu-nix Jul 20, 2023
02c1ca3
update SPOT doc
yu-nix Jul 21, 2023
64fcade
adjust benchmark script
yu-nix Jul 21, 2023
f10f045
remove change to build_and_test
yu-nix Jul 21, 2023
b12239d
place example cali files in Example folder
yu-nix Jul 24, 2023
ae87999
add SPOT visualization links
yu-nix Jul 24, 2023
e58dc2e
change folder name to be less redundant
yu-nix Jul 25, 2023
d697f31
add links for SPOT visualization
yu-nix Jul 25, 2023
330d31e
fix hip link
yu-nix Jul 25, 2023
be627e3
Update .gitlab/spack_packages/sundials/package.py
yu-nix Jul 26, 2023
35cf9d3
add CPU, GPU options
yu-nix Jul 26, 2023
430c00b
add caliper-dir variant
yu-nix Jul 26, 2023
367b1c4
complete merge
yu-nix Jul 26, 2023
ec78d82
add AddBenchmark macro to scripts/shared
yu-nix Jul 26, 2023
04a5f42
Merge remote-tracking branch 'origin/develop' into feature/persistent…
balos1 Jul 26, 2023
7f7334c
add sundials_memory.hpp to tarscript
balos1 Jul 26, 2023
6e09ca1
add SundialsAdiak to tarscript
balos1 Jul 26, 2023
b265d91
shorten diffusion 2D file names
yu-nix Jul 26, 2023
9219b81
Update cmake/macros/SundialsAddBenchmark.cmake
yu-nix Jul 27, 2023
e49f34e
remove extra identifier for Diffusion 2D benchmark
yu-nix Jul 27, 2023
399e6db
add copyright to SundialsAddBenchmark.cmake
yu-nix Jul 27, 2023
f800684
complete merge
yu-nix Jul 27, 2023
49abb3f
turn on adiak independently
yu-nix Jul 27, 2023
821a820
add +allow-unsupported-compilers
yu-nix Jul 28, 2023
72e9466
switch benchmark script to make benchmark
yu-nix Aug 2, 2023
fb119d5
update Lassen benchmark job with new variants
yu-nix Aug 3, 2023
8011685
update caliper file directory
yu-nix Aug 3, 2023
41563f4
Merge branch 'develop' into feature/persistent-benchmarking
gardner48 Aug 4, 2023
dc9e743
separate benchmarks from SUNDIALS_TEST_DEVTEST
yu-nix Aug 4, 2023
84a78ab
complete merge
yu-nix Aug 4, 2023
b6799b2
remove +profile-examples
yu-nix Aug 4, 2023
ffe8a61
add sundials_version adiak metadata
yu-nix Aug 7, 2023
77e6695
modify compare-tests.py for version comparison
yu-nix Aug 7, 2023
f81c8d4
complete merge
yu-nix Aug 8, 2023
f2e293b
convert compare_test.py to compare against releases
yu-nix Aug 9, 2023
525c4a7
add benchmark variant of compare_test.py
yu-nix Aug 9, 2023
c56a3dd
add release directory configuration
yu-nix Aug 9, 2023
1a0cb8d
add caliper dir variable to lassen-jobs.yml
yu-nix Aug 9, 2023
7ac6276
remove debug variables
yu-nix Aug 9, 2023
adac1f8
compare tests on the same machine
yu-nix Aug 10, 2023
1f7f37e
rename compare_tests.py to compare_examples.py
yu-nix Aug 11, 2023
1b80ccb
Merge branch 'develop' into feature/compare-califiles
balos1 Sep 13, 2023
f12f543
clear notebook outputs
balos1 Sep 13, 2023
92c30d0
remove old script
balos1 Sep 13, 2023
2a4e442
remove warning
balos1 Sep 14, 2023
676e811
add threshold param
balos1 Sep 14, 2023
2a07d06
Merge remote-tracking branch 'origin/develop' into feature/compare-ca…
balos1 Sep 14, 2023
b932d19
Update test/compare_benchmarks.py
gardner48 Sep 15, 2023
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: 17 additions & 5 deletions .gitlab/build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,23 @@ then
$cmake_exe --version

# configure
$cmake_exe \
-C "${hostconfig_path}" \
-DCMAKE_INSTALL_PREFIX=${install_dir} \
"${project_dir}"

if [[ "${CI_COMMIT_BRANCH}" == "main" ]]
then
# redirect caliper files to release directory
sundials_version=$(cd ${project_dir}; git describe --abbrev=0)
$cmake_exe \
-C "${hostconfig_path}" \
-DCMAKE_INSTALL_PREFIX=${install_dir} \
-DSUNDIALS_CALIPER_OUTPUT_DIR="${CALIPER_DIR}/Release/${hostname}/${sundials_version}" \
"${project_dir}"

else
$cmake_exe \
-C "${hostconfig_path}" \
-DCMAKE_INSTALL_PREFIX=${install_dir} \
"${project_dir}"
fi

# build
VERBOSE_BUILD=${VERBOSE_BUILD:-"OFF"}
if [[ "${VERBOSE_BUILD}" == "ON" ]]; then
Expand Down
3 changes: 2 additions & 1 deletion .gitlab/lassen-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ lassen_gcc_cuda_bench:
matrix:
- COMPILER_SPEC: [email protected]
CUDA_SPEC: [[email protected]]
CALIPER_DIR: /usr/workspace/sundials/califiles
variables:
SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 build_type=Release precision=double scheduler=lsf caliper-dir=/usr/workspace/sundials/califiles ~int64 +benchmarks+profiling+caliper+adiak+mpi+openmp+cuda+raja cuda_arch=70 ^raja+cuda~openmp~examples~exercises cuda_arch=70 ^caliper+adiak+cuda cuda_arch=70 ^${CUDA_SPEC}+allow-unsupported-compilers"
SPEC: "%${COMPILER_SPEC} cstd=99 cxxstd=14 build_type=Release precision=double scheduler=lsf caliper-dir=${CALIPER_DIR} ~int64 +benchmarks+profiling+caliper+adiak+mpi+openmp+cuda+raja cuda_arch=70 ^raja+cuda~openmp~examples~exercises cuda_arch=70 ^caliper+adiak+cuda cuda_arch=70 ^${CUDA_SPEC}+allow-unsupported-compilers"
extends: .lassen_build_and_bench

3 changes: 2 additions & 1 deletion src/sundials/sundials_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ void sunAdiakCollectMetadata() {
adiak_namevalue("fortran_compiler_version", 2, NULL, "%s", SUN_FORTRAN_COMPILER_VERSION);
adiak_namevalue("fortran_compiler_flags", 2, NULL, "%s", SUN_FORTRAN_COMPILER_FLAGS);

adiak_namevalue("sundials_version", 2, NULL, "%s", SUNDIALS_GIT_VERSION);
adiak_namevalue("sundials_version", 2, NULL, "%s", SUNDIALS_VERSION);
adiak_namevalue("sundials_git_version", 2, NULL, "%s", SUNDIALS_GIT_VERSION);
adiak_namevalue("build_type", 2, NULL, "%s", SUN_BUILD_TYPE);
adiak_namevalue("third_party_libraries", 2, NULL, "%s", SUN_TPL_LIST);
#ifdef SUN_JOB_ID
Expand Down
87 changes: 87 additions & 0 deletions test/benchmark_analysis.ipynb
gardner48 marked this conversation as resolved.
Show resolved Hide resolved
gardner48 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import subprocess\n",
"import sys\n",
"import re\n",
"import glob\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from IPython.display import display, HTML\n",
"display(HTML(\"<style>.container { width:100% !important; }</style>\"))\n",
"\n",
"import hatchet as ht\n",
"import thicket as tt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Set desired pandas options\n",
"pd.set_option('display.max_rows', None)\n",
"pd.set_option('display.max_columns', None)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"caliDir = \"/usr/workspace/pan13/shrimp/Benchmarking/diffusion_2D/arkode_diffusion_2D_mpi_d2d_arkode_serial\"\n",
balos1 marked this conversation as resolved.
Show resolved Hide resolved
"caliFiles = glob.glob(\"%s/*.cali\" % caliDir)\n",
"\n",
"th_bench = tt.Thicket.from_caliperreader(caliFiles)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df_merge = th_bench.dataframe.merge(th_bench.metadata, on='profile')\n",
"df_merge['launchdate'] = pd.to_datetime(df_merge['launchdate'], unit='s')\n",
"\n",
"# display only the top-most node\n",
"df_main = df_merge[df_merge['name'] == 'main']\n",
"df_main.set_index('launchdate')\n",
"\n",
"# adjust y-axis to be 2 degrees of precision\n",
"df_main.plot(x='launchdate', y=['Max time/rank', 'Avg time/rank', 'Min time/rank'], kind='line', use_index=True, xticks=df_main['launchdate'], rot=80, x_compat=True, figsize=(18,1))\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
108 changes: 108 additions & 0 deletions test/compare_benchmarks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# -----------------------------------------------------------------------------
gardner48 marked this conversation as resolved.
Show resolved Hide resolved
# Programmer(s): Yu Pan @ LLNL
# -----------------------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2023, Lawrence Livermore National Security
# and Southern Methodist University.
# All rights reserved.
#
# See the top-level LICENSE and NOTICE files for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# SUNDIALS Copyright End
# -----------------------------------------------------------------------------

import os
balos1 marked this conversation as resolved.
Show resolved Hide resolved
import glob
import argparse
import multiprocessing as mp

import thicket as tt


def main():
parser = argparse.ArgumentParser(description='Compare Sundials performance results against previous results')

parser.add_argument('--release', dest='release', action='store_true', help='indicate if the current run to process is a release')

parser.add_argument('--calidir', dest='caliDir', type=str, help='path to directory containing caliper files', default="/usr/workspace/sundials/califiles")

parser.add_argument('--releasedir', dest='releaseDir', type=str, help='path to directory containing release caliper files', default="/usr/workspace/sundials/califiles/Release")

parser.add_argument('--outpath', dest='outPath', type=str, help='path to directory to write results to', default="/dev/null")

parser.add_argument('--jobid', dest='jobID', type=int, help='job id of the current run to identify .cali files')

parser.add_argument('--threshold', dest="threshold", type=float, help='the percentage threshold in performance difference that indicates a regression', default=2.0)

args = parser.parse_args()

release = args.release
releaseDir = args.releaseDir
caliDir = args.caliDir
outPath = args.outPath
jobID = args.jobID
threshold = args.threshold

# Get available benchmarks
benchFiles = glob.glob("%s/Benchmarking/*/*" % caliDir)

if not os.path.exists(outPath):
os.makedirs(outPath)
outFile = open("%s/benchmark_output.out" % outPath, 'w')

# thread per file
with mp.Pool() as pool:
for res in pool.starmap(process_benchmark, [(jobID, release, releaseDir, i, threshold) for i in benchFiles]):
if res:
outFile.write(res + "\n")
outFile.close()

outFile = open("%s/benchmark_output.out" % outPath, 'r')
try:
outLines = outFile.readlines()
finally:
outFile.close()

if (len(outLines) == 0):
return -1
return 0

def process_benchmark(jobID, isRelease, releaseDir, benchmarkDir, threshold):
# Get the current benchmark run
benchmarkFiles = glob.glob("%s/*.cali" % benchmarkDir)
# Don't compare if the run didn't include this benchmark
if (len(benchmarkFiles) == 0):
return

th_files = tt.Thicket.from_caliperreader(benchmarkFiles)
curFilter = lambda x: x['job_id'] == jobID
th_current = th_files.filter_metadata(curFilter)

# Get the release caliper file
cluster = th_current.metadata['cluster'].values[0]
if isRelease:
# Get the last release
versionDirs = glob.glob("%s/%s/*" % (releaseDir, cluster))
versionDirs.sort(key=os.path.getmtime, reverse=True)
versionDir = versionDirs[1]
else:
# Get the release the run is a part of
version = th_current.metadata['sundials_version'].values[0]
versionDir = "%s/%s/%s" % (releaseDir, cluster, version)
benchmarkName = th_current.metadata['env.TEST_NAME'].values[0]
releaseFile = glob.glob("%s/Benchmarking/*/%s/*.cali" % (versionDir, benchmarkName), recursive=True)
th_compare = tt.Thicket.from_caliperreader(releaseFile)
metrics = ['Max time/rank']
tt.mean(th_current, columns=metrics)
tt.mean(th_compare, columns=metrics)

ratio = th_current.statsframe.dataframe['Max time/rank_mean'] / th_compare.statsframe.dataframe['Max time/rank_mean']

tolerance = threshold/100
if 1 - ratio[0] < tolerance:
return benchmarkName


if __name__ == "__main__":
main()
115 changes: 115 additions & 0 deletions test/compare_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#!/usr/bin/env python3
# -----------------------------------------------------------------------------
# Programmer(s): Yu Pan @ LLNL
# -----------------------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2023, Lawrence Livermore National Security
# and Southern Methodist University.
# All rights reserved.
#
# See the top-level LICENSE and NOTICE files for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# SUNDIALS Copyright End
# -----------------------------------------------------------------------------

import os
balos1 marked this conversation as resolved.
Show resolved Hide resolved
import subprocess
import sys
import re
import glob
import argparse
import multiprocessing as mp
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

import hatchet as ht
import thicket as tt

def main():
parser = argparse.ArgumentParser(description='Compare Sundials performance results against previous results')

parser.add_argument('--release', dest='release', action='store_true', help='indicate if the current run to process is a release')

parser.add_argument('--calidir', dest='caliDir', type=str, help='path to directory containing caliper files', default="/usr/workspace/sundials/califiles")

parser.add_argument('--releasedir', dest='releaseDir', type=str, help='path to directory containing release caliper files', default="/usr/workspace/sundials/califiles/Release")

parser.add_argument('--outpath', dest='outPath', type=str, help='path to directory to write results to', default="/dev/null")

parser.add_argument('--threshold', dest="threshold", type=float, help='the percentage threshold in performance difference that indicates a regression', default=2.0)

args = parser.parse_args()

release = args.release
releaseDir = args.releaseDir
caliDir = args.caliDir
outPath = args.outPath
threshold = args.threshold

# Get the latest test run
runDirs = glob.glob("%s/Testing/*" % caliDir, recursive = True)
runDirs.sort(key=os.path.getmtime, reverse=True)
runDir = runDirs[0]

runFile = glob.glob(runDir)[0]
th_temp = tt.Thicket.from_caliperreader(runFile)
cluster = th_temp.metadata['cluster']
# get machine from the file
if release:
# Compare against the last release
versionDirs = glob.glob("%s/%s/*" % (releaseDir, cluster))
versionDirs.sort(key=os.path.getmtime, reverse=True)
versionDir = versionDirs[1]
else:
# Compare against the release the run is a part of
version = th_temp.metadata['sundials_version'].values[0]
versionDir = "%s/%s/%s" % (releaseDir, cluster, version)

# Gather files to process
runFiles = glob.glob("%s/*.cali" % (runDir))

if not os.path.exists(outPath):
os.makedirs(outPath)
outFile = open("%s/output.out" % outPath, 'w')

# Compare test results against past runs. If a test performs below a threshold, output test name to outFile.
with mp.Pool() as pool:
for res in pool.starmap(compare_against_release, [(versionDir, i, threshold) for i in runFiles]):
if res:
outFile.write(res + "\n")
outFile.close()

outFile = open("%s/example_output.out" % outPath, 'r')
try:
outLines = outFile.readlines()
finally:
outFile.close()

if (len(outLines) == 0):
return -1
return 0


def compare_against_release(releaseDir, file, threshold):
th = tt.Thicket.from_caliperreader(file)

testName = th.metadata['env.TEST_NAME'].values[0]

# Gather release run
releaseFile = glob.glob("%s/Testing/*/%s.*.cali" % (releaseDir, testName), recursive=True)
th_release = tt.Thicket.from_caliperreader(releaseFile)

metrics = ['Max time/rank']
tt.mean(th_release, columns=metrics)
tt.mean(th, columns=metrics)

ratio = th.statsframe.dataframe['Max time/rank_mean'] / th_release.statsframe.dataframe['Max time/rank_mean']
print(ratio[0])
tolerance = threshold/100
if 1 - ratio[0] < tolerance:
return testName

if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions test/testRunner
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ def main():
dateTime = datetime.datetime.now().strftime("%m%d%Y_%H%M%S")
profilePath = os.path.join(caliDir, args.testName+".%s.cali" % dateTime)
os.environ['CALI_SERVICES_ENABLE'] = 'env'
os.environ['TEST_NAME'] = testName
os.environ['CALI_ENV_EXTRA'] = 'TEST_NAME'
os.environ['CALI_CONFIG'] = 'spot(output=%s)' % profilePath

# if user supplies precision info overide the default choices
Expand Down