Batch Exercise
This exercise explores running R as a Slurm batch job on Frontera. You will need to create two scripts: an R script that contains all of the commands you would have typed at the command line, and a job script with Slurm commands plus commands for invoking R in batch mode.
Following is a sample R script. Name it sample_script_to_batch.R. Note there are two ways to generate output illustrated in this example.
The following is a bare-bones Slurm script for running the R script in batch (in a single task on one node). Name the batch script RTestScript.sh. Be sure to fill out the allocation_code. You can delete the line referring to allocation code if you only have one allocation.
Submit the batch job from the directory where you placed the batch script. You should get a similar response to what follows:
$ sbatch RTestScript.sh
-----------------------------------------------------------------
Welcome to the Frontera Supercomputer
-----------------------------------------------------------------
No reservation for this job
--> Verifying valid submit host (login2)...OK
--> Verifying valid jobname...OK
--> Verifying valid ssh keys...OK
--> Verifying access to desired queue (development)...OK
--> Checking available allocation (<your_allocation>)...OK
--> Verifying that quota for filesystem /home1/00933/<your_username> is at 19.00% allocated...OK
--> Verifying that quota for filesystem /work2/00933/<your_username>/frontera is at 0.91% allocated...OK
Submitted batch job 7042641
You should get two files once the job has finished: (
in this example) and
or whatever name you gave your outfile. The file
should be empty unless there are errors in your batch script. If you didn't give the outfile a name, it will be called
.
Examine output.txt:
Note that both methods of showing output (unlike in the earlier example using , where
was required) resulted in it being written to the output file.
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)