The Bayes-Cluster is using SLURM to organize all the running program. SLURM is the mainstream, open-sourced workload manger, widedly used by other Clusters like: China’s TH-1, TH-2 , etc. Here is the URL of the official documentation: SLURM
This page documented some basic functions and usage users may use.
WHAT-IS Partition
Different computing node has different configuration, different partition is the set of different node. In our cluster, there are two types of partitions:
- CPU-Compute-1: Compute[2030005000]
- CPU-Compute-2: Compute[2030005001 - 2030005003]
- GPU-Compute: Compute[2030005002 - 2030005003]
The reason we put [02 - 03] in both two partition is that when the GPU is not allocated, those CPU is actually available for CPU users. This partitaion can raise up the effiency.
Trace Your Task
SLURM provides some usefull commands for users to trace their tasks, for example: scontrol, sacct. These commands can be used to check both tasks’ status [running or completed]. When anonamly happened, users can use these to trace them.
To those tasks are runing or queueing:
scontrol show job JOBID
The JOBID is the task’s ID; if you forget your task’s ID, your can use squeue =u user_name to check your tasks which are running or queueing.
scontrol is one of the most complecated commands in SLURM, please check it from the official documentation.
After the task is completed, you can use sacct to find out all the historical tasks. In default, user can only find his/her own tasks; the output would contains: Task ID, Name, Partition, Account, Node Name and Status. Here is an example:
User_name@Control:~$ sacct
JobID JobName Partition Account AllocCPUS State ExitCode
------------ ---------- ---------- ---------- ---------- ---------- --------
193 run.slurm CPU-Compu+ stat 1 FAILED 13:0
194 run.slurm CPU-Compu+ stat 1 FAILED 127:0
195 run.slurm CPU-Compu+ stat 1 FAILED 127:0
196 sh GPU-Compu+ stat 1 FAILED 2:0
196.0 bash stat 1 FAILED 2:0
197 run.slurm CPU-Compu+ stat 1 FAILED 127:0
198 gpu-job GPU-Compu+ stat 1 COMPLETED 0:0
198.batch batch stat 1 COMPLETED 0:0
199 gpu-job GPU-Compu+ stat 1 COMPLETED 0:0
199.batch batch stat 1 COMPLETED 0:0
User_name@Control:~$
HOW-TO Update Our Tasks
Sometimes we may submit our tasks with wrong parameters, it is no need to cancel it and resubmit [If the task is still queueing]. We can use scontrol to update the task’s categories:
scontrol update jobid=JOBID ...
As soon as the task is in the running mode, we could not change any parameter. Especially, changing task’s maximum running time is not supported.
Use Job Array
Usually, we may need to run a group of tasks, where these tasks require similar resources and their output are similar, with different parameters. At this time, we need to use Job Array to submit these tasks in batch. Inside the Job Array, every tasks is still a individual task, and they are still limited by the queue and servers’ resource.
We need to change some parameters in the SLURM script when we are trying to submit a Job Array. Here are some instructions:
#SBATCH -a 0-9Assignments’ number is from [0, 9] (0 and 9 are included)#SBATCH -a 0,2,4Assignments’ numbers are 0, 2, & 4#SBATCH -a -0-5:2Assignments are from 0 to 5, but interval is 2
When the script is running, SLURM would uses the environment variables to represent Job Array:
SLURM_ARRAY_JOB_IDJob Array’s first task’s IDSLURM_ARRAY_TASK_IDThe individual task’s index inside the groupSLURM_ARRAY_TASK_COUNTHow many tasks inside the groupSLURM_ARRAY_TASK_MAXThe last task’s index inside the groupSLURM_ARRAY_TASK_MINThe first task’s index inside the group
To every task, its default output’s name is slurm-JOBID_TASKID.out
Here is an example:
#!/bin/bash
#SBATCH -J Array
#SBATCH -p CPU-Compute
#SBATCH -N 1
#SBATCH --cpus-per-task=1
#SBATCH -t 5:00
#SBATCH -a 0-2
input=(foo bar baz)
echo "This is job #${SLURM_ARRAY_JOB_ID}, with parameter ${input[$SLURM_ARRAY_TASK_ID]}"
echo "There are ${SLURM_ARRAY_TASK_COUNT} task(s) in the array."
echo " Max index is ${SLURM_ARRAY_TASK_MAX}"
echo " Min index is ${SLURM_ARRAY_TASK_MIN}"
sleep 5
You can see the result by using squeue:
user_name@Control~$ sbatch array.slurm
Submitted batch job 50
user_name@Control~$ squeue
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
50_0 CPU-Compute array user_name R 0:01 1 comput2030005000
50_1 CPU-Compute array user_name R 0:01 1 comput2030005000
50_2 CPU-COmpute array user_name R 0:01 1 comput2030005000
To cancel the tasks or the array, we can use scancel:
scancel 50_[1-2]: cancel number 50’s 1 and 2 tasksscancel 50_0 50_2: cancel number 50’s 1 0 and 2 tasks- `scancel 50: cancel all the task in number 50
LImitation of Computing Nodes’ Access
HOW-TO Acces to the Computing Node
Usually, All the user cannot connect to any computing node via “SSH”. However, user can use salloc to get the authority to connect to the computing node.
HOW-TO Store Data in Cluster
Also, all the computing Node cannot access to the Internet unless using the Proxy we provided. Therefore, we highly recommend you to upload your data to the server before your run the code. Data need to store in the NFS Pool.
- In Compute2030005000, it has one externel drive: /Storage2030005000
- In Compute2030005001, it has three externel drives: /Storage2030005001_[0, 2]
- In Compute2030005002, it has three externel drives: /Storage2030005002_[0, 2]
- In Compute2030005003, it has three externel drives: /Storage2030005003_[0, 2]
No matter which drive, which server you are using, the SLURM can find your file as soon as your are using the absolute path, here is an example:
Assume that I have a dataset in /Storage2030005001_0 called PM2-5.csv, and I am now using computing node: Compute2030005003. I need to write the file’s path: /Storage2030005001_0/PM2-5.csv in my code:
original_data <- read.csv("/Storage2030005001_0/PM2-5.csv")
HOW-TO Do Crypto-Digital-Currency Mining in Cluster
DO NOT DO THE MINING in the cluster, we have a complete monitor tools to detect it and as long as we find the mining script we would remove user’s autority forever
