From 22004a7eee86e2bf8512eee60465ff3950bd7ae3 Mon Sep 17 00:00:00 2001 From: Riyaz Haque Date: Thu, 30 Nov 2023 13:11:46 -0800 Subject: [PATCH 1/2] Use cmake to build amg2023 (#63) Use default amg2023 package.py based on cmake --- repo/amg2023/package.py | 67 ----------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 repo/amg2023/package.py diff --git a/repo/amg2023/package.py b/repo/amg2023/package.py deleted file mode 100644 index 328188f81..000000000 --- a/repo/amg2023/package.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -from spack.package import * - - -class Amg2023(MakefilePackage, CudaPackage, ROCmPackage): - """AMG2023 is a parallel algebraic multigrid solver for linear systems - arising from problems on unstructured grids. The driver provided here - builds linear systems for various 3-dimensional problems. It requires - an installation of hypre-2.27.0 or higher. - """ - - tags = ["benchmark"] - homepage = "https://github.com/LLNL/AMG2023" - git = "https://github.com/LLNL/AMG2023.git" - - version("develop", branch="main") - - variant("mpi", default=True, description="Enable MPI support") - variant("openmp", default=False, description="Enable OpenMP support") - - depends_on("hypre@2.27.0:") - depends_on("mpi", when="+mpi") - - def edit(self, spec, prefix): - makefile = FileFilter('Makefile') - if "+mpi" in spec: - makefile.filter('CC = .*', 'CC = {0}'.format(spec["mpi"].mpicc)) - makefile.filter('CXX = .*', 'CXX = {0}'.format(spec["mpi"].mpicxx)) - else: - makefile.filter('CC = .*', 'CC = {0}'.format(spack_cc)) - makefile.filter('CXX = .*', 'CXX = {0}'.format(spack_cc)) - - makefile.filter('HYPRE_DIR = .*', 'HYPRE_DIR = {0}'.format(self.spec['hypre'].prefix)) - - if "+cuda" in spec: - makefile.filter('HYPRE_CUDA_PATH = .*', 'HYPRE_CUDA_PATH = %s' % (spec["cuda"].prefix)) - makefile.filter('HYPRE_CUDA_INCLUDE = #', 'HYPRE_CUDA_INCLUDE = ') - makefile.filter('HYPRE_CUDA_LIBS = #', 'HYPRE_CUDA_LIBS = ') - makefile.filter('HYPRE_HIP_PATH =', '#HYPRE_HIP_PATH =') - makefile.filter('HYPRE_HIP_INCLUDE =', '#HYPRE_HIP_INCLUDE =') - makefile.filter('HYPRE_HIP_LIBS =', '#HYPRE_HIP_LIBS =') - - if "+rocm" in spec: - makefile.filter('HYPRE_HIP_PATH = .*', f'HYPRE_HIP_PATH = {spec["hip"].prefix}') - else: - makefile.filter('HYPRE_HIP_PATH =', '#HYPRE_HIP_PATH =') - makefile.filter('HYPRE_HIP_INCLUDE =', '#HYPRE_HIP_INCLUDE =') - makefile.filter('HYPRE_HIP_LIBS =', '#HYPRE_HIP_LIBS =') - - if "+mpi" in spec: - makefile.filter('#MPIPATH = .*', 'MPIPATH = {0}'.format(spec["mpi"].prefix)) - makefile.filter('#MPIINCLUDE', 'MPIINCLUDE') - if spec["mpi"].extra_attributes and "ldflags" in spec["mpi"].extra_attributes: - makefile.filter('#MPILIBS = .*', 'MPILIBS = {0}'.format(spec["mpi"].extra_attributes["ldflags"])) - else: - makefile.filter('#MPILIBDIRS', 'MPILIBDIRS') - makefile.filter('#MPILIBS', 'MPILIBS') - makefile.filter('#MPIFLAGS', 'MPIFLAGS') - - def install(self, spec, prefix): - make() - mkdirp(prefix.bin) - install("amg", prefix.bin) From dc268ef670cdde7cbe636a85f90dac6f2c600252 Mon Sep 17 00:00:00 2001 From: pearce8 Date: Thu, 30 Nov 2023 15:59:01 -0600 Subject: [PATCH 2/2] Set of experiments (#60) * Rename option `workspace_root` to `experiments_root` (avoid confusion with Ramble workspace directory created for each experiment) * Add documentation section on reusing an `experiments_root` for multiple experiments * Fix comments referring to directory layout of `experiments_root` (this is repeated in several places, and was no longer correct after the Spack/Ramble clone locations were updated in 845cedd) --- bin/benchpark | 32 +++++++++++----------- docs/4-benchpark-setup.rst | 26 +++++++++--------- docs/5-build-experiment.rst | 13 +++++---- docs/experiments_root_structure.rst | 19 +++++++++++++ docs/index.rst | 6 +++++ docs/set-of-experiments.rst | 41 +++++++++++++++++++++++++++++ 6 files changed, 100 insertions(+), 37 deletions(-) create mode 100644 docs/experiments_root_structure.rst create mode 100644 docs/set-of-experiments.rst diff --git a/bin/benchpark b/bin/benchpark index 51802912d..780a2475e 100755 --- a/bin/benchpark +++ b/bin/benchpark @@ -125,17 +125,19 @@ def benchpark_check_system(arg_str): def benchpark_setup(subparsers, actions_dict): create_parser = subparsers.add_parser( - "setup", help="Create a benchmark and prepare it to build/run" + "setup", help="Set up an experiment and prepare it to build/run" ) create_parser.add_argument( - "benchmark", type=str, help="The benchmark/experiment to run" + "benchmark", type=str, help="The experiment (benchmark/ProgrammingModel) to run" ) - create_parser.add_argument("system", type=str, help="The system we are on") create_parser.add_argument( - "workspace_root", + "system", type=str, help="The system on which to run the experiment" + ) + create_parser.add_argument( + "experiments_root", type=str, - help="Where to install packages, store results, etc. (should be empty/nonexistent)", + help="Where to install packages and store results for the experiments. Benchpark expects to manage this directory, and it should be empty/nonexistent the first time you run benchpark setup experiments.", ) actions_dict["setup"] = benchpark_setup_handler @@ -173,23 +175,23 @@ def symlink_tree(src, dst): def benchpark_setup_handler(args): """ - workspace_root/ + experiments_root/ + spack/ + ramble/ / / workspace/ configs/ (everything from source/configs/) (everything from source/experiments/) - spack/ - ramble/ """ benchmark = args.benchmark system = args.system - workspace_root = pathlib.Path(os.path.abspath(args.workspace_root)) + experiments_root = pathlib.Path(os.path.abspath(args.experiments_root)) source_dir = source_location() debug_print(f"source_dir = {source_dir}") - debug_print(f"specified benchmark = {benchmark}") + debug_print(f"specified benchmark/ProgrammingModel = {benchmark}") valid_benchmark = benchpark_check_benchmark(benchmark) debug_print(f"specified system = {system}") valid_system = benchpark_check_system(system) @@ -200,7 +202,7 @@ def benchpark_setup_handler(args): ) ) - workspace_dir = workspace_root / str(benchmark) / str(system) + workspace_dir = experiments_root / str(benchmark) / str(system) if workspace_dir.exists(): if workspace_dir.is_dir(): @@ -226,8 +228,8 @@ def benchpark_setup_handler(args): symlink_tree(configs_src_dir, ramble_configs_dir) symlink_tree(experiment_src_dir, ramble_configs_dir) - spack_location = workspace_root / "spack" - ramble_location = workspace_root / "ramble" + spack_location = experiments_root / "spack" + ramble_location = experiments_root / "ramble" spack_exe = spack_location / "bin" / "spack" ramble_exe = ramble_location / "bin" / "ramble" @@ -261,14 +263,12 @@ def benchpark_setup_handler(args): instructions = f"""\ To complete the benchpark setup, do the following: - cd {workspace_dir}/workspace - . {spack_location}/share/spack/setup-env.sh . {ramble_location}/share/ramble/setup-env.sh export SPACK_DISABLE_LOCAL_CONFIG=1 -Further steps are needed to build the experiments (ramble -P -D . workspace setup) and run them (ramble -P -D . on) +Further steps are needed to build the experiments (ramble -P -D {ramble_workspace_dir} workspace setup) and run them (ramble -P -D {ramble_workspace_dir} on) """ print(instructions) diff --git a/docs/4-benchpark-setup.rst b/docs/4-benchpark-setup.rst index 8b73c9e85..f1e63cfbb 100644 --- a/docs/4-benchpark-setup.rst +++ b/docs/4-benchpark-setup.rst @@ -3,25 +3,25 @@ Benchpark Setup =============== Select a benchmark experiment to run, along with the programming model to use, and a system to run them on. -Also choose the workspace for your experiment:: +Also choose a directory for your experiment:: - benchpark setup benchmark/ProgrammingModel system /output/path/to/workspace_root + benchpark setup benchmark/ProgrammingModel system /output/path/to/experiments_root where: -- ``benchmark/ProgrammingModel``: amg2023/openmp | amg2023/cuda | saxpy/openmp (available choices in benchpark/experiments) -- ``system``: ats2 | ats4 | cts1 (available choices in benchpark/configs) +- ``benchmark/ProgrammingModel``: amg2023/openmp | amg2023/cuda | saxpy/openmp (available choices in ``benchpark/experiments``) +- ``system``: ats2 | ats4 | cts1 (available choices in ``benchpark/configs``) -This command will assemble a Ramble workspace -with a configuration for the specified benchmark and system +This command will assemble a Ramble workspace per experiment +with a configuration for the specified benchmark and system with the following directory structure:: - workspace_root/ + experiments_root/ + ramble/ + spack/ / / / - ramble/ - spack/ workspace/ configs/ (everything from source/configs/) @@ -29,11 +29,9 @@ with the following directory structure:: ``benchpark setup`` will output instructions to follow:: - cd ///workspace - - . ///spack/share/spack/setup-env.sh - . ///ramble/share/ramble/setup-env.sh + . /spack/share/spack/setup-env.sh + . /ramble/share/ramble/setup-env.sh export SPACK_DISABLE_LOCAL_CONFIG=1 -Now you are ready to build your experiments as described in :doc:`5-build-experiment`. +Now you are ready to compile your experiments as described in :doc:`5-build-experiment`. diff --git a/docs/5-build-experiment.rst b/docs/5-build-experiment.rst index 868565d50..9021ac368 100644 --- a/docs/5-build-experiment.rst +++ b/docs/5-build-experiment.rst @@ -2,21 +2,21 @@ Build experiment ================ -``benchpark setup`` has set up the directory structure for your experiment. +``benchpark setup`` has set up the directory structure for your experiment. The next step is setting up the Ramble workspace and building the code:: - cd ///workspace - ramble -P -D . workspace setup + cd ///workspace + ramble -P -D . workspace setup Ramble will build the source code and set up the following workspace directory structure:: - workspace_root/ + experiments_root/ + ramble/ + spack/ / / / - ramble/ - spack/ workspace/ configs/ (everything from source/configs/) @@ -27,6 +27,5 @@ Ramble will build the source code and set up the following workspace directory s __ execute_experiment - If you edit any of the files, see :doc:`FAQ-what-to-rerun` to determine whether you need to re-do any of the previous steps. diff --git a/docs/experiments_root_structure.rst b/docs/experiments_root_structure.rst new file mode 100644 index 000000000..9fac7b94c --- /dev/null +++ b/docs/experiments_root_structure.rst @@ -0,0 +1,19 @@ +For each ``experiment`` (``benchmark`` x ``ProgrammingModel`` x ), +Ramble sets up the following ``workspace`` directory structure +to build and run the experiment:: + + experiments_root/ + ramble/ + spack/ + / + / + / + workspace/ + configs/ + (everything from source/configs/) + (everything from source/experiments/) + experiments/ + / + / + __ + execute_experiment diff --git a/docs/index.rst b/docs/index.rst index 6ba9f0b6e..ae7d83727 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -21,3 +21,9 @@ add-a-benchmark add-an-experiment add-a-system-config + +.. toctree:: + :maxdepth: 1 + :caption: Benchmark Suites + + set-of-experiments diff --git a/docs/set-of-experiments.rst b/docs/set-of-experiments.rst new file mode 100644 index 000000000..a85f57824 --- /dev/null +++ b/docs/set-of-experiments.rst @@ -0,0 +1,41 @@ +============== +Working with a set of experiments +============== + +You may want to use the same experiments_root directory when setting up multiple experiments: + +* Benchpark only stores one copy of Spack/Ramble per experiments directory, + and does not repeatedly download them when reusing the experiments directory. +* Since each experiment in the experiments directory shares the Spack/Ramble instances, + the edits/updates you make to Spack packages will apply to all experiments + in your experiments directory. + +To use the same experiments directory when setting up multiple experiments, +instruct benchpark to set them up in the same experiments_root:: + + benchpark setup benchmark1/ProgrammingModel1 system1 /output/path/to/experiments_root + benchpark setup benchmark1/ProgrammingModel2 system2 /output/path/to/experiments_root + benchpark setup benchmark2/ProgrammingModel2 system1 /output/path/to/experiments_root + +This will result in the following directory structure:: + + experiments_root/ + ramble/ + spack/ + benchmark1/ + ProgrammingModel1/ + system1/ + workspace/ + ProgrammingModel2/ + system2/ + workspace/ + benchmark2/ + ProgrammingModel2/ + system1/ + workspace/ + +Note that there is a single clone of Ramble, and a single clone of Spack, +which all of the ``experiments`` use. +Each ``experiment`` (``benchmark/ProgrammingModel`` x ``system`` combination) +has its own ``Ramble workspace``, where this specific ``experiment`` +will be compiled and run.