GPU集群作业提交

如果是GPU集群,需要在作业脚本中增加--gres=gpu:<number of card>参数。例如#SBATCH --gres=gpu:2,意味着指定2张GPU卡数。

以下为GPU作业的一个示例:

 1#! /bin/bash
 2### This is a bash script
 3
 4#SBATCH --job-name=gpu-example
 5### The job name
 6
 7#SBATCH --nodes=1
 8### The job requires 1 compute node
 9
10#SBATCH --ntasks=16
11### The job requires 16 CPU cores
12
13#SBATCH --gres=gpu:1
14### Apply for 1 GPU card
15
16#SBATCH --comment project_name
17### Specify which project to charge. If there is no parameter, it will be charged from the personal account
18
19source ~/.bashrc
20### initialize the environment variables
21
22python test.py
23### The command to execute the program

注意

GPU集群中提交作业时,需要在srunsbatch命令中增加参数-s,或者 --oversubscribe。表示允许与其它作业共享资源。

例如:

1$sbatch -s job.sh