.. _tutorials-onboarding-m4-quiz:
Scheduler Self-Check
====================
Test your understanding of Slurm partitions, job submission types, and resource allocation logic on the CoSTAR cluster.
These questions are browser-side self-checks. They are not formally graded and can be retaken as many times as needed.
.. raw:: html
.. quizdown::
---
primary_color: "var(--color-brand-primary)"
secondary_color: "var(--color-background-secondary)"
text_color: "var(--color-foreground-primary)"
shuffle_questions: false
shuffle_answers: true
---
### How does "Job Priority" in Slurm affect your job execution?
1. [ ] Job priority determines how fast the CPU/GPU will execute your code once it starts.
>
Incorrect.Job priority has no impact on the speed of execution. Once a job starts, its execution depends on the allocated resources and the efficiency of the job itself.
1. [ ] Job priority ensures your job always runs faster than other jobs.
>
Incorrect. Job priority does not affect runtime speed; it only impacts how soon a job starts.
1. [x] Job priority determines how quickly your job is allocated resources to move from PENDING to RUNNING.
>
Correct. Job priority in Slurm determines the order in which jobs are scheduled and allocated resources. Higher-priority jobs are dispatched sooner, provided the required resources are available thereby reducing the queueing time.
1. [ ] Job priority only affects GPU-intensive jobs.
>
Incorrect. Job priority affects all jobs in the queue, regardless of whether they are CPU- or GPU-intensive.
### What is a "Partition" in the context of Slurm?
1. [ ] A single CPU core allocated to a job.
> Incorrect. A CPU core is a type of resource that can be requested for a job, but it is not a partition.
1. [ ] The high-speed storage space where your job's output is saved.
> Incorrect. While jobs use storage, a partition refers to a collection of compute resources, not storage space.
1. [ ] The local directory on the login node where you store your batch scripts.
> Incorrect. A partion is a groupe of nodes having similar hardware and not your home directory.
1. [x] A logical grouping of nodes with similar hardware (e.g., standard nodes, pilot nodes, or debug nodes).
> Correct! Partitions allow the scheduler to manage different hardware sets and enforce specific time or resource limits.
### Is it possible to start multiple tasks or instances of a program by submitting a single file to Slurm?
1. [ ] Yes, but you must manually execute the submission command multiple times from the login node.
> Incorrect. While this would create multiple jobs, it is an inefficient and manual process. The job array feature is specifically designed to handle this task automatically with a single submission command.
1. [ ] No, Slurm requires a unique ``.sh`` file for every individual job ID.
> Incorrect. While this would create multiple jobs, it is an inefficient and manual process. The job array feature is specifically designed to handle this task automatically with a single submission command.
1. [x] Yes, by utilising Job Arrays or including multiple ``srun`` commands within a single batch script.
> Correct! Job Arrays are the most efficient way to run a large series of similar tasks (like hyperparameter sweeps) with one submission.
1. [ ] Yes, but you can only do this if you have requested an entire physical node.
> Incorrect. Slurm can handle multiple jobs on the same compute node, even within a single submit file.
### What is the primary difference between using ``srun`` and ``sbatch`` when submitting jobs on a Slurm cluster??
1. [ ] srun submits batch jobs, while sbatch is interactive.
> Incorrect - this is the reverse of their functions.
1. [x] ``sbatch`` submits a script to the background queue; ``srun`` is used to launch tasks or start interactive sessions.
> Correct! You typically use ``sbatch`` for your production runs and ``srun --pty bash`` for interactive sessions and live debugging.
1. [ ] ``srun`` is used to cancel active jobs and ``sbatch`` is used to check the queue status.
> Incorrect– srun is not used for cancellation and sbatch is not for monitoring the job queue.
1. [ ] Both commands are identical aliases and can be used interchangeably for all tasks.
> Incorrect - they serve distinct purposes within Slurm.
### Which of the following are considered "Best Practices" for efficient resource usage on CoSTAR?
Select all that apply:
- [ ] Requesting the maximum possible memory and CPU cores "just in case" to ensure the job doesn't crash.
> Incorrect. Over-requesting resources lowers your Fairshare priority and keeps your job stuck in the queue longer.
- [x] Using a "Debug" partition for short test runs before submitting a long production job.
> Correct. The debug partition is ideal for troubleshooting and quick tests because they often have shorter wait times, allowing you to catch errors quickly before a long run.
- [x] Staging your large training datasets in the high-performance scratch area before the job begins.
> Correct. To optimize performance and avoid slow I/O, large data files should be placed in a temporary high-performance storage area (like scratch) during computations.
- [ ] Running very large, multi-hour training computations inside an interactive session.
> Incorrect. Long-running tasks should be submitted as non-interactive ``sbatch`` jobs to ensure they are managed correctly by the scheduler if you disconnect.