Hi Daniel,
If you’re interested, the following assumes interaction through SLURM and, arbitrarily, a floating profile that loads on the cryosparc master node, login node and cluster node, but only for the scripting.
Requesting an interactive node from the scheduler.
<login_node> $ srun --nodes=1 --gres=gpu:4 --job-name=CS_interactive --pty bash
<cluster_node_a> $ hostname
cluster_node1.super_computer
Editing .ssh/config on the cryosparc_user account.
Host slurm_interactive_worker
HostName cluster_node1.super_computer
StrictHostKeyChecking no
Registering cluster_node_a as a worker.
<cluster_node_a> $ <path_to_cryosparc>/cryosparc_worker/bin/cryosparcw connect \
--worker slurm_interactive_worker \
--master <cryosparc_master_node> \
--port <port> \
--gpus 0,1,2,3 \
--ssdpath ${SLURM_SCRATCH_DIR} \
--newlane cluster_worker
That’ll get you started in the first instance. The next time, you may choose to request different resources:
Requesting a different interactive setup.
<login_node> $ srun --nodes=1 --gres=gpu:3 --job-name CS_Interactive --pty bash
<cluster_node_b> $ hostname
cluster_node2.super_computer
It’ll just be a matter of editing the hostname alias in the cryosparc_user
account’s .ssh/config
to point to cluster_node2.super_computer
and updating the worker
configuration.
Updating worker configuration.
<cluster_node_b> $ <path_to_cryosparc>/cryosparc_worker/bin/cryosparcw connect \
--worker slurm_interactive_worker \
--master <cryosparc_master_node> \
--port <port> \
--gpus 0,1,2 \
--ssdpath ${SLURM_SCRATCH_DIR} \
--update
…a process you could, in theory, script for the sake of convenience.
Example script:
#!/bin/bash
## VARIABLES
SSH_CONFIG="<path_to_cryosparc_user>/.ssh/config"
CURR_NODE=`grep -A1 'Host slurm_interactive_node' ${SSH_CONFIG} | awk '{print $NF}'`
THIS_NODE=`hostname`
NUM_GPUS=`nvidia-smi -L | awk '{printf "%d\n",$2}' | paste -s -d","`
## USER PROMPT
echo "LANE CLUSTER_WORKER"
echo "Current host : ${CURR_NODE}"
echo "Host detected : ${THIS_NODE}"
echo "GPUs detected : ${NUM_GPUS}"
echo "SSD detected : ${SLURM_SCRATCH_DIR}"
echo
echo "Update SSH and worker config?"
select yn in "Yes" "No"; do
case $yn in
Yes )
#UPDATE HOSTNAME ALIAS
sed -i -r "/Host slurm_interactive_worker/{n;s,(HostName).*,\\1 $THIS_NODE,}" ${SSH_CONFIG}
echo "Updated [slurm_interactive_worker] stanza:"
grep -A1 'Host slurm_interactive_worker' ${SSH_CONFIG}
#UPDATE GPU COUNT
echo "Updating NODE configuration..."
<path_to_cryosparc>/cryosparc_worker/bin/cryosparcw connect --worker slurm_interactive_worker --master <cryosparc_master_node> --port <port>--ssdpath ${SLURM_SCRATCH_DIR} --gpus ${NUM_GPUS} --update
break
;;
No )
exit
;;
esac
done
…to run in subsequent interactive shells. Will require adapting for your specific setup.
Cheers,
Yang