Changes between Initial Version and Version 1 of Workshops/cypress/ManyTaskComputing


Ignore:
Timestamp:
12/12/22 13:08:04 (2 years ago)
Author:
fuji
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Workshops/cypress/ManyTaskComputing

    v1 v1  
     1= Many Task Computing =
     2This page introduces examples of scripts for Many-task computing.
     3
     4== Job Array + Many-Task Computing ==
     5Cypress 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
     7Assuming 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
     9The 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
     23cust_func(){
     24  echo "Do something $1 task"
     25  sleep 10
     26}
     27# For loop $SLURM_NTASKS_PER_NODE times
     28date
     29hostname
     30for i in $(seq $SLURM_NTASKS_PER_NODE)
     31do
     32        TASK_ID=$((SLURM_ARRAY_TASK_ID + i))
     33        cust_func $TASK_ID > log${TASK_ID}.out & # Put a function in the background
     34done
     35
     36## Put all cust_func in the background and bash
     37## would wait until those are completed
     38## before displaying done message
     39wait
     40echo "done"
     41date
     42}}}
     43
     44== Many MPI jobs in a single job ==
     45If you have some MPI jobs that must run concurrently, Many-task computing may be the way to go.
     46
     47