Slurm for CP2K
1#!/bin/bash
2#SBATCH -J cp2k-opt
3#SBATCH -o %J.out
4#SBATCH -e %J.err
5#SBATCH -N 1
6#SBATCH -w node01
7#SBATCH -n 36
8#SBATCH -t 999:0:0
9#SBATCH -p hpc
10
11JOBNAME=test.inp
12OUTPUTNAME=test.out
13
14export OMP_NUM_THREADS=1
15
16echo Time is `date`
17echo Working dir is $SLURM_SUBMIT_DIR #$SLURM_SUBMIT_DIR:作业提交目录
18cd $SLURM_SUBMIT_DIR
19
20NPROCS=$((SLURM_NTASKS)) #$SLURM_NTASKS:总任务数
21N_NODE=$((SLURM_JOB_NUM_NODES)) #$SLURM_JOB_NUM_NODES:节点数
22
23echo This job has allocated ${N_NODE} nodes with ${NPROCS} processors
24echo Running on host `hostname`
25echo This jobs runs on the following processors:
26echo "**Start"
27
28echo $SLURM_SUBMIT_DIR > work.txt
29echo $SLURM_NODELIST > nodefile.txt #$SLURM_NODELIST:节点列表
30echo $NPROCS > cpucore.txt
31echo $N_NODE > node.txt
32
33source ~/run_software_bashrc/before_run_cp2k2023.1.sh
34
35mpirun -np ${NPROCS} cp2k.popt $JOBNAME > $OUTPUTNAME
36
37echo "**Finished!"