Interactive Jobs
Exercises¶
- Get an interactive shell with srun
Use srun to start an interactive bash session on a compute node with 2 CPUs, 4G of memory, and a 30-minute time limit. Once on the node, confirm you are not on the login node by running hostname, then exit cleanly.
Hint / Solution
- Allocate resources with salloc, then run commands
Use salloc to reserve 4 CPUs and 8G of memory for 1 hour. Then use srun within that allocation to run hostname and free -m on the allocated node. Release the allocation when done.
Hint / Solution
- Request X11 forwarding for a graphical application
First, SSH to the cluster with X11 forwarding enabled. Then use srun with --x11 to start an interactive session. Verify X11 is working by running xeyes or xclock (if available), or by checking that the $DISPLAY environment variable is set.
Hint / Solution
- Run a single command on a compute node without an interactive shell
Use srun (without --pty or bash) to run a single command on a compute node. Check which Linux kernel version is running on the compute nodes by executing uname -a.