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

Run Pre-built Binary #616

Merged
merged 16 commits into from
Mar 17, 2025
Merged

Run Pre-built Binary #616

merged 16 commits into from
Mar 17, 2025

Conversation

michaelmckinsey1
Copy link
Collaborator

@michaelmckinsey1 michaelmckinsey1 commented Feb 13, 2025

Description

resolves #609
This PR enables running an experiment using an existing binary, i.e. not requiring building with spack. The environment-modules package manager is used instead, for ramble to load necessary modules for the binary. Includes a refactor of the compute_spack_section() function, into a generalized compute_package_section(), such that other package managers can share the same functionalities.

  • Test benchmark binaries:
    • osu-micro-benchmarks
    • stream
  • Do not clone spack if the package manager is not spack
  • Add CI
  • Add docs

Adding/modifying a benchmark (docs: Adding a Benchmark)

  • Modify lib/benchpark/experiment.py to enable environment-modules package manager and appending the binary location to PATH.
  • Modify lib/benchpark/cmd/setup.py to not setup spack if package manager is not spack.
  • Modify experiments/*.py to refactor compute_package_section() function.

Example usage

Expected binary osu_latency in provided external path /usr/workspace/wsa/mckinsey/osu-micro-benchmarks/mpi/pt2pt:

benchpark experiment init --dest=osumb osu-micro-benchmarks package_manager="environment-modules" workload="osu_latency" append_path="/usr/workspace/wsa/mckinsey/bin/osu-micro-benchmarks/mpi/pt2pt"
benchpark setup ./osumb/ ./ruby-system/ osumb-ruby/

results in new clause in experiment ramble.yaml:

env_vars:
    append:
    - paths:
        PATH: /usr/workspace/wsa/mckinsey/osu-micro-benchmarks/mpi/pt2pt
    set: {}

execute_experiment will now include:

export PATH="${PATH}:/usr/workspace/wsa/mckinsey/bin/osu-micro-benchmarks/mpi/pt2pt";
. /usr/WS1/mckinsey/benchpark/osumb-ruby/osumb/LlnlCluster-9751dbe/workspace/software/environment-modules/osu-micro-benchmarks/module_loads
srun -N 2 osu_latency ...

@michaelmckinsey1 michaelmckinsey1 self-assigned this Feb 13, 2025
@github-actions github-actions bot added the experiment New or modified experiment label Feb 13, 2025
@michaelmckinsey1
Copy link
Collaborator Author

michaelmckinsey1 commented Feb 13, 2025

Ignore this comment. Current version requires no changes to ramble.

This currently requires a change to ramble that I don't know how to avoid (to prepend the path in execute_experiment).

+++ b/var/ramble/repos/builtin/package_managers/environment-modules/package_manager.py
@@ -95,6 +95,14 @@ class EnvironmentModules(PackageManagerBase):
         with open(module_file_path, "w+") as f:
             f.write(loads_content)
 
+    register_builtin("add_to_path")
+
+    def add_to_path(self):
+        paths = []
+        for p in self.app_inst.variables["binary_path"]:
+            paths.append("PATH="+p+":"+"$PATH")
+        return paths
+
     register_builtin("module_load", required=True)
 
     def module_load(self):

@pearce8
Copy link
Collaborator

pearce8 commented Feb 13, 2025

@scheibelp @becker33 Please assess the design. Also please suggest how we can prepend the path in execute_experiment - or help formulate a question for Doug.

@pearce8 pearce8 requested a review from nhanford February 13, 2025 20:33
@michaelmckinsey1 michaelmckinsey1 force-pushed the feature/pre-built-binary-609 branch 2 times, most recently from ab1c119 to de64c57 Compare February 25, 2025 20:41
@github-actions github-actions bot added the ci CI, unit tests, GitHub actions label Feb 26, 2025
@michaelmckinsey1 michaelmckinsey1 force-pushed the feature/pre-built-binary-609 branch from e4e20b0 to 2f0c102 Compare February 26, 2025 17:46
@michaelmckinsey1 michaelmckinsey1 marked this pull request as ready for review February 26, 2025 17:47
@michaelmckinsey1 michaelmckinsey1 force-pushed the feature/pre-built-binary-609 branch from ac40cba to 97fd27c Compare February 27, 2025 23:26
@michaelmckinsey1
Copy link
Collaborator Author

@scheibelp @becker33 Please assess the design. Also please suggest how we can prepend the path in execute_experiment - or help formulate a question for Doug.

The path part has been figured out. We are using an existing ramble interface to append to the path.

@michaelmckinsey1 michaelmckinsey1 requested a review from pearce8 March 6, 2025 19:11
@michaelmckinsey1 michaelmckinsey1 added the ready for review Ready for review label Mar 6, 2025
)
self.add_spack_spec(
self.name, [f"quicksilver@{app_version} +mpi", system_specs["compiler"]]
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like all of these individual subclasses of Experiment could be left alone, and you could skip compute_spack_section in compute_package_section_wrapper if package_manager is not spack. Am I missing something? It looks like all these functions are turned effectively into noops when the package manager is not spack, so it seems like it would make sense to skip the function altogether.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Upon checking, the environment-modules manager in ramble actually does need this information, to create the file where modules are loaded. I removed the if-statements in the subclasses 313ff73. Having the package_specs be empty for non-spack managers was a mistake.

Copy link
Collaborator

@pearce8 pearce8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please add a test of a binary in dry runs. Maybe build/run saxpy as is now, then run that binary?
  2. Please add a docs page showing your example. Maybe call the page "Running a binary using Benchpark" and put it last under the "Running Benchpark" section.

@michaelmckinsey1 michaelmckinsey1 force-pushed the feature/pre-built-binary-609 branch 6 times, most recently from 03d35fc to fa56c6e Compare March 7, 2025 22:24
@michaelmckinsey1
Copy link
Collaborator Author

michaelmckinsey1 commented Mar 7, 2025

  1. Please add a test of a binary in dry runs. Maybe build/run saxpy as is now, then run that binary?

    1. Please add a docs page showing your example. Maybe call the page "Running a binary using Benchpark" and put it last under the "Running Benchpark" section.
  1. Done in efa22ab
  2. 13e7d0c

@github-actions github-actions bot added the docs Improvements or additions to documentation label Mar 7, 2025
   - 'environment-modules' package manager as alternative to spack
   - Enable appending to path in execute_experiment job file
@michaelmckinsey1 michaelmckinsey1 force-pushed the feature/pre-built-binary-609 branch from 13e7d0c to eaa6dc1 Compare March 13, 2025 23:43
@pearce8 pearce8 merged commit f6a3dbe into develop Mar 17, 2025
11 checks passed
@pearce8 pearce8 deleted the feature/pre-built-binary-609 branch March 17, 2025 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci CI, unit tests, GitHub actions docs Improvements or additions to documentation experiment New or modified experiment ready for review Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to run a pre-built binary
3 participants