Skip to content

Commit b602eae

Browse files
committed
local: run/build scripts, retargeted at the staging tree
Personal dev-loop scripts plus the sample .dat inputs they use. They had rotted: they pointed at GROMACS 2025.3, Eigen 3.4.0, kenref/debug/AVX_512 (a layout that no longer exists), plumed-dev/master/<build> (missing the kenref-version level the staging tree now has), and three "-asan" tiers that exist in neither tree. Rewritten around a sourced _env.sh so every path is derived from a handful of variables, each overridable from the caller: KN_BUILD=release ./runPlumed.sh KN_ACCEL=AVX2_256 KN_VER=1.0.0 ./buildPlumed.sh Targets the STAGING tree, which is the hierarchical one: kenref-dev/<ver>/<build>/<accel> plumed-dev/<plumed-branch>/<kenref-ver>/<build>/<accel> gromacs-4-plumed-dev/<year>/<gmx-ver>/<build>/<accel> The deployment tree is flat and named differently (kenref/2.0.0_AVX_512), so these do not drive it -- deliberate, since development happens against staging. Two further fixes while there: - the PLUMED source directory is derived from the script's own location instead of being hardcoded to /home/amr/git/plumed2, so they work in any checkout; - kn_require() checks every path up front and, on a miss, prints what was selected and which kenref builds actually exist. The old scripts failed late and cryptically when a tier had been reorganised away. buildPlumed.sh also maps KN_ACCEL to the matching -march, since Eigen's alignment is part of libkenref_core's ABI and a mismatch trips the SIMD guard. Verified: all four scripts pass `bash -n`, and every derived path resolves for KN_BUILD in {debug,release,relwithdebinfo} x KN_ACCEL in {AVX_512,AVX2_256,AVX_256}. The -asan invocations are kept, commented, with a note that the tier is gone.
1 parent 60fcfac commit b602eae

10 files changed

Lines changed: 297 additions & 0 deletions

File tree

