Workload Management
4.1 What Is A Workload Manager?
A workload management system (also known as a queuing system, job scheduler or batch submission system) manages the available resources such as CPUs, GPUs, and memory for jobs submitted to the system by users.
Jobs are submitted by the users using job scripts. Job scripts are constructed by users and include requests for resources. How resources are allocated depends upon policies that the system administrator sets up for the workload manager.
4.2 Why Use A Workload Manager?
Workload managers are used so that users do not manually have to keep track of node usage in a cluster in order to plan efficient and fair use of cluster resources.
Users may still perhaps run jobs on the compute nodes outside of the workload manager, if that is administratively permitted. However, running jobs outside a workload manager tends to eventually lead to an abuse of the cluster resources as more people use the cluster. This leads to inefficient use of available resources. It is therefore usually forbidden as a policy by the system administrator on production clusters.
4.3 How Does A Workload Manager Function?
A workload manager uses policies to ensure that the resources of a cluster are used efficiently, and must therefore track cluster resources and jobs. A workload manager is therefore generally able to:
-
Monitor:
-
the node status (up, down)
-
all available resources (available cores, memory on the nodes)
-
the state of jobs (queued, on hold, deleted, failed, completed)
-
-
Modify:
-
the status of jobs (freeze/hold the job, resume the job, delete the job)
-
the priority and execution order for jobs
-
the run status of a job. For example, by adding checkpoints to freeze a job.
-
(optional) how related tasks in a job are handled according to their resource requirements. For example, a job with two tasks may have a greater need for disk I/O resources for the first task, and a greater need for CPU resources during the second task.
-
Some workload managers can adapt to external triggers such as hardware failure, and send alerts or attempt automatic recovery.
4.4 Job Submission Process
Whenever a job is submitted, the workload management system checks on the resources requested by the job script. It assigns cores, accelerators, local disk space, and memory to the job, and sends the job to the nodes for computation. If the required number of cores or memory are not yet available, it queues the job until these resources become available. If the job requests resources that are always going to exceed those that can become available, then the job accordingly remains queued indefinitely.
The workload management system keeps track of the status of the job and returns the resources to the available pool when a job has finished (that is, been deleted, has crashed or successfully completed).
4.5 What Do Job Scripts Look Like?
A job script looks very much like an ordinary shell script, and certain commands and variables can be put in there that are needed for the job. The exact composition of a job script depends on the workload manager used, but normally includes:
-
commands to load relevant modules or set environment variables for the job to run
-
directives for the workload manager for items associated with the job. These items can be a request for resources, output control, or setting the email addresses for messages to go to
-
an execution (job submission) line
When running a job script, the workload manager is normally responsible for generating a machine file based on the requested number of processor cores (np), as well as being responsible for the allocation any other requested resources.
The executable submission line in a job script is the line where the job is submitted to the workload manager. This can take various forms.
Example
For the Slurm workload manager, the line might look like:
Example
For PBS Professional it may simply be:
Example
For GE it may look like:
4.6 Running Jobs On A Workload Manager
The details of running jobs through the following workload managers is discussed later on, for:
4.7 Running Jobs In Cluster Extension Cloud Nodes Using cmjob
Extra computational power from cloud service providers such as the Amazon Elastic Compute Cloud (EC2) can be used by an appropriately configured cluster managed by NVIDIA Base Command Manager.
If the head node is running outside a cloud services provider, and at least some of the compute nodes are in the cloud, then this “hybrid” cluster configuration is called a Cluster Extension cluster, with the compute nodes in the cloud being the cloud extension of the cluster.
For a Cluster Extension cluster, job scripts to a workload manager should be submitted using NVIDIA Base Command Manager’s cmjob utility. The cmjob utility should be configured beforehand by the administrator (section 4.3 of the Cloudbursting Manual). The cmjob utility allows the job to be considered for running on the extension (the cloud nodes). Jobs that are to run on the local regular nodes (not in a cloud) are not dealt with by cmjob.
The cluster administrator must have created a certificate for cmjob use for the user that is using the cmjob job submission utility:
Example
In addition, the environment module (section 2.3) cmjob is typically configured by the system administrator to load by default on the head node. It must be loaded for the cmjob utility to work.
The default settings for cmjob are configured by the cluster administrator. By default, the storage provided by Amazon’s S3 has an expiry date of 30 days (section 4.3 of the Cloudbursting Manual). Users planning to that keep data in the cloud may wish to check with the administrator what the S3 expiry setting is for them, if they have not already been informed about it.
4.7.1 Introduction To Options For cmjob
The syntax for cmjob has the following form:
cmjob [options] [arguments]
The submit option is the most important option for users. A basic example for job submission takes the following form with the submit option:
cmjob submit <script>
Details for cmjob are given by the help option (-h|--help). The help option gives details for deeper level options, as well as at the top level. At the top level, the help text that is displayed is:
4.7.2 Running cmjob submit
Users that are used to running jobs as root should note that the root user cannot usefully run a job with cmjob submit.
Regular users can submit job scripts to the cloud via the command line, using the basic submit option:
Example
Users can also run cmjob submit in more sophisticated ways. The submission can be done with some cloud-related options set. This can be done in two styles with cmjob:
4.7.2.1 Command Line Style Options For cmjob submit
The main command line options for cmjob submit can be viewed via the help text:
4.7.2.2 Job-directive Style #CMJOB Directives For cmjob submit
All cmjob submit command line options can also be specified in a job-directive style format in the job script itself, using the “#CMJOB” tag to indicate an option.
Example
4.7.2.3 Workload Manager Job-directives And Workload Manager Flag Options For cmjob
Beside the two cmjob submit styles using options and directives, there is another way, independent of those, to pass on job handling instructions. This is using by workload manager job specifications.
Workload manager batch job tags are tags associated with the workload manager, such as #SBATCH for Slurm (Chapter 5), or #PBS for PBS Professional (Chapter 7). These tags can also be used by the user to specify flags to be sent to the workload manager when submitting the job via cmjob submit. This can be done by
-
using the tag itself (e.g:
#SBATCHfor Slurm,#PBSfor PBS Professional …) These can be used along with the#CMJOBtags.Example
-
or by using the
cmjobflag option--extra-flagsto specify the flag associated with the tag.Example
4.7.3 An Example Session Of Running cmjob With Cloud Storage
In this section a job is submitted with cmjob to a cloud compute node. For this to work, the cluster administrator should have already arranged for the cloud director and cloud compute nodes to be up.
If cloud storage is needed for a job, then cmjob causes it to be powered up. If it is not needed, then it is powered down. If AWS is used, then the cloud storage gets input from cmjob via an S3 bucket. By default the S3 bucket storage expires after 30 days.
The job submitted via cmjob could be something like the slurmhello.sh script from section 5.3.1, but with appropriate cmjob options.
Cluster administrators can use cmsh to list cloud jobs that are running via cmjob. The jobs are listed under the cloudjobs submode.
In the following example, where a job has been submitted, the cloud storage is not yet up:
Example
The cmjob utility takes care of the storage requirements and directives specified by the user. In the preceding example it brings up cloud storage automatically.
4.7.3.1 Tracking Job Status With cmsh
The job status can be viewed using cmsh by the cluster administrator, and also by users with the appropriate profile privileges. Once the storage node is up, a job typically displays a sequence similar to the following in the jobStatus column:
Example
followed by:
followed by:
followed by:
followed by (for jobs with a data label):
followed by:
followed by:
4.7.3.2 Tracking Job Status With cmjob
Regular users without cmsh profile privileges can track the same job status sequence via the cmjob status <job name> command:
Example
4.7.3.3 Running cmjob With Labels For Data
Labels can be assigned to data placed in the cloud by a job—job A for example. Data that that is left in the cloud for the next job—job B, for example—-can then be accessed by job B using that label, and then be kept in the cloud under a new label. This can be a more efficient way to run chained jobs. The data can also be taken out from the cloud and stored locally, even if this is not efficient.
In other words, a label allows users to avoid having to move data in and out of the cloud when jobs use the same data, which can save time and money.
Scripts for the example session: The following example session is based on the following job scripts, which use basic Unix utilities such as seq, paste, bc to do some simple arithmetic:
Example session run for user fred: The Slurm workload manager and cmjob modules should already be loaded (module load slurm cmjob).
The cloud director and compute nodes should also be up and running.
-
Submission, labels, and no downloading:
The session run starts with a userfredrunning:which submits the
generate.shscript. The script is run in the cloud, and it produces the numbers 1 to 10 on the compute node, which the user can pretend is a huge amount of data that is best kept in the cloud. The output is placed in a file1to10. The--outputoption means that the output file is given the labelmylabel. The--no-downloadoption means the output—accessed using the labelmylabel—is prevented from being downloaded back to the directory offredon premises, which may be sensible for a huge amount of data that may be used by another job.The job status can be checked with
cmjob statusorcmjob status slurm-74:The label status can be checked with
cmjob list-labels:The files stored in the object store under a label can be checked using
cmjob list-files-for-label:If needed, the 1to10 file can be checked to see if it exists, and how it looks. It can be brought down from the cloud with the
downloadoption ofcmjob: -
Using a large object already in the cloud and bringing out a result locally:
The next job that is to be run, can pick up the labeled object in the cloud and do something with it. In this case, it picks up the numbers as input from the labeled object file in the cloud, and sums the numbers up with the script in the cloud compute node. The output of the script, which the user can pretend is considerably smaller than the input, can then be placed as output in the local directory offredusing the--outputoption:After the job is finished (according to the report from
cmjob status slurm-75), the filebasicsumshows up locally: -
Processing large data in the cloud and leaving the data there:
In the next case considered, thesquare.shfile can be run so that it uses the “large” file labeled withmylabel,1to10, and uses it as input data. It keeps the output file,squares, which is also a “large” file, in the object store in the cloud using the labelnumbers2:After that job is run, its output file,
squares, can be picked up and checked locally with:If the download is repeated, or otherwise risks overwriting a local file, then the user is prompted with a warning.
However, in any case, the idea is to avoid unnecessary downloads of the “large” file, so typically a download is not done for large data.
-
Processing the new large data in the cloud and downloading a reduced end result:
Continuing on, this new “large” data can be processed with the scriptsquaressum.sh, to sum thesquaresfile in the object store in the cloud. The squares file is accessed in the cloud with the labelnumbers2, and reduced to a single number. The shrunk result is brought down from the cloud and kept locally as the filesquaredsum:The job status can be checked with:
cmjob status<job name>When the job is in the
finishedstate, the user can run: -
Processing Using High-Performance AWS FSx For Lustre Storage:
The user Fred may wish to use a high-performance filesystem in the cloud. Lustre is a high-performance parallel filesystem aimed at HPC needs. Amazon offers AWS FSx with Lustre in some regions of AWS, as documented at https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/.
Region restrictions: Changes may need to be carried out to the region used, to make use of FSx.
For example, the scripts
generate.shand so on from here onward used a region,us-east-1, that at the time of writing (May 2020) did not have FSx. The regionus-west-1on the other hand did have FSx.So, if the user would like to have jobs using FSx, and the cluster administrator has set up the FSx-enabled region, such as
us-west-1, with a cloud director, cloud nodes, and cloud storage, then the user should also change the Slurm queue option (the partition option,-p) in the scriptsgenerate.shand so on from here.[An aside for the cluster administrator: The cluster administrator can manage the Slurm queues for the region via the
jobqueuesubmode (cmsh→wlm→jobqueue, section 7.7.2 of the Administrator Manual). A Slurm queue for cloud storage can also be created as an option when the cluster administrator runscm-cloud-storage-setupwhen setting up a region.]Permission restrictions: The high performance of Lustre is expensive, so a cluster administrator typically restricts its use. Some permissions may therefore be needed before a user can use Lustre.
[Aside for the administrator: Granting users FSx-related permissions is described here.]
Three ways to launch FSx: Once the appropriate tokens are set, the user can launch FSx volumes for their jobs in three ways—on-demand, user-managed, or admin-managed. The user should check with the cluster administrator which of these is available:
-
On-demand: With this way, the option
--on-demand-fsxcan be added tocmjob. This creates an FSx volume on demand, instead of a storage node, and the FSx volume is deleted after the job ends.For example, a session can be run, where the user
fredsubmits a job in a region that supports FSx, withWhen the job is completed, the FSx volume that came up on demand, is deleted.
-
User-managed: A more hands-on way to manage an FSx instance is with a create-use-delete sequence that is run by the user.
-
Creation can be carried out in this format:
cmjob create-fsx-instance<FSx instance name>The command creates an FSx instance with a name <FSx instance name> that the user specifies. On execution, the FSx instance ID is displayed. FSx instance IDs can also be seen if the command
cmjob list-fsx-instancesis run. -
Jobs can then be submitted with the
--fsx-instanceoption, in a format similar to:cmjob submit --fsx-instance<FSx instance name, or FSx instance ID>and the jobs then use the pre-created instance.
-
Unlike the
--on-demand-fsxoption, the FSx volume is not deleted when the job ends. So, after use, the instance must be deleted explicitly with a command in a form such as:cmjob delete-fsx-instance<FSx instance name, or FSx instance ID>
Thus a session can be run where a user
fredcreates an FSx instance,fsxa, with:Example
Once the FSx storage is available, it can be used merely by adding the
--fsx-instanceoption, along with the FSx storage identifier, tocmjob:Example
Once the job is finished, and
fredno longer requires the data, the instance should be deleted:Example
-
-
Admin-managed: With the admin-managed option, it is the cluster administrator who creates an FSx instance, and who shares it with one or more other regular users. Users are then able to use the instance just as in user-managed instances, but they cannot delete the instance or view the files of other users.
-
-
Processing Using High-Performance ANF Volumes:
ANF (Azure NetApp Files) is a high-performance filesystem available in Azure clouds. The procedures to use it are very similar to that for FSx volumes in AWS clouds.
The cluster administrator can set up a cloud director, cloud nodes, and cloud storage, in an ANF-enabled region, such as
westeurope. If a regular user would like to have jobs using ANF, and the user is using the scriptsgenerate.shand so on from here, then the user should set the Slurm queue option (the partition option,-p) so that that ANF-enabled region is used.[An aside for the cluster administrator: The cluster administrator can manage the Slurm queues for the region via the
jobqueuesubmode (cmsh→wlm→jobqueue, section 7.7.2 of the Administrator Manual). A Slurm queue for cloud storage can also be created as an option when the cluster administrator runscm-cloud-storage-setupwhen setting up a region.]Permission restrictions: ANF is expensive to use, so a cluster administrator typically restricts its use. Some permissions may therefore be needed before a user can use ANF.
[Aside for the administrator: Granting users ANF-related permissions is described here.]
Three ways to launch ANF: Once the appropriate tokens are set, the user can launch ANF volumes for their jobs in three ways—on-demand, user-managed, or admin-managed. The user should check with the cluster administrator which of these is available:
-
On-demand: With this way, the option
--on-demand-anfcan be added tocmjob. This creates an ANF volume on demand, instead of a storage node, and the ANF volume is deleted after the job ends.For example, a session can be run, where the user
fredsubmits a job in a region that supports ANF, withWhen the job is completed, the ANF volume that came up on demand, is deleted.
-
User-managed: A more hands-on way to manage an ANF instance is with a create-use-delete sequence that is run by the user.
-
Creation can be carried out in this format:
cmjob create-anf-volume<ANF volume name>The command creates an ANF volume with a name <ANF volume name> that the user specifies. On execution, the ANF instance ID is displayed. ANF volume IDs can also be seen if the command
cmjob list-anf-volumesis run. -
Jobs can then be submitted with the
--anf-volumeoption, in a format similar to:cmjob submit --anf-volume<ANF volume name, or ANF volume ID>and the jobs then use the pre-created instance.
-
Unlike the
--on-demand-anfoption, the ANF volume is not deleted when the job ends. So, after use, the instance must be deleted explicitly with a command in a form such as:cmjob delete-anf-volume<ANF volume name, or ANF volume ID>
Thus a session can be run where a user
fredcreates an ANF instance,anfa, with:Example
Once the ANF volume is available, it can be used merely by adding the
--anf-volumeoption, along with the ANF volume identifier, tocmjob:Example
Once the job is finished, and
fredno longer requires the data, the instance should be deleted:Example
-
-
Admin-managed: With the admin-managed option, it is the cluster administrator who creates an ANF volume, and who shares it with one or more other regular users. Users are then able to use the instance just as in user-managed instances, but they cannot delete the instance or view the files of other users.
-