Working with Python
Last updated
Last updated
The tutorial assumes you have already worked through the . Therefore, the instructions here are abbreviated but will follow the same format so you may easily consult the extended tutorial.
Table of Contents
📝 Note: Do not execute jobs on the login nodes; only use the login nodes to access your compute nodes. Processor-intensive, memory-intensive, or otherwise disruptive processes running on login nodes will be killed without warning.
Open a Bash terminal (or MobaXterm for Windows users).
Execute ssh doaneusername@onyx.doane.edu
.
When prompted, enter your password.
Here is an example sbatch script for running a batch job on an HPC like Onyx.
Use nano or Vim (we use Vim here) to create and edit your sbatch script.
Create your sbatch script within Vim by typing i
for insert
mode or paste the contents of your sbatch script into Vim.
Save your file by typing :wq!
and return to the Bash shell.
Use Vim (vim
) to create your python source file within your working directory.
Paste the hello world python code into Vi.
Save your file and return to the Bash shell.
Python does not need to be compiled.
Before proceeding, ensure that you are still in your working directory (using pwd
) and that you still have the openmpi module loaded (using module list
).
We need to be in the same path/directory as our sbatch script and our python script. Use ls -al
to confirm their presence.
Use sbatch
to schedule your batch job in the queue.
This command will automatically queue your job using slurm and produce a job number. You can check the status of your job at any time with the squeue
command.
You can also stop your job at any time with the scancel
command.
View your results.
You can view the contents of these files using the less
command followed by the file name.
Your output should look something like this (the output is truncated.):
Download your results (using the scp
command or an SFTP client) or move them to persistent storage. See our section for help.