Examples
Batch system examples
We have made a few examples of how to use the batch system, both from the command line and through a batch submit file.
We have made a few examples of how to use the batch system, both from the command line and through a batch submit file.
Intel Xeon Phi x200, codename Knights Landing (KNL), is second generation MIC architecture product from Intel. At HPC2N 36 nodes, as a part of Kebnekaise, are equipped with Intel Xeon Phi 7250 CPUs. See our description of Intel Knight Landing for more information about the nodes.
At a high level there are three key aspects to achieving code performance on KNL:
We have two types of GPU cards available on Kebnekaise, NVIDIA Tesla K80 (Kepler) and NVIDIA Tesla V100 (Volta).
To request GPU resources one has to include a GRES in the submit file. The general format is:
#SBATCH --gres=gpu:<type-of-card>:x
where <type-of-card> is either k80 or v100 and x = 1, 2, or 4 (4 only for the K80 type).
The K80 enabled nodes contain either two or four K80 cards, each K80 card contains two gpu engines.
A basic example | Two jobs simultaneously | Separate output/error files | MPI jobs | Multiple parallel jobs sequentially | Multiple parallel jobs simultaneously
A job can be given the constraint that it only starts after another job has finished.
In the following example, we have two Jobs, A and B. We want Job B to start after Job A has successfully completed.
First we start Job A by submitting it
$ sbatch <jobA.sh>
Making note of the assigned job ID for Job A, we then submit Job B with the added condition that it only starts after Job A has successfully completed:
To cancel a job, use scancel. You need the running or pending jobid. It is only the job's owner and SLURM administrators that can cancel jobs.
$ scancel <jobid> To cancel all your jobs (running and pending) you can run $ scancel -u <username> You get the job id when you submit the job. $ sbatch -N 1 -n 4 submitfile Submitted batch job 173079 $ scancel 173079 Or through squeue |
To see status of partitions and nodes, use
$ sinfo
To get the status of all SLURM jobs
$ squeue
To only view the jobs in the largemem partition on Kebnekaise
$ queue -p largemem
Get the status of an individual job
$ scontrol show job <jobid>
#!/bin/bash # Example with 4 tasks and 28 cores per task for MPI+OpenMP # # Project/Account #SBATCH -A hpc2n-1234-56 # # Number of MPI tasks #SBATCH -n 4 # # Number of cores per task #SBATCH -c 28 # # Runtime of this jobs is less then 12 hours. #SBATCH --time=12:00:00 # # Clear the environment from any previously loaded modules module purge > /dev/null 2>&1 # Load the module environment suitable for the job module load foss/2019a
#!/bin/bash # Example with 28 cores for OpenMP # # Project/Account #SBATCH -A hpc2n-1234-56 # # Number of cores #SBATCH -c 28 # # Runtime of this jobs is less then 12 hours. #SBATCH --time=12:00:00 # # Clear the environment from any previously loaded modules module purge > /dev/null 2>&1 # Load the module environment suitable for the job module load foss/2019a # Set OMP_NUM_THREADS to the same value as -c # with a fallback in case it isn't set.