{"id":3439,"date":"2024-04-25T13:27:04","date_gmt":"2024-04-25T20:27:04","guid":{"rendered":"https:\/\/in.nau.edu\/arc\/?page_id=3439"},"modified":"2024-08-14T09:05:25","modified_gmt":"2024-08-14T16:05:25","slug":"interactive-jobs","status":"publish","type":"page","link":"https:\/\/in.nau.edu\/arc\/overview\/using-the-cluster-advanced\/interactive-jobs\/","title":{"rendered":"Interactive Jobs"},"content":{"rendered":"\n
\n
<\/p>\n

\n

\n
\n

Contact Advanced Research Computing<\/h3>\n <\/div>\n
\n \n
\n <\/i>\n Email:<\/span>\n <\/div>\n
ask-arc​@nau.edu<\/div>\n <\/a>\n <\/div>\n<\/div>\n\n<\/p>\n

<\/div>\n<\/div>\n\n

Interactive Jobs<\/h1>\n

In addition to standard batch job use of compute resources via a slurm job script, researchers have access to to compute resources in an interactive mode as well by utilizing srun<\/span> and\/or salloc<\/span> commands.<\/p>\n

Understanding srun and salloc<\/h2>\n

srun<\/span> is a command that simply runs a given command on the HPC cluster. The \u2010\u2010pty<\/span> flag will attach stdio<\/span> and stdout<\/span> to your current terminal, providing an interactive experience.<\/p>\n

salloc<\/span> is a command that allows you to simply allocate resources on the cluster for you to do whatever with. The typical flow for using this is:<\/p>\n

    \n
  1. Allocate HPC resources<\/li>\n
  2. Use the HPC resources with srun or ssh<\/li>\n
  3. Deallocate HPC resources<\/li>\n<\/ol>\n

    Using salloc<\/span> can be compared to an sbatch script in the way that the line-by-line execution is handled. The primary difference between salloc<\/span> and sbatch<\/span> is that salloc<\/span> requires interactivity while sbatch<\/span> executes commands one after another.<\/p>\n

    Interactive Jobs with srun<\/h2>\n

    An interactive job can be submitted by using the srun<\/span> command. However, there are specific arguments you must pass in order to have it become interactive.
    \nsrun [options] --pty \/bin\/bash<\/code>
    \nExample:
    \n[abc123@wind]:~$ srun --pty \/bin\/bash
    \nsrun: job 9977591 queued and waiting for resources
    \nsrun: job 9977591 has been allocated resources
    \n[abc123@cn59]:~$ hostname
    \ncn59<\/code>
    \nThis will start a job via Slurm to run bash and connect your terminal session over to the new bash instance. However, using the srun command without any additional provisioning arguments will run your job with the default job resource allocations and time limits.<\/p>\n

    Here are some common flags you may want to use to request more resources:<\/p>\n