计算化学公社

标题: slurm的脚本问题 [打印本页]

作者
Author:
beyond    时间: 2018-6-4 18:36
标题: slurm的脚本问题
想要在一个slurm的job里面,实现多个任务同时运行,不知道slurm的脚本该怎么写呢?


另外做一个模拟,需要8个GPU,但是每个节点只有4个GPU,这样就需要2个节点

#SBATCH -N 1
#SBATCH -n 32            # cpu
#SBATCH --gres=gpu:4    # gpu


请求 1个节点,4个GPU,模拟跑得没有问题

#SBATCH -N 2
#SBATCH -n 64            # cpu
#SBATCH --gres=gpu:4    # gpu

请求2个节点,但是只有一个节点上面的4个GPU在工作


#SBATCH -N 2
#SBATCH -n 64            # cpu
#SBATCH --gres=gpu:8    # gpu

这样的话,脚本都提交不上去。

有没有类似经验的呢? 十分谢谢!


作者
Author:
Daniel_Arndt    时间: 2018-6-5 00:00
第一个问题,我建议使用GNU Parallel。我曾经在一个使用LSF排队系统的超算上这么干过。
作者
Author:
beyond    时间: 2018-6-5 15:15
Daniel_Arndt 发表于 2018-6-5 00:00
第一个问题,我建议使用GNU Parallel。我曾经在一个使用LSF排队系统的超算上这么干过。

谢谢,查了一下,感觉这个可行!
作者
Author:
beyond    时间: 2018-6-8 15:15
咨询了一下一个cluster的管理员,再测试了一下, 比如要用了两个nodes,每个node上面调用2个gpu:


  -N 2 #  specifies how many nodes there must be,  2 个nodes
  -n 4 #  specifies how many total tasks there should be, 一共4个GPU,就4个任务, 之前把这个定义为cpu数了
  -c  8  # specifies how many cores there are per task,  1 GPU+8 cpu 一个任务
  --ntasks-per-node=2  # specifies how many tasks there may be per node. 每个node上面调用2个GPU

有需要的可以试一下

作者
Author:
laoman    时间: 2018-6-8 16:02
本帖最后由 laoman 于 2018-6-11 20:02 编辑

举个我自己的栗子:
  1. #!/bin/bash
  2. #SBATCH -J JOB_NAME
  3. #SBATCH -t 130:00:00
  4. #SBATCH --gres=gpu:k80:2
  5. #SBATCH --exclusive
  6. #SBATCH -n 4
  7. #SBATCH -N 1
  8. #SBATCH -A ACCOUNT
  9. #SBATCH -o NAME.out
  10. #SBATCH -e NAME.err

  11. module load amber16_cuda9.0

  12. # Better add the systems here, not in the arguement!
  13. # with agrvs for the MDRUN: (sys md_stage1 md_stage2 cuda_id conti_flag)
  14. # The four systems should be in similar size
  15. sys_1=('DIR_1' '2' '2' '0' '1')
  16. sys_2=('DIR_2' '2' '2' '1' '1')
  17. sys_3=('DIR_3' '1' '1' '2' '0')
  18. sys_4=('DIR_4' '2' '2' '3' '1')


  19. cd $SLURM_SUBMIT_DIR
  20. echo START

  21. MDRUN ()
  22. {
  23. md_stage1=$1
  24. md_stage2=$2
  25. export CUDA_VISIBLE_DEVICES="$3"
  26. continue_flag=$4

  27. SCRIPTS for amber MD

  28. }

  29. # Run the four jobs in the background
  30. for j in $(seq 1 4)
  31. do
  32.     SYS="sys_${j}"
  33.     eval SYST=(\${$SYS[*]})
  34.     echo ${SYST[0]}
  35.     cd ${SYST[0]}
  36.     MDRUN ${SYST[1]} ${SYST[2]} ${SYST[3]} ${SYST[4]} &
  37.     cd ..
  38. done

  39. wait
  40. echo DONE
  41. exit
复制代码


现在补上了,用的一个节点。我没有那么多体系,也就没有跨节点来跑了。一个节点有2块K80卡,总共就是4个GPU核心,所以可以同时跑四个任务,虽然,K80并不适合跑MD。。。



作者
Author:
beyond    时间: 2018-6-11 18:50
laoman 发表于 2018-6-8 16:02
举个我自己的栗子:

谢谢回复! 你这个是用2个还是4个GPU跑4个任务?没有看到你指定了几个节点
作者
Author:
bluewhale    时间: 2018-6-11 19:07
不知你具体要干嘛,不过可以考虑 job array:
#!/bin/bash
#
#SBATCH --array=1-100
cd dir.$SLURM_ARRAY_TASK_ID
run_my_program

作者
Author:
0325-ddd    时间: 2023-11-22 20:48
您好,初学者求指教!假如我想在linux系统下依次运行几十个文件(几十个文件在一个文件夹,一个跑完接着跑下一个),我的输入文件是.gjf,我的任务是跑分子的能量最小化,我想要依次跑这些文件,我该怎样写命令呢?
作者
Author:
zmjsce    时间: 2023-12-13 11:31
0325-ddd 发表于 2023-11-22 20:48
您好,初学者求指教!假如我想在linux系统下依次运行几十个文件(几十个文件在一个文件夹,一个跑完接着跑 ...

http://sobereva.com/258
作者
Author:
0325-ddd    时间: 2023-12-14 09:49
zmjsce 发表于 2023-12-13 11:31
http://sobereva.com/258

谢谢您!我的任务已经跑完了,感谢回复
作者
Author:
naxiangzi    时间: 2024-11-8 16:22
有没有遇到,脚本只能在运行脚本的机子上可以调用cpu,其它节点交没有调用 cpu,即没有运行




欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3