Let’s say that you want to run a script that creates a magic square and then saves that square matrix as a .mat file in your home directory on the cluster so that you can download it back onto your computer. Such a script and the .serial file needed to submit it are provided. The first step is to copy them to your folder (or a subfolder of your folder) on the cluster.
The .serial file is what your ssh client uses to tell the cluster that it is submitting a job. It includes the queue to be used (-q), job name (-j), job overview name (-o), and error message name (-e). The latter two are saved to the folder that contained the .serial file.
To submit the job, first make sure that on the ssh client your active folder is the one where you copied the files to. This is checked by typing “pwd”, which will tell you the active directory, and/or “ls”, which will tell you the contents of the active directory.
When you first log in, you will be in /home/[username]/. To change to a subfolder of this directory, use the command “cd [foldername]”. If you want to go up a folder level (say you want to go from /home/[username] to /home), use the command “cd ../”.
Check the .serial file from your ssh client by typing the command “more savemagic.serial”. Edit the matlab script with the command “vim magic_script.m” to change the save path. A vim commands list can be found here.
To submit the job, type the command “bsub < savemagic.serial” in the ssh client.
Check that the job has been successfully submitted by typing the command “bjobs”.
If it ran successfully, soon the file “magic_out_5.mat” should appear in the directory you chose, along with an output and an error message (hopefully an empty one) generated by the .serial file.
Congratulations! You’ve run your first successful code on the cluster. The rest of the instructions will not have so many smaller details like this did, but it is important to understand all of the parts of the simple submission process.