summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBOUDAOUD34 <114594090+BOUDAOUD34@users.noreply.github.com>2024-08-07 19:54:33 +0200
committerGitHub <noreply@github.com>2024-08-07 10:54:33 -0700
commit46efa7e15144c9abf469cc7a22ee185e13a162db (patch)
tree307e4bdeb2b5d4f722e39f4fb96d3f45512cbf7b
parent60c589db28d5de31581a9bae2d0ecb0952712c5f (diff)
downloadspack-46efa7e15144c9abf469cc7a22ee185e13a162db.tar.gz
spack-46efa7e15144c9abf469cc7a22ee185e13a162db.tar.bz2
spack-46efa7e15144c9abf469cc7a22ee185e13a162db.tar.xz
spack-46efa7e15144c9abf469cc7a22ee185e13a162db.zip
namd: add compile options for ROCm (#45553)
* namd:add compile options for ROCm * Combine --rocm-prefix and its value in a single opts.extend call to ensure they remain ordered correctly and improve code robustness. * Standardize the code and add ROCm conflicts * add single_node_gpu conflict --------- Co-authored-by: U-PALLAS\boudaoud <boudaoud@pc44.pallas.cines.fr>
-rw-r--r--var/spack/repos/builtin/packages/namd/package.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/namd/package.py b/var/spack/repos/builtin/packages/namd/package.py
index 80446885fc..2b62c3ea79 100644
--- a/var/spack/repos/builtin/packages/namd/package.py
+++ b/var/spack/repos/builtin/packages/namd/package.py
@@ -12,7 +12,7 @@ import llnl.util.tty as tty
from spack.package import *
-class Namd(MakefilePackage, CudaPackage):
+class Namd(MakefilePackage, CudaPackage, ROCmPackage):
"""NAMD is a parallel molecular dynamics code designed for
high-performance simulation of large biomolecular systems."""
@@ -104,6 +104,9 @@ class Namd(MakefilePackage, CudaPackage):
depends_on("python", when="interface=python")
conflicts("+avxtiles", when="@:2.14,3:", msg="AVXTiles algorithm requires NAMD 2.15")
+ conflicts("+rocm", when="~single_node_gpu")
+ conflicts("+rocm", when="+cuda", msg="NAMD supports only one GPU backend at a time")
+ conflicts("+single_node_gpu", when="~cuda~rocm")
# https://www.ks.uiuc.edu/Research/namd/2.12/features.html
# https://www.ks.uiuc.edu/Research/namd/2.13/features.html
@@ -294,6 +297,14 @@ class Namd(MakefilePackage, CudaPackage):
if "+single_node_gpu" in spec:
opts.extend(["--with-single-node-cuda"])
+ if "+rocm" in spec:
+ self._copy_arch_file("hip")
+ opts.append("--with-hip")
+ opts.extend(["--rocm-prefix", os.environ["ROCM_PATH"]])
+
+ if "+single_node_gpu" in spec:
+ opts.extend(["--with-single-node-hip"])
+
config = Executable("./config")
config(self.build_directory, *opts)