src/kenref/runFiles/_env.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Shared environment for the runFiles scripts. Source it; do not execute it.
2+
#
3+
# Every path used by these scripts is derived from the few variables below, so a version bump is one
4+
# edit here instead of a hunt through four scripts. Each is overridable from the caller's environment:
5+
#
6+
# KN_BUILD=release ./runPlumed.sh
7+
# KN_ACCEL=AVX2_256 KN_VER=1.0.0 ./buildPlumed.sh
8+
#
9+
# These point at the STAGING tree (/smithlab/opt/*-dev), which is the hierarchical one:
10+
# kenref-dev/<ver>/<build>/<accel>
11+
# plumed-dev/<plumed-branch>/<kenref-ver>/<build>/<accel>
12+
# gromacs-4-plumed-dev/<year>/<gmx-ver>/<build>/<accel>
13+
# The DEPLOYMENT tree is flat and named differently (kenref/2.0.0_AVX_512), so these scripts do not
14+
# work against it unchanged -- that is deliberate, since you develop against staging.
15+
16+
KN_VER="${KN_VER:-2.0.0}" # kenref version dimension
17+
KN_BUILD="${KN_BUILD:-debug}" # debug | relwithdebinfo | release
18+
KN_ACCEL="${KN_ACCEL:-AVX_512}" # AVX_512 | AVX2_256 | AVX_256
19+
KN_PLUMED_BRANCH="${KN_PLUMED_BRANCH:-master}"
20+
KN_GMX_YEAR="${KN_GMX_YEAR:-2025}"
21+
KN_GMX_VER="${KN_GMX_VER:-2025.4}"
22+
KN_EIGEN_VER="${KN_EIGEN_VER:-5.0.1}"
23+
KN_LLVM="${KN_LLVM:-/smithlab/opt/llvm/20.1.1}"
24+
25+
KN_OPT="${KN_OPT:-/smithlab/opt}"
26+
27+
# The PLUMED source tree: derived from this file's own location, so the scripts work in any checkout
28+
# rather than only in the one they were written in.
29+
KN_PLUMED_SRC="${KN_PLUMED_SRC:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)}"
30+
31+
# Overridable so you can point at a kenref built somewhere else (a scratch prefix, a release-tier
32+
# install) without editing this file: KN_KENREF_PREFIX=/path/to/prefix ./buildPlumed.sh
33+
KN_KENREF_PREFIX="${KN_KENREF_PREFIX:-${KN_OPT}/kenref-dev/${KN_VER}/${KN_BUILD}/${KN_ACCEL}}"
34+
KN_PLUMED_PREFIX="${KN_PLUMED_PREFIX:-${KN_OPT}/plumed-dev/${KN_PLUMED_BRANCH}/${KN_VER}/${KN_BUILD}/${KN_ACCEL}}"
35+
KN_GMXRC="${KN_OPT}/gromacs-4-plumed-dev/${KN_GMX_YEAR}/${KN_GMX_VER}/${KN_BUILD}/${KN_ACCEL}/bin/GMXRC"
36+
KN_EIGEN_PC="${KN_EIGEN_PC:-${KN_OPT}/eigen/${KN_EIGEN_VER}/${KN_BUILD}/share/pkgconfig}"
37+
KN_PLUMED_KERNEL="${KN_PLUMED_PREFIX}/lib/libplumedKernel.so"
38+
39+
# Fail loudly and early. These scripts used to point at paths that had been reorganised away
40+
# (gromacs 2025.3, eigen 3.4.0, plumed-dev/master/<build> without the kenref-version level, and the
41+
# -asan tiers), and the failures that produced were confusing and late.
42+
kn_require() {
43+
local missing=0 p
44+
for p in "$@"; do
45+
[ -e "$p" ] || { echo "MISSING: $p" >&2; missing=1; }
46+
done
47+
if [ "$missing" = 1 ]; then
48+
echo "" >&2
49+
echo "Current selection: KN_VER=$KN_VER KN_BUILD=$KN_BUILD KN_ACCEL=$KN_ACCEL" >&2
50+
echo "Available kenref builds:" >&2
51+
ls -d "${KN_OPT}/kenref-dev/${KN_VER}"/*/* 2>/dev/null | sed 's/^/ /' >&2
52+
return 1
53+
fi
54+
}

src/kenref/runFiles/buildPlumed.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# Configure and build PLUMED with the kenref module, against a STAGING kenref install.
3+
# Paths come from _env.sh -- override on the command line, e.g. KN_BUILD=release ./buildPlumed.sh
4+
set -e
5+
source "$(dirname "${BASH_SOURCE[0]}")/_env.sh"
6+
7+
kn_require "${KN_KENREF_PREFIX}/lib/pkgconfig" "${KN_EIGEN_PC}"
8+
9+
cd "${KN_PLUMED_SRC}"
10+
11+
export PKG_CONFIG_PATH="${KN_KENREF_PREFIX}/lib/pkgconfig:${KN_EIGEN_PC}:${PKG_CONFIG_PATH}"
12+
13+
# The linker must be able to FIND libkenref_core.so when it links the `plumed` executable against
14+
# libplumedKernel.so, and --enable-rpath must record that directory so the binaries are
15+
# self-contained. src/kenref/_common.sh does this; this hand-rolled script did not, which produced:
16+
# ld: warning: libkenref_core.so.2, needed by libplumedKernel.so, not found
17+
# libplumedKernel.so: undefined reference to `kenref::bootstrapModels()'
18+
# Safe alongside pkg-config because PLUMED's configure queries --libs with
19+
# PKG_CONFIG_ALLOW_SYSTEM_LIBS=1; otherwise pkg-config would suppress -L for a directory that is
20+
# on LIBRARY_PATH and the captured link line would silently stop being self-contained.
21+
export LIBRARY_PATH="${KN_KENREF_PREFIX}/lib:${LIBRARY_PATH}"
22+
export LD_LIBRARY_PATH="${KN_KENREF_PREFIX}/lib:${LD_LIBRARY_PATH}"
23+
24+
# -march must match the kenref build's ACCEL tier: Eigen's alignment is part of libkenref_core's ABI,
25+
# so a mismatch trips the SIMD/Eigen guard. kenref_core.pc now carries the right -march itself, so this
26+
# is belt-and-braces rather than the only source of truth.
27+
case "${KN_ACCEL}" in
28+
AVX_512) KN_MARCH=skylake-avx512 ;;
29+
AVX2_256) KN_MARCH=haswell ;;
30+
AVX_256) KN_MARCH=sandybridge ;;
31+
*) echo "unknown KN_ACCEL=${KN_ACCEL}" >&2; exit 2 ;;
32+
esac
33+
34+
# autoconf 2.69 reproduces PLUMED's committed `configure` byte-for-byte; 2.72 rewrites the whole script
35+
# (~10k lines of unrelated churn), which in a git checkout shows up as a huge spurious diff. Pin the
36+
# version, and only regenerate when configure.ac is actually newer -- `autoreconf --force` unconditionally
37+
# rewrote it before, and on this machine /usr/local/bin/autoconf (2.72) precedes /usr/bin/autoconf (2.69).
38+
KN_AUTOCONF="${KN_AUTOCONF:-/usr/bin/autoconf}"
39+
if ! "${KN_AUTOCONF}" --version | head -1 | grep -q '2\.69'; then
40+
echo "WARNING: ${KN_AUTOCONF} is not autoconf 2.69 -- regenerating configure may rewrite it wholesale." >&2
41+
fi
42+
if [ configure.ac -nt configure ] || [ ! -f configure ]; then
43+
echo "==> regenerating configure with $(${KN_AUTOCONF} --version | head -1)"
44+
"${KN_AUTOCONF}" -o configure configure.ac
45+
else
46+
echo "==> configure is up to date; skipping autoreconf"
47+
fi
48+
49+
./configure \
50+
CXXFLAGS="-stdlib=libc++ -O0 -g -fPIC -Wall -pedantic -std=c++17 -march=${KN_MARCH}" \
51+
LDFLAGS="-L${KN_LLVM}/lib/x86_64-unknown-linux-gnu" \
52+
LIBS="-Wl,--push-state,--no-as-needed -lc++ -lc++abi -lunwind -Wl,--pop-state -lpthread -ldl" \
53+
--prefix="${KN_PLUMED_PREFIX}" \
54+
--enable-modules=reset:+kenref \
55+
CXX=mpicxx CC=mpicc FC=mpif90
56+
57+
make clean
58+
make -j"${KN_JOBS:-18}"
59+
# sudo make install

src/kenref/runFiles/ener.edr

Whitespace-only changes.

src/kenref/runFiles/runPlumed.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# Single-replica run against the STAGING GROMACS-4-PLUMED build.
3+
set -e
4+
source "$(dirname "${BASH_SOURCE[0]}")/_env.sh"
5+
6+
kn_require "${KN_GMXRC}" "${KN_PLUMED_SRC}/sourceme.sh"
7+
8+
source "${KN_GMXRC}"
9+
source "${KN_PLUMED_SRC}/sourceme.sh"
10+
11+
if [ -z "$PLUMED_KERNEL" ]; then
12+
echo "ERROR: PLUMED_KERNEL not set. Please check the PLUMED installation." >&2
13+
exit 1
14+
fi
15+
echo "PLUMED_KERNEL=$PLUMED_KERNEL"
16+
17+
# TPR to run. Override with KN_TPR=... ; the default is the committed single-replica test set.
18+
KN_TPR="${KN_TPR:-${KN_PLUMED_SRC}/src/kenref/run-output/repl_01/topol.tpr}"
19+
kn_require "${KN_TPR}"
20+
21+
# For multi-replica runs the input must sit in a relative folder (see runPlumed_double.sh).
22+
gmx_mpi mdrun -s "${KN_TPR}" -nsteps "${KN_NSTEPS:-50}" -plumed ../runFiles/test_single.dat
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# Two-replica run against the STAGING GROMACS-4-PLUMED build.
3+
set -e
4+
source "$(dirname "${BASH_SOURCE[0]}")/_env.sh"
5+
6+
kn_require "${KN_GMXRC}" "${KN_PLUMED_SRC}/sourceme.sh"
7+
8+
source "${KN_GMXRC}"
9+
source "${KN_PLUMED_SRC}/sourceme.sh"
10+
11+
if [ -z "$PLUMED_KERNEL" ]; then
12+
echo "ERROR: PLUMED_KERNEL not set. Please check the PLUMED installation." >&2
13+
exit 1
14+
fi
15+
echo "PLUMED_KERNEL=$PLUMED_KERNEL"
16+
17+
# -multidir needs the tpr named relatively and one directory per replica; run this from the directory
18+
# that contains repl_01/ and repl_02/.
19+
mpirun -n 2 gmx_mpi mdrun -s topol.tpr -multidir repl_01 repl_02 \
20+
-nsteps "${KN_NSTEPS:-50}" -plumed ../../runFiles/test_double.dat

src/kenref/runFiles/test.edr

Whitespace-only changes.

src/kenref/runFiles/testPlumed.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
# Longer ubiquitin run, used for debugging/profiling against the STAGING tree.
3+
#
4+
# NOTE: this script previously pointed at "-asan" tiers
5+
# (gromacs-4-plumed/2025/2025.3/relwithdebinfo-asan, plumed-dev/master/{asan,relwithdebinfo-asan}).
6+
# Those tiers no longer exist in either the staging or the deployment tree, so the sanitizer lines are
7+
# kept commented and expressed in terms of _env.sh -- set KN_BUILD=relwithdebinfo for the closest
8+
# equivalent, and re-add a sanitizer tier to the build scripts if you need one again.
9+
set -e
10+
source "$(dirname "${BASH_SOURCE[0]}")/_env.sh"
11+
12+
kn_require "${KN_GMXRC}" "${KN_PLUMED_KERNEL}"
13+
14+
source "${KN_GMXRC}"
15+
export PLUMED_KERNEL="${KN_PLUMED_KERNEL}"
16+
17+
if [ -z "$PLUMED_KERNEL" ]; then
18+
echo "ERROR: PLUMED_KERNEL not set. Please check the PLUMED installation." >&2
19+
exit 1
20+
fi
21+
echo "PLUMED_KERNEL=$PLUMED_KERNEL"
22+
23+
# Sanitizer support (needs a sanitizer-enabled PLUMED build; see the note above):
24+
# export ASAN_OPTIONS="detect_leaks=0:log_path=./asan.log:abort_on_error=1"
25+
# export LD_PRELOAD=${KN_LLVM}/lib/clang/20/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.so
26+
export ASAN_OPTIONS=detect_leaks=0:halt_on_error=1:log_path=asan.log
27+
28+
export PLUMED_LOAD_NODEEPBIND=1
29+
30+
# The trajectory this was written against. Override with KN_TPR=...
31+
KN_TPR="${KN_TPR:-/smithlab/home/aalhossary/ubiquitin-plateaus-plumed/10nsstart+fitting/alef.tpr}"
32+
kn_require "${KN_TPR}"
33+
34+
gmx_mpi mdrun -cpi -pin on -ntomp "${KN_NTOMP:-20}" -cpt 30 \
35+
-plumed ../runFiles/ubiquitin_1e8_.25_999_A.dat \
36+
-deffnm test \
37+
-s "${KN_TPR}"
38+
39+
# Under valgrind:
40+
# valgrind --tool=memcheck --error-exitcode=1 --leak-check=no --track-origins=yes \
41+
# --num-callers=30 --log-file=valgrind.%p.log \
42+
# gmx_mpi mdrun -cpi -pin on -ntomp 1 -cpt 30 \
43+
# -plumed ../runFiles/ubiquitin_1e8_.25_999_A.dat -deffnm test -s "${KN_TPR}"
44+
#
45+
# Under rr:
46+
# rr record gmx_mpi mdrun -cpi -pin on -ntomp 1 -cpt 30 \
47+
# -plumed ../runFiles/ubiquitin_1e8_.25_999_A.dat -deffnm test -s "${KN_TPR}"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#N.B. Don't put your folder names in quotes
2+
3+
KENREF ...
4+
LABEL=kenref
5+
# STRIDE=5
6+
MODEL=SIGMA
7+
K=1.0
8+
N=0.25
9+
10+
#========= SIGMA RELATED ======================
11+
EXP_DATA_FOLDER=/smithlab/home/nblangdon/GB3/KEnRef-GB3/gb3-kenref-sigma/start_KEnRef_sigma/input_2
12+
PROTON_MHZ=700.0
13+
# RATES=XXXXXXXXXXXXXXXXXX (TODO change it to a RATES file location)
14+
#===============================================
15+
#========= PLATEAUS RELATED ====================
16+
# EXP_DATA_FILE=XXXXXXXXXXXXXXXXXX
17+
#===============================================
18+
GUIDE_ATOMS=39,60,82,101,117,234,241,256,270,284,358,368,383,397,407,422,444,454,474,496,513,534,544,558,626,642,666,680,701,771,785,805,819
19+
REF=/smithlab/home/nblangdon/GB3/KEnRef-GB3/gb3-kenref-sigma/start_KEnRef_sigma/alef.pdb
20+
ATOMNAME_MAPPING=/smithlab/home/nblangdon/GB3/KEnRef-GB3/gb3-kenref-sigma/start_KEnRef_sigma/alef.pdb
21+
22+
MAX_FORCE=999
23+
FIT_TO_REFERENCE
24+
SATURATE_FORCES
25+
26+
# UPDATE_FROM=50
27+
# UPDATE_UNTIL = 100
28+
... KENREF
29+
30+
# Access the components
31+
PRINT ARG=kenref.bias,kenref.energy,kenref.rmsd FILE=kenref.out STRIDE=10
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#N.B. Don't put your folder names in quotes
2+
3+
KENREF ...
4+
LABEL=kenref
5+
# STRIDE=5
6+
MODEL=SIGMA
7+
K=1.0
8+
N=0.25
9+
10+
#========= SIGMA RELATED ======================
11+
EXP_DATA_FOLDER=/smithlab/home/nblangdon/GB3/KEnRef-GB3/gb3-kenref-sigma/start_KEnRef_sigma/input_1
12+
PROTON_MHZ=700.0
13+
# RATES=XXXXXXXXXXXXXXXXXX (TODO change it to a RATES file location)
14+
#===============================================
15+
#========= PLATEAUS RELATED ====================
16+
# EXP_DATA_FILE=XXXXXXXXXXXXXXXXXX
17+
#===============================================
18+
GUIDE_ATOMS=39,60,82,101,117,234,241,256,270,284,358,368,383,397,407,422,444,454,474,496,513,534,544,558,626,642,666,680,701,771,785,805,819
19+
REF=/smithlab/home/nblangdon/GB3/KEnRef-GB3/gb3-kenref-sigma/start_KEnRef_sigma/alef.pdb
20+
ATOMNAME_MAPPING=/smithlab/home/nblangdon/GB3/KEnRef-GB3/gb3-kenref-sigma/start_KEnRef_sigma/alef.pdb
21+
22+
MAX_FORCE=999
23+
FIT_TO_REFERENCE
24+
SATURATE_FORCES
25+
26+
# UPDATE_FROM=50
27+
# UPDATE_UNTIL = 100
28+
... KENREF
29+
30+
# Access the components
31+
PRINT ARG=kenref.bias,kenref.energy,kenref.rmsd FILE=kenref.out STRIDE=10
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#N.B. Don't put your folder names in quotes
2+
3+
KENREF ...
4+
LABEL=kenref
5+
# STRIDE=5
6+
MODEL=PLATEAUS
7+
# MODEL=SIGMA
8+
K=1e8
9+
N=0.25
10+
11+
#========= SIGMA RELATED ======================
12+
# EXP_DATA_FOLDER=/smithlab/home/nblangdon/GB3/KEnRef-GB3/gb3-kenref-sigma/start_KEnRef_sigma/input_2
13+
# PROTON_MHZ=700.0
14+
## RATES=XXXXXXXXXXXXXXXXXX (TODO change it to a RATES file location)
15+
#===============================================
16+
#========= PLATEAUS RELATED ====================
17+
EXP_DATA_FILE=/smithlab/home/aalhossary/ubiquitin-plateaus-plumed/10nsstart+fitting/singleton_data_10nsstart+fit_3-5_1977pairs_80_A.csv
18+
#===============================================
19+
GUIDE_ATOMS=5,22,39,58,78,94,116,130,149,163,170,192,206,225,239,258,273,289,312,318,329,341,355,374,389,403,419,441,451,473,492,509,521,543,558,565,592,606,612,624,641,658,682,701,720,740,750,757,779,796,815,830,842,849,873,887,906,917,929,950,964,983,1000,1022,1037,1048,1062,1081,1098
20+
21+
REF=/smithlab/home/aalhossary/ubiquitin-plateaus-plumed/10nsstart+fitting/alef.pdb
22+
ATOMNAME_MAPPING=/smithlab/home/aalhossary/ubiquitin-plateaus-plumed/10nsstart+fitting/alef.pdb
23+
24+
MAX_FORCE=999
25+
FIT_TO_REFERENCE
26+
SATURATE_FORCES
27+
28+
# UPDATE_FROM=50
29+
# UPDATE_UNTIL = 100
30+
... KENREF
31+
32+
# Access the components
33+
PRINT ARG=kenref.bias,kenref.energy,kenref.rmsd FILE=kenref.out STRIDE=100

0 commit comments

Comments
 (0)