Running a batch job#

srun, which we used to submit our first job, is great if you need to do something quick and see the output immediately. If you have code that runs for seven hours, using srun is not a great idea. This is because jobs submitted with srun are killed if you lose your connection. So, for example, if you start an srun job, but then your laptop falls asleep or you close VSCode, your connection will drop and your job will be killed.

If you have some truly serious, multi-hour (or multi-day) computation (and that’s what Picotte is really good for), a better idea is to run it in the background using a batch job. Submitting a batch job is conceptually similar to using srun, but the job will run on its assigned compute node in the background until it’s over. If it needs to take two days, it takes two days. You can close VSCode or shut down your laptop — it won’t affect a batch job.

Let’s walk through an example of running a batch job. This will put together everything we’ve learned, from job submission, to using environment modules to load scientific software on Picotte.