Cluster Commands
Note
This page is adapted from the group document, “Getting Access to the KU Community Cluster”, written by Dr. Ashley Borkowski.
While the commands for the terminal are still applicable for the Cluster, there exist unique commands (and clever devices) which are only accessable when you are online.
Basic Commands
Some of the most used commands for the cluster are:
sbatch name.shsubmits a job called “name” to the cluster..shfiles are known as SLURM scripts, and are what tells the cluster what job(s) to run.squeue -u KUIDshows what jobs you currently have running, where KUID is your KU Username.scancel JOBIDcancels a job for the given JOBID. Job IDs are shown when a job is submitted, and when viewing the queue.sshareshows your FairShare score. The FairShare describes the priority of your jobs to ensure that the cluster is shared fairly amongst the KU community. As you submit more jobs, your weekly FairShare will decrease. This implies that the priority listing for submitted jobs will adjust accordingly. Therefore, someone who has a high FairShare score will have a much higher priority for submitted jobs to run.crctoolshows the storage available within your cluster profile, along with how much storage you have used specifically. If you use all the storage available, you will receive an automatic email from the cluster and will need to clear out space.sacctshows a list of your recently completed/running jobs on the cluster, along with relevant data such as how many nodes were used and what partition was chosen.seff JOBIDwill provide the runtime and memory used along with efficiency for a specific job, provided its Job ID in theJOBIDspace. This can be extremely helpful when determining how much memory or time should be allocated for a job. Allocating too much memory for a job will waste resources for the time allocated;seffcan help optimize jobs to resolve this issue.
Modules on the Cluster
module availshows the available modules within the Cluster.module purgeclears all the loaded modules within your current profile. Unless you load modules within your.bash_profile(more on this later), modules are not automatically loaded upon login.module listshows the loaded modules in your current profile.module load <modulename>loads in the desired module (replace<modulename>with the module from the list, e.g.module load grace).
Editing Your .bash_profile
Enter your
$HOMEdirectory (cd).Using
vi, enter your.bash_profile(vi .bash_profile). Enter insert mode by pressingi.Type in the module load commands and specify what modules to load upon login.
Recommended modules are (but not limited to):
module load grace(plotting software, XMGrace)module load vmd(Visual Molecular Dynamics, to visualize simulations)When you are finished adding modules, press ESC and type
:wq!. This writes and saves the bash profile.
It is recommended to load python via Conda environment within your
.bash_profile. The steps are as follows:Login to the Cluster.
Within your
$HOMEdirectory, type the following commands:module load condaconda create -n NAME python=VERSION(current version ispython=3.11. It is recommended you give the name something you will remember, such aspython3-11).Enter your bash profile,
vi .bash_profileand toggle insert mode withi.Within the module commands, type
module load conda.conda activate NAMEExit your bash profile by pressing ESC and typing
:wq!.Make sure that you source your bash profile with the command
source .bash_profilebefore logging out. This will make sure to load and activate your conda environment for every time you enter the Cluster.To add packages to your python profile, type
conda install PACKAGE, wherePACKAGEis the package of interest. For example,conda install numpyadds numpy to your environment.
Once modules are loaded and the bash profile is saved, you can source the profile with
source .bash_profileto save changes and allow for the commands to run each time you enter the Cluster.
Creating Alias Commands
When off the Cluster
To add an alias on your home device (and not on the cluster), the following commands are used (Mac specific):
Open a terminal and enter your bash profile:
vi .bash_profileEnter insert mode (
i) and enter the aliases you want for your terminal. It is recommended to have an alias for logging onto the cluster:alias *your initials here*=‘ssh -XY username@hpc.crc.ku.edu’
Press ESC and type
:wq!to save your bash profile.Type
source .bash_profileto add the alias to your computer. Exit and reopen the terminal, and type in your alias. You should be prompted to enter your password and then connect to the cluster.
When on the Cluster
Aliases are located in the same $HOME directory bash profile as modules.
When you are editing your
.bash_profile, the following commands are helpful:alias queue=‘squeue -u username’(allows you to typequeueto see what jobs you have submitted)alias pgi=‘module load compiler/pgi/19’(for running Fortran code)alias pgi=‘module load compiler/gcc/8.3’(to switch back to gcc for running XMGrace)alias watch=‘watch -n 5 squeue -u username’(allows you to typewatchto watch the queue with 5 second updates to see when your jobs complete)
Note
If you use the watch alias, make sure to open a new tab on your terminal and login to the cluster. When the watch command is used, that entire terminal tab is used solely for viewing the queue.
Save and close the file (ESC +
:wq!for vi users)Source the profile (
source .bash_profile)