Over time to make my life easier, I have developed several shortcuts for convenience in execution and navigation in the Unix system and Slurm workload manager. I usually put these commands in separate files in a folder and then add that folder as an alias in .bashrc file.
To request compute nodes for a specified duration in hours from a list of partitions in HPC:
Save the following script in the file named ddnode_hr_core and copy the file to a folder named HPC_shortcuts in your home directory. Then, add export PATH=$PATH:~/shortcuts in your .bashrc file. Then, restart the terminal, type ddnode_hr_core hoursNeeded numberCPU in your terminal (here hoursNeeded numberCPU are the input - a numerical value), then, enter the corresponding number for the partition.
This shortcut returns the directory of the job running in HPC:
Save this script in the file named jobDir, and copy it to the HPC_shortcuts folder as described above.
Command :
jobDir 123456789
Output:
/path/to/the/script/used/for/submitting/the/job
Script:
# Shortcut to the directory of the job running in slumr workload managerscontrol show job $1 | awk -F= '/Command=/{print $2}'Find the age of the files sorted by last modified time:
This shortcut returns the latest 4 files sorted by "time modified" and the age of the file. Save the script in the file named lls and copy it to the shortcut folder.
Command:
lls
Output:
0:13:42 visitlog.py
2:07:42 visit0053.value.Z
2:07:42 visit0053.png
2:09:06 visit0052.value.Z
Script:
#!/bin/shUseful for Mac: this shortcut removes the extra text pasted when copying a directory in Cyberduck
Extra step: add alias ccd="source ~/shortcuts/ccd.sh" in .bashrc file
Shortcut to get the list of jobs running on the cluster by the current user in slurm workload manager
Calls sinfo command for the selected partition with some extra information (mecfd_q is the name of the partition in FSU RCC cluster)
Shows the list of the jobs running in a specific partition
Perform PWD and DATE commands in each sub-directory to list the last modified time of a specific file (binary-tahoe)
for d in ./*/; do (cd "$d" && echo "`date -r binary-tahoe` ${PWD##*/}"); done