-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* gromacs rocm * gromacs rocm * gromacs openmp * gromacs cuda * lint * lint * lint * system changes * Remove dead code * Remove rocm consistency package, update llvlm version * Add dry runs * workflows * workflows * workflows * workflows --------- Co-authored-by: Riyaz Haque <[email protected]> Co-authored-by: pearce8 <[email protected]>
- Loading branch information
1 parent
9fe414b
commit 7a7380a
Showing
15 changed files
with
359 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# Copyright 2023 Lawrence Livermore National Security, LLC and other | ||
# Benchpark Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from benchpark.directives import variant | ||
from benchpark.experiment import Experiment | ||
from benchpark.openmp import OpenMPExperiment | ||
from benchpark.cuda import CudaExperiment | ||
from benchpark.rocm import ROCmExperiment | ||
|
||
|
||
class Gromacs( | ||
Experiment, | ||
OpenMPExperiment, | ||
CudaExperiment, | ||
ROCmExperiment, | ||
): | ||
variant( | ||
"workload", | ||
default="water_gmx50_adac", | ||
description="workload name", | ||
) | ||
|
||
variant( | ||
"version", | ||
default="2024", | ||
values=("2024", "2023.3"), | ||
description="app version", | ||
) | ||
|
||
# off: turn off GPU-aware MPI | ||
# on: turn on, but allow groamcs to disable it if GPU-aware MPI is not supported | ||
# force: turn on and force gromacs to use GPU-aware MPI. May result in error if unsupported | ||
variant( | ||
"gpu-aware-mpi", | ||
default="on", | ||
values=("on", "off", "force"), | ||
description="Use GPU-aware MPI", | ||
) | ||
|
||
def compute_applications_section(self): | ||
if self.spec.satisfies("+openmp"): | ||
self.set_environment_variable("OMP_PROC_BIND", "close") | ||
self.set_environment_variable("OMP_PLACES", "cores") | ||
self.add_experiment_variable("n_threads_per_proc", 8, True) | ||
self.add_experiment_variable("n_ranks", 8, True) | ||
target = "cpu" | ||
bonded_target = "cpu" | ||
npme = "0" | ||
|
||
# Overrides +openmp settings | ||
if self.spec.satisfies("+cuda"): | ||
self.add_experiment_variable("n_gpus", 8, True) | ||
target = "gpu" | ||
bonded_target = "cpu" | ||
npme = "1" | ||
elif self.spec.satisfies("+rocm"): | ||
self.add_experiment_variable("n_gpus", 8, True) | ||
target = "gpu" | ||
bonded_target = "cpu" | ||
npme = "1" | ||
|
||
input_variables = { | ||
"target": f"{target}", | ||
"size": "1536", | ||
"dlb": "no", | ||
"pin": "off", | ||
"maxh": "0.05", | ||
"nsteps": "1000", | ||
"nstlist": "200", | ||
"npme": f"{npme}", | ||
} | ||
|
||
other_input_variables = { | ||
"nb": f"{target}", | ||
"pme": "auto", | ||
"bonded": f"{bonded_target}", | ||
"update": f"{target}", | ||
} | ||
|
||
for k, v in input_variables.items(): | ||
self.add_experiment_variable(k, v, True) | ||
for k, v in other_input_variables.items(): | ||
self.add_experiment_variable(k, v) | ||
|
||
def compute_spack_section(self): | ||
# get package version | ||
app_version = self.spec.variants["version"][0] | ||
|
||
# get system config options | ||
# TODO: Get compiler/mpi/package handles directly from system.py | ||
system_specs = {} | ||
system_specs["compiler"] = "default-compiler" | ||
system_specs["mpi"] = "default-mpi" | ||
system_specs["blas"] = "default-blas" | ||
system_specs["lapack"] = "default-lapack" | ||
|
||
# set package spack specs | ||
# empty package_specs value implies external package | ||
self.add_spack_spec(system_specs["mpi"]) | ||
# empty package_specs value implies external package | ||
self.add_spack_spec(system_specs["blas"]) | ||
# empty package_specs value implies external package | ||
self.add_spack_spec(system_specs["lapack"]) | ||
|
||
spack_specs = "+mpi~hwloc" | ||
spack_specs += "+sycl" if self.spec.satisfies("+rocm") else "~sycl" | ||
|
||
if self.spec.satisfies("+cuda") or self.spec.satisfies("+rocm"): | ||
spack_specs += f" gpu-aware-mpi={self.spec.variants['gpu-aware-mpi'][0]} " | ||
spack_specs += " ~double " | ||
else: | ||
spack_specs += " gpu-aware-mpi=off " | ||
|
||
self.add_spack_spec( | ||
self.name, | ||
[f"gromacs@{app_version} {spack_specs}", system_specs["compiler"]], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,9 @@ | |
import llnl.util.filesystem as fs | ||
|
||
from spack.package import * | ||
from spack.pkg.benchpark.rocm_consistency import RocmConsistency as RocmConsistency | ||
|
||
|
||
class Gromacs(CMakePackage, CudaPackage, ROCmPackage, RocmConsistency): | ||
class Gromacs(CMakePackage, CudaPackage, ROCmPackage): | ||
"""GROMACS is a molecular dynamics package primarily designed for simulations | ||
of proteins, lipids and nucleic acids. It was originally developed in | ||
the Biophysical Chemistry department of University of Groningen, and is now | ||
|
@@ -89,6 +88,16 @@ class Gromacs(CMakePackage, CudaPackage, ROCmPackage, RocmConsistency): | |
variant( | ||
"mpi", default=True, description="Activate MPI support (disable for Thread-MPI support)" | ||
) | ||
# off: turn off GPU-aware MPI | ||
# on: turn on, but allow groamcs to disable it if GPU-aware MPI is not supported | ||
# force: turn on and force gromacs to use GPU-aware MPI. May result in error if unsupported | ||
variant( | ||
"gpu-aware-mpi", | ||
default="on", | ||
values=("on", "off", "force"), | ||
when="@2021: +mpi", | ||
description="Use GPU-aware MPI", | ||
) | ||
variant("shared", default=True, description="Enables the build of shared libraries") | ||
variant( | ||
"double", | ||
|
@@ -279,6 +288,9 @@ class Gromacs(CMakePackage, CudaPackage, ROCmPackage, RocmConsistency): | |
depends_on("[email protected]:3", type="build", when="%fj") | ||
depends_on("cuda", when="+cuda") | ||
|
||
for target in ("none", "gfx803", "gfx900", "gfx906", "gfx908", "gfx90a", "gfx942"): | ||
requires(f"^[email protected]+rocm amdgpu_target={target}", when=f"gromacs@2024+rocm amdgpu_target={target}") | ||
|
||
with when("+rocm"): | ||
depends_on("sycl") | ||
depends_on("hip") | ||
|
@@ -407,6 +419,17 @@ def setup_run_environment(self, env): | |
if self.compiler.extra_rpaths: | ||
for rpath in self.compiler.extra_rpaths: | ||
env.prepend_path("LD_LIBRARY_PATH", rpath) | ||
if "+mpi" in self.spec: | ||
if self.spec["mpi"].extra_attributes and "ldflags" in self.spec["mpi"].extra_attributes: | ||
env.append_flags("LDFLAGS", self.spec["mpi"].extra_attributes["ldflags"]) | ||
|
||
def setup_build_environment(self, env): | ||
if self.compiler.extra_rpaths: | ||
for rpath in self.compiler.extra_rpaths: | ||
env.prepend_path("LD_LIBRARY_PATH", rpath) | ||
if "+mpi" in self.spec: | ||
if self.spec["mpi"].extra_attributes and "ldflags" in self.spec["mpi"].extra_attributes: | ||
env.append_flags("LDFLAGS", self.spec["mpi"].extra_attributes["ldflags"]) | ||
|
||
class CMakeBuilder(spack.build_systems.cmake.CMakeBuilder): | ||
@run_after("build") | ||
|
@@ -497,6 +520,27 @@ def cmake_args(self): | |
"-DMPI_CXX_COMPILER=%s" % self.spec["mpi"].mpicxx, | ||
] | ||
) | ||
if 'on' in self.spec.variants['gpu-aware-mpi'].value: | ||
options.extend( | ||
[ | ||
"-DGMX_ENABLE_DIRECT_GPU_COMM=ON", | ||
"-DGMX_FORCE_GPU_AWARE_MPI=OFF", | ||
] | ||
) | ||
elif 'force' in self.spec.variants['gpu-aware-mpi'].value: | ||
options.extend( | ||
[ | ||
"-DGMX_ENABLE_DIRECT_GPU_COMM=ON", | ||
"-DGMX_FORCE_GPU_AWARE_MPI=ON", | ||
] | ||
) | ||
if "+rocm" in self.spec: | ||
if self.spec["mpi"].extra_attributes and "ldflags" in self.spec["mpi"].extra_attributes: | ||
options.extend( | ||
[ | ||
"-DCMAKE_EXE_LINKER_FLAGS=%s" % self.spec["mpi"].extra_attributes["ldflags"], | ||
] | ||
) | ||
else: | ||
options.extend( | ||
[ | ||
|
@@ -570,14 +614,14 @@ def cmake_args(self): | |
options.append("-DCUDA_TOOLKIT_ROOT_DIR:STRING=" + self.spec["cuda"].prefix) | ||
|
||
target = self.spec.target | ||
if "+cuda" in self.spec and target.family == "ppc64le": | ||
if target.family == "ppc64le": | ||
options.append("-DGMX_EXTERNAL_LAPACK:BOOL=OFF") | ||
else: | ||
options.append("-DGMX_EXTERNAL_LAPACK:BOOL=ON") | ||
if self.spec["lapack"].libs: | ||
options.append("-DGMX_LAPACK_USER={0}".format(self.spec["lapack"].libs.joined(";"))) | ||
|
||
if "+cuda" in self.spec and target.family == "ppc64le": | ||
if target.family == "ppc64le": | ||
options.append("-DGMX_EXTERNAL_BLAS:BOOL=OFF") | ||
else: | ||
options.append("-DGMX_EXTERNAL_BLAS:BOOL=ON") | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.