Skip to content

Instantly share code, notes, and snippets.

@bio-punk
Last active March 11, 2026 13:11
Show Gist options
  • Select an option

  • Save bio-punk/a63b80e8a286504adbb5eae9d8f3186d to your computer and use it in GitHub Desktop.

Select an option

Save bio-punk/a63b80e8a286504adbb5eae9d8f3186d to your computer and use it in GitHub Desktop.
shm acc #run #juicefs
#!/bin/bash
#SBATCH --gpus=1
#SBATCH -p gpu_4090
#SBATCH
module load amber/amber22-mpi-cuda118
mkdir -p /dev/shm/${USER}
SUB_DIR=`pwd`
WORK_DIR=/dev/shm/${USER}/abmer_work_${SLURM_JOB_ID}
mkdir -p ${WORK_DIR}
mkdir -p /dev/shm/${USER}/tmp
export TMPDIR=/dev/shm/${USER}/tmp
# Synchronize the mdinfo file in the WORK_DIR with the SUB_DIR
# by copying mdinfo from WORK_DIR to SUB_DIR every 10 seconds.
# The function runs indefinitely until it is manually stopped.
sync_mdinfo() {
while true; do
if [ -f ${WORK_DIR}/mdinfo ]; then
rsync -av ${WORK_DIR}/mdinfo ${SUB_DIR} 2>/dev/null
fi
sleep 10
done
}
sync_mdinfo &
SYNC_PID=$!
# 任务结束后自动转储持久化目录并移除临时文件
trap "kill ${SYNC_PID}; cd ${SUB_DIR}; rsync -av ${WORK_DIR} ./ && rm -rf ${WORK_DIR}" EXIT
cp wat_md.in ${WORK_DIR}
cp 5K21_solv.prmtop ${WORK_DIR}
cp md.rst ${WORK_DIR}
cp equi_all_subrestrain-2.rst ${WORK_DIR}
cp md.nc ${WORK_DIR}
cd ${WORK_DIR}
pmemd.cuda -O \
-i wat_md.in \
-o md.log \
-c equi_all_subrestrain-2.rst \
-p 5K21_solv.prmtop \
-r md.rst \
-ref equi_all_subrestrain-2.rst \
-x md.nc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment