Skip to content

Commit

Permalink
namd: add compile options for ROCm (spack#45553)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
BOUDAOUD34 and U-PALLAS\boudaoud authored Aug 7, 2024
1 parent 60c589d commit 46efa7e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion var/spack/repos/builtin/packages/namd/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
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."""

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -294,6 +297,14 @@ def edit(self, spec, prefix):
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)
Expand Down

0 comments on commit 46efa7e

Please sign in to comment.