| 1 | = Many Task Computing = |
| 2 | This page introduces examples of scripts for Many-task computing. |
| 3 | |
| 4 | == Job Array + Many-Task Computing == |
| 5 | Cypress job-schedular allows a maximum of 18 concurrently running jobs for normal qos, and 8 jobs for long qos. Even if each job requests a single core, it is counted as one job. |
| 6 | |
| 7 | Assuming that we have 100 single-core tasks and each task will run more than 24 hours, you might consider using Job Array and long qos to submit 100 jobs. But Cypress job-schedular allows a maximum of 8 concurrently running jobs. |
| 8 | |
| 9 | The example script below submits a Job-Array of 5 array-tasks, and each task run 20 sub-tasks. |
| 10 | |
| 11 | {{{ |
| 12 | #!/bin/bash |
| 13 | #SBATCH --qos=long # Quality of Service |
| 14 | #SBATCH --job-name=ManyTaskJob # Job Name |
| 15 | #SBATCH --time=30:00:00 # WallTime |
| 16 | #SBATCH --nodes=1 # Number of Nodes |
| 17 | #SBATCH --ntasks-per-node=20 # Number of tasks |
| 18 | #SBATCH --cpus-per-task=1 # Number of processors per task |
| 19 | #SBATCH --gres=mic:0 # Number of Co-Processors |
| 20 | #SBATCH --array=0-80:20 # Array of IDs=0,20,40,60,80 |
| 21 | |
| 22 | # our custom function |
| 23 | cust_func(){ |
| 24 | echo "Do something $1 task" |
| 25 | sleep 10 |
| 26 | } |
| 27 | # For loop $SLURM_NTASKS_PER_NODE times |
| 28 | date |
| 29 | hostname |
| 30 | for i in $(seq $SLURM_NTASKS_PER_NODE) |
| 31 | do |
| 32 | TASK_ID=$((SLURM_ARRAY_TASK_ID + i)) |
| 33 | cust_func $TASK_ID > log${TASK_ID}.out & # Put a function in the background |
| 34 | done |
| 35 | |
| 36 | ## Put all cust_func in the background and bash |
| 37 | ## would wait until those are completed |
| 38 | ## before displaying done message |
| 39 | wait |
| 40 | echo "done" |
| 41 | date |
| 42 | }}} |
| 43 | |
| 44 | == Many MPI jobs in a single job == |
| 45 | If you have some MPI jobs that must run concurrently, Many-task computing may be the way to go. |
| 46 | |
| 47 | |