Skip to content

Commit 6fe3b7f

Browse files
authored
[MC] NAMD (#204)
1 parent 419744d commit 6fe3b7f

15 files changed

+190
-85
lines changed

config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,10 @@ uenvs:
247247
"3.0":
248248
recipes:
249249
gh200: 3.0/gh200
250+
zen2: 3.0/mc
250251
deploy:
251252
daint: [gh200]
253+
eiger: [zen2]
252254
develop: False
253255
netcdf-tools:
254256
"2024":

recipes/namd/3.0/gh200/compilers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ bootstrap:
22
spec: gcc@12
33
gcc:
44
specs:
5-
- gcc@12.3
5+
- gcc@13

recipes/namd/3.0/gh200/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ description: "NAMD: Scalable Molecular Dynamics"
33
store: /user-environment
44
spack:
55
repo: https://github.com/spack/spack.git
6-
commit: v0.22.0
6+
commit: v0.23.1
77
modules: True

recipes/namd/3.0/gh200/environments.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
namd-single-node:
22
compiler:
33
- toolchain: gcc
4-
spec: gcc@12.3
4+
spec: gcc@13
55
unify: true
66
specs:
7-
- cuda@12.4
7+
- cuda@12.8
88
- [email protected] +openmp ~mpi
99
1010
- charmpp@=8.0.0 backend=multicore +production +tracing
@@ -24,10 +24,10 @@ namd-single-node:
2424
namd:
2525
compiler:
2626
- toolchain: gcc
27-
spec: gcc@12.3
27+
spec: gcc@13
2828
unify: true
2929
specs:
30-
- cuda@12.4
30+
- cuda@12.8
3131
3232
3333
- charmpp@=8.0.0 backend=mpi +production +tracing ^cray-mpich

recipes/namd/3.0/gh200/repo/packages/charmpp/ofi-crayshasta-arm-8.0.0.patch

Lines changed: 0 additions & 49 deletions
This file was deleted.

recipes/namd/3.0/gh200/repo/packages/charmpp/ofi-crayshasta-arm-7.0.0.patch renamed to recipes/namd/3.0/gh200/repo/packages/charmpp/ofi-crayshasta-arm.patch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
diff --git a/src/arch/ofi-crayshasta/conv-mach.h b/src/arch/ofi-crayshasta/conv-mach.h
2+
index 61d295df3..9e15fd2a9 100644
13
--- a/src/arch/ofi-crayshasta/conv-mach.h
24
+++ b/src/arch/ofi-crayshasta/conv-mach.h
35
@@ -74,7 +74,7 @@

recipes/namd/3.0/gh200/repo/packages/charmpp/package.py

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class Charmpp(Package):
2727
version("main", branch="main")
2828

2929
version(
30-
"8.0.0",
31-
sha256="e30fc1e921e5cbf3406e792d5b0ca5f211c5d8ffbfc56e56d5501d8118abcaf6",
32-
url="https://github.com/charmplusplus/charm/archive/refs/tags/v8.0.0.tar.gz"
30+
"8.0.0",
31+
sha256="e30fc1e921e5cbf3406e792d5b0ca5f211c5d8ffbfc56e56d5501d8118abcaf6",
32+
url="https://github.com/charmplusplus/charm/archive/refs/tags/v8.0.0.tar.gz",
3333
)
3434
version("7.0.0", sha256="9c247b421bb157bdf9bc0ced3e25738c7a1dc1f7ec57b7943a7faf97f7e4fb2e")
3535
version("6.10.2", sha256="7abb4cace8aebdfbb8006eac03eb766897c009cfb919da0d0a33f74c3b4e6deb")
@@ -45,6 +45,10 @@ class Charmpp(Package):
4545
version("6.6.0", sha256="c916010f2d4cc2c6bd30ea19764839d0298fb56d1696d8ff08d9fa9a61dfb1c9")
4646
version("6.5.1", sha256="68aa43e2a6e476e116a7e80e385c25c6ac6497807348025505ba8bfa256ed34a")
4747

48+
depends_on("c", type="build") # generated
49+
depends_on("cxx", type="build") # generated
50+
depends_on("fortran", type="build") # generated
51+
4852
# Support OpenMPI; see
4953
# <https://github.com/UIUC-PPL/charm/issues/1206>
5054
# Patch is no longer needed in versions 6.8.0+
@@ -64,8 +68,7 @@ class Charmpp(Package):
6468
patch("strictpass.patch", when="@:6.8.2")
6569

6670
# Support Cray Shasta with ARM
67-
patch("ofi-crayshasta-arm-7.0.0.patch", when="backend=ofi pmi=cray-pmi target=aarch64: @=7.0.0")
68-
patch("ofi-crayshasta-arm-8.0.0.patch", when="backend=ofi pmi=cray-pmi target=aarch64: @=8.0.0")
71+
patch("ofi-crayshasta-arm.patch", when="backend=ofi pmi=cray-pmi target=aarch64:")
6972

7073
# Build targets
7174
# "target" is reserved, so we have to use something else.
@@ -274,7 +277,7 @@ def charmarch(self):
274277

275278
def install(self, spec, prefix):
276279
if not ("backend=mpi" in self.spec) or not ("backend=netlrts" in self.spec):
277-
if "+pthreads" in self.spec:
280+
if self.spec.satisfies("+pthreads"):
278281
raise InstallError(
279282
"The pthreads option is only\
280283
available on the Netlrts and MPI \
@@ -286,7 +289,7 @@ def install(self, spec, prefix):
286289
or ("backend=ofi" in self.spec)
287290
or ("backend=gni" in self.spec)
288291
):
289-
if "pmi=none" in self.spec:
292+
if self.spec.satisfies("pmi=none"):
290293
raise InstallError(
291294
"The UCX/OFI/GNI backends need \
292295
PMI to run. Please add pmi=... \
@@ -299,7 +302,7 @@ def install(self, spec, prefix):
299302
or ("pmi=slurmpmi" in self.spec)
300303
or ("pmi=slurmpmi2" in self.spec)
301304
):
302-
if "^openmpi" in self.spec:
305+
if self.spec.satisfies("^openmpi"):
303306
raise InstallError(
304307
"To use any process management \
305308
interface other than PMIx, \
@@ -321,15 +324,15 @@ def install(self, spec, prefix):
321324
options.append("-j%d" % make_jobs)
322325
options.append("--destination=%s" % builddir)
323326

324-
if "pmi=slurmpmi" in spec:
327+
if spec.satisfies("pmi=slurmpmi"):
325328
options.append("slurmpmi")
326-
if "pmi=slurmpmi2" in spec:
329+
if spec.satisfies("pmi=slurmpmi2"):
327330
options.append("slurmpmi2")
328-
if "pmi=pmix" in spec:
331+
if spec.satisfies("pmi=pmix"):
329332
options.append("ompipmix")
330333
options.extend(["--basedir=%s" % spec["openmpi"].prefix])
331334

332-
if "backend=mpi" in spec:
335+
if spec.satisfies("backend=mpi"):
333336
# in intelmpi <prefix>/include and <prefix>/lib fails so --basedir
334337
# cannot be used
335338
options.extend(
@@ -339,38 +342,45 @@ def install(self, spec, prefix):
339342
["--libdir={0}".format(libdir) for libdir in spec["mpi"].libs.directories]
340343
)
341344

342-
if "backend=ucx" in spec:
345+
if spec.satisfies("backend=ucx"):
343346
options.extend(["--basedir=%s" % spec["ucx"].prefix])
344-
if "+papi" in spec:
347+
if spec.satisfies("+papi"):
345348
options.extend(["papi", "--basedir=%s" % spec["papi"].prefix])
346349
if "+smp" in spec and "backend=multicore" not in spec:
347350
# The 'multicore' backend always uses SMP, so we don't have to
348351
# append the 'smp' option when the 'multicore' backend is active. As
349352
# of Charm++ v7.0.0 it is actually a build error to append 'smp'
350353
# with the 'multicore' backend.
351354
options.append("smp")
352-
if "+tcp" in spec:
355+
if spec.satisfies("+tcp"):
353356
if "backend=netlrts" not in spec:
354357
# This is a Charm++ limitation; it would lead to a
355358
# build error
356359
raise InstallError(
357360
"The +tcp variant requires " "the backend=netlrts communication mechanism"
358361
)
359362
options.append("tcp")
360-
if "+omp" in spec:
363+
if spec.satisfies("+omp"):
361364
options.append("omp")
362-
if "+pthreads" in spec:
365+
if spec.satisfies("+pthreads"):
363366
options.append("pthreads")
364-
if "+cuda" in spec:
367+
if spec.satisfies("+cuda"):
365368
options.append("cuda")
366369

367-
if "+shared" in spec:
370+
if spec.satisfies("+shared"):
368371
options.append("--build-shared")
369-
if "+production" in spec:
372+
if spec.satisfies("+production"):
370373
options.append("--with-production")
371-
if "+tracing" in spec:
374+
if spec.satisfies("+tracing"):
372375
options.append("--enable-tracing")
373376

377+
# charmpp build was failing with clang based compilers for -DNETWORK=mpi as discussed in
378+
# https://github.com/charmplusplus/charm/issues/3645
379+
# Fix was suggested in https://github.com/charmplusplus/charm/pull/3646 and the same has
380+
# been implemented in v8.0.0
381+
if self.spec.satisfies("@8.0.0: %aocc"):
382+
options.append("--disable-fortran")
383+
374384
# Call "make" via the build script
375385
# Note: This builds Charm++ in the "tmp" subdirectory of the
376386
# install directory. Maybe we could set up a symbolic link

recipes/namd/3.0/gh200/repo/packages/namd/package.py

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99

1010
import llnl.util.tty as tty
1111

12+
from spack.build_environment import optimization_flags
1213
from spack.package import *
1314

1415

15-
class Namd(MakefilePackage, CudaPackage):
16+
class Namd(MakefilePackage, CudaPackage, ROCmPackage):
1617
"""NAMD is a parallel molecular dynamics code designed for
1718
high-performance simulation of large biomolecular systems."""
1819

@@ -26,14 +27,32 @@ class Namd(MakefilePackage, CudaPackage):
2627

2728
version("master", branch="master")
2829
version("3.0", sha256="301c64f0f1db860f7336efdb26223ccf66b5ab42bfc9141df8d81ec1e20bf472")
29-
version("3.0b7", sha256="b18ff43b0f55ec59e137c62eba1812589dd88b2122c3a05ea652781667f438b4", deprecated=True)
30-
version("3.0b6", sha256="8b5fb1dc8d5b5666c6a45d20ee7e8c9d1f5c186578e2cf148b68ba421d43b850", deprecated=True)
31-
version("3.0b3", sha256="20c32b6161f9c376536e3cb97c3bfe5367e1baaaace3c716ff79831fc2eb8199", deprecated=True)
32-
version("2.15a2", sha256="8748cbaa93fc480f92fc263d9323e55bce6623fc693dbfd4a40f59b92669713e", deprecated=True)
30+
version(
31+
"3.0b7",
32+
sha256="b18ff43b0f55ec59e137c62eba1812589dd88b2122c3a05ea652781667f438b4",
33+
deprecated=True,
34+
)
35+
version(
36+
"3.0b6",
37+
sha256="8b5fb1dc8d5b5666c6a45d20ee7e8c9d1f5c186578e2cf148b68ba421d43b850",
38+
deprecated=True,
39+
)
40+
version(
41+
"3.0b3",
42+
sha256="20c32b6161f9c376536e3cb97c3bfe5367e1baaaace3c716ff79831fc2eb8199",
43+
deprecated=True,
44+
)
45+
version(
46+
"2.15a2",
47+
sha256="8748cbaa93fc480f92fc263d9323e55bce6623fc693dbfd4a40f59b92669713e",
48+
deprecated=True,
49+
)
3350
version("2.15a1", branch="master", tag="release-2-15-alpha-1", deprecated=True)
3451
# Same as above, but lets you use a local file instead of git
3552
version(
36-
"2.15a1.manual", sha256="474006e98e32dddae59616b3b75f13a2bb149deaf7a0d617ce7fb9fd5a56a33a", deprecated=True
53+
"2.15a1.manual",
54+
sha256="474006e98e32dddae59616b3b75f13a2bb149deaf7a0d617ce7fb9fd5a56a33a",
55+
deprecated=True,
3756
)
3857
version(
3958
"2.14",
@@ -57,9 +76,24 @@ class Namd(MakefilePackage, CudaPackage):
5776
description="Enables Tcl and/or python interface",
5877
)
5978

60-
variant("avxtiles", when="target=x86_64_v4:", default=False, description="Enable avxtiles")
79+
variant(
80+
"avxtiles",
81+
when="target=x86_64_v4: @2.15:",
82+
default=False,
83+
description="Enable avxtiles supported with NAMD 2.15+",
84+
)
6185
variant("single_node_gpu", default=False, description="Single node GPU")
6286

87+
# Adding memopt variant to build memory-optimized mode that utilizes a compressed
88+
# version of the molecular structure and also supports parallel I/O.
89+
# Refer: https://www.ks.uiuc.edu/Research/namd/wiki/index.cgi?NamdMemoryReduction
90+
variant(
91+
"memopt",
92+
when="@2.8:",
93+
default=False,
94+
description="Enable memory-optimized build supported with NAMD 2.8+",
95+
)
96+
6397
# init_tcl_pointers() declaration and implementation are inconsistent
6498
# "src/colvarproxy_namd.C", line 482: error: inherited member is not
6599
# allowed
@@ -85,7 +119,13 @@ class Namd(MakefilePackage, CudaPackage):
85119
depends_on("tcl", when="interface=python")
86120
depends_on("python", when="interface=python")
87121

88-
conflicts("+avxtiles", when="@:2.14,3:", msg="AVXTiles algorithm requires NAMD 2.15")
122+
conflicts("+rocm", when="+cuda", msg="NAMD supports only one GPU backend at a time")
123+
conflicts("+single_node_gpu", when="~cuda~rocm")
124+
conflicts(
125+
"+memopt",
126+
when="+single_node_gpu",
127+
msg="memopt mode is not compatible with GPU-resident builds",
128+
)
89129

90130
# https://www.ks.uiuc.edu/Research/namd/2.12/features.html
91131
# https://www.ks.uiuc.edu/Research/namd/2.13/features.html
@@ -136,7 +176,7 @@ def _edit_arch_generic(self, spec, prefix):
136176
# this options are take from the default provided
137177
# configuration files
138178
# https://github.com/UIUC-PPL/charm/pull/2778
139-
archopt = spec.architecture.target.optimization_flags(spec.compiler)
179+
archopt = optimization_flags(self.compiler, spec.target)
140180

141181
if self.spec.satisfies("^charmpp@:6.10.1"):
142182
optims_opts = {
@@ -276,6 +316,17 @@ def edit(self, spec, prefix):
276316
if "+single_node_gpu" in spec:
277317
opts.extend(["--with-single-node-cuda"])
278318

319+
if "+rocm" in spec:
320+
self._copy_arch_file("hip")
321+
opts.append("--with-hip")
322+
opts.extend(["--rocm-prefix", os.environ["ROCM_PATH"]])
323+
324+
if "+single_node_gpu" in spec:
325+
opts.extend(["--with-single-node-hip"])
326+
327+
if spec.satisfies("+memopt"):
328+
opts.append("--with-memopt")
329+
279330
config = Executable("./config")
280331

281332
config(self.build_directory, *opts)

recipes/namd/3.0/mc/compilers.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bootstrap:
2+
spec: gcc@12
3+
gcc:
4+
specs:
5+
- gcc@13

recipes/namd/3.0/mc/config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: namd
2+
description: "NAMD: Scalable Molecular Dynamics"
3+
store: /user-environment
4+
spack:
5+
repo: https://github.com/spack/spack.git
6+
commit: v0.23.1
7+
modules: True

recipes/namd/3.0/mc/environments.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namd:
2+
compiler:
3+
- toolchain: gcc
4+
spec: gcc@13
5+
unify: true
6+
specs:
7+
- [email protected] +openmp +mpi
8+
9+
- charmpp@=8.0.0 backend=mpi +production +tracing
10+
- namd@=3.0
11+
mpi:
12+
13+
views:
14+
develop:
15+
link: roots
16+
exclude: ["namd"]
17+
uenv:
18+
prefix_paths:
19+
LD_LIBRARY_PATH: [lib, lib64]
20+
namd:
21+
link: roots
22+
uenv:
23+
prefix_paths:
24+
LD_LIBRARY_PATH: [lib, lib64]

0 commit comments

Comments
 (0)