This guide outlines the workflow for effectively utilizing the CHPC resources at the University of Utah. It covers setting up your environment, connecting to CHPC, managing interactive sessions, and tips for efficient computation.
-
Log in to the CHPC User Portal:
- Navigate to https://www.chpc.utah.edu/role/user/edit_profile.php.
- Enter your UNID and password to log in.
-
Change Your Shell:
- Locate the "Shell in General Environment" option.
- Select "/bin/bash" from the dropdown menu.
- Click "Submit" to save your changes.
-
SSH URL Format:
- Use the following format to connect to CHPC clusters:
ssh unid@cluster[1,2].chpc.utah.edu- Replace
unidwith your University of Utah ID. - Replace
clusterwith the name of the cluster you wish to access (e.g.,ashornotch). - Optionally, specify
1or2to connect to a specific cluster (e.g.,cluster1orcluster2).
- Replace
- Use the following format to connect to CHPC clusters:
-
Examples:
- Connect to the default cluster (load balancer will assign you to the preferred cluster):
ssh [email protected] - Connect to a specific cluster (e.g.,
cluster1):ssh [email protected]
- Connect to the default cluster (load balancer will assign you to the preferred cluster):
-
GUI Alternative:
- For users who prefer a graphical interface, FastX is available. Visit https://www.chpc.utah.edu/ for more information.
-
Windows Users:
- Enable OpenSSH Client (built into Windows 10 and later).
- Alternatively, download and use PuTTY or FastX.
-
Open the Bash Profile:
- Use
nanoto edit your~/.bashrcfile:nano ~/.bashrc
- Use
-
Add the Interactive Helper Function:
- Scroll to the bottom of the file and paste the following function:
interactive ()
{
local DEFAULT_ARGS=(--account="$1" --partition="$2" --nodes=1 --ntasks-per-node=1 --cpus-per-task=4 --mem=64G --time="$3" --gres=gpu:1);
local EXTRA_ARGS=();
local DO_NOTIFY=0;
local num_fixed_args=3;
local args_copy=("$@");
local extra_args_start_index=-1;
local i=0;
while (( i < ${#args_copy[@]} )); do
if [[ "${args_copy[$i]}" == "--notify" ]]; then
DO_NOTIFY=1;
unset 'args_copy[i]';
args_copy=("${args_copy[@]}");
continue;
fi;
if [[ "${args_copy[$i]}" == "--" ]]; then
extra_args_start_index=$((i + 1));
break;
fi;
i=$((i + 1));
done;
if [[ $extra_args_start_index -ne -1 ]]; then
EXTRA_ARGS=("${args_copy[@]:$extra_args_start_index}");
fi;
declare -A arg_map;
for arg in "${DEFAULT_ARGS[@]}";
do
key="${arg%%=*}";
arg_map["$key"]="$arg";
done;
for extra_arg in "${EXTRA_ARGS[@]}";
do
key="${extra_arg%%=*}";
arg_map["$key"]="$extra_arg";
done;
if [[ -v arg_map["--gres"] ]]; then
local gres_value="${arg_map["--gres"]}";
if [[ "$gres_value" == "--gres" || "$gres_value" == "--gres=" ]]; then
unset arg_map["--gres"];
fi;
fi;
local final_args=();
for key in "${!arg_map[@]}";
do
final_args+=("${arg_map[$key]}");
done;
local remote_command="";
if (( DO_NOTIFY == 1 )); then
remote_command="push_to_mobile 'chpc-notification' 'Interactive Queue Ready' & ";
fi;
remote_command+="exec bash";
if [ -z "${DEBUG+x}" ]; then
salloc "${final_args[@]}" srun --pty /bin/bash -l -c "${remote_command}";
else
echo "salloc ${final_args[@]} srun --pty /bin/bash -l -c \"${remote_command}\"";
fi
}-
Save and Exit:
- Press
Ctrl + Oto save. - Press
Ctrl + Xto exit.
- Press
-
Apply Changes:
- Reload your Bash profile:
source ~/.bashrc
- Reload your Bash profile:
- Persistent Sessions: Tmux allows you to detach and reattach to your session, making it ideal for long-running jobs.
- Multiple Windows/ Panes: Tmux supports multiple windows and panes for organizing your workflow.
-
Create a New Session:
tmux new -s my_session- Replace
my_sessionwith a meaningful name for your session.
- Replace
-
Detach from the Session:
- Press
Ctrl + B, thenDto detach.
- Press
-
Reattach to the Session:
tmux attach -t my_session
-
Inside a Tmux Session:
- Ensure you are inside your tmux session before requesting an interactive session.
-
Request Resources:
- Use the
interactivefunction to request an interactive session:interactive my_account main_partition 01:00:00- Replace:
my_accountwith your CHPC account name.main_partitionwith the partition (queue) you want to use.01:00:00with your desired walltime inHH:MM:SSformat.
- Replace:
- Use the
-
Customize Resource Requests (Optional):
- Override default arguments by adding extra parameters:
interactive my_account main_partition 01:00:00 -- --nodes=2 --mem=128G
- Override default arguments by adding extra parameters:
-
Additonal Usage Instructions (Optional):
- See additional usage instructions here: https://gist.github.com/richbai90/a6f28ef8257335b38f89d3af07bb174a
-
Detach from Tmux Session:
- Press
Ctrl + B, thenDto detach from your tmux session.
- Press
-
Reattach Later:
- Reattach to your session when you are ready to resume work:
tmux attach -t my_session
- Reattach to your session when you are ready to resume work:
- Use
squeue -u unidto monitor your job status. - Use
sacctto view historical job information.
- Home Directory:
/uufs/chpc.utah.edu/common/home/unid - Scratch Space: plan to use
/scratchfor temporary storage.
- Visit the CHPC Documentation for more resources.
- Contact CHPC support at [email protected].
By following this guide, you can efficiently utilize CHPC resources for your computational needs.