飞向蓝天分享 http://blog.sciencenet.cn/u/lijiext 如果世上没有光,那我们便要做自己的灯。

博文

[转载]Slurm作业脚本模板

已有 183 次阅读 2024-4-16 00:04 |个人分类:Slurm|系统分类:科研笔记|文章来源:转载

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
#SBATCH --partition=debug
#SBATCH --qos=240c-1h_debug
#SBATCH --nodes=1
#SBATCH --ntasks=2
#SBATCH --job-name="<jobname>"
#SBATCH --output="%x.%j.out"    # <jobname>.<jobid>.out
#SBATCH --mail-type=ALL
#SBATCH --mail-user=gridops@asti.dost.gov.ph
#SBATCH --requeue
##SBATCH --ntasks-per-node=1    # optional
##SBATCH --mem=24G              # optional: mem per node
##SBATCH --error=JobName.%J.err # optional; better to use --output only
 
## For more `sbatch` options, use `man sbatch` in the HPC, or go to https://slurm.schedmd.com/sbatch.html.
 
## Set stack size to unlimited.
ulimit -s unlimited
 
## Benchmarking.
start_time=$(date +%s.%N)
 
## Print job parameters.
echo "Submitted on $(date)"
echo "JOB PARAMETERS"
echo "SLURM_JOB_ID          : ${SLURM_JOB_ID}"
echo "SLURM_JOB_NAME        : ${SLURM_JOB_NAME}"
echo "SLURM_JOB_NUM_NODES   : ${SLURM_JOB_NUM_NODES}"
echo "SLURM_JOB_NODELIST    : ${SLURM_JOB_NODELIST}"
echo "SLURM_NTASKS          : ${SLURM_NTASKS}"
echo "SLURM_NTASKS_PER_NODE : ${SLURM_NTASKS_PER_NODE}"
echo "SLURM_MEM_PER_NODE    : ${SLURM_MEM_PER_NODE}"
 
## Create a unique temporary folder in the node. Using a local temporary folder usually results in faster read/write for temporary files.
## If this results in errors, just change to "no".
custom_tmp="yes"
if [[ $custom_tmp == "yes" ]]; then
   JOB_TMPDIR=/tmp/${SLURM_JOB_ID}
   mkdir -p ${JOB_TMPDIR}
   export TMPDIR=${JOB_TMPDIR}
   echo "TMPDIR                : $TMPDIR"
fi
 
## Reset modules.
module purge
module load <module1> [<module2> ...]
 
## Run your codes/scripts/apps. `srun` is optional.
[srun] /path/to/exe1 <arg1> ...
[srun] /path/to/exe2 <arg2> ...
 
## Flush the TMPDIR.
if [[ $custom_tmp == "yes" ]]; then
   rm -rf $TMPDIR
   echo "Cleared the \$TMPDIR [${TMPDIR}]"
fi
 
## Benchmarking
end_time=$(date +%s.%N)
echo "Finished on $(date)"
run_time=$(python -c "print($end_time - $start_time)")
echo "Total runtime (sec): ${run_time}"


https://blog.sciencenet.cn/blog-3514079-1429838.html


下一篇:[转载]glibc、gcc、binutils总结
收藏 IP: 118.248.140.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-1 04:17

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部