Skip to content

Quick Start#

When connecting to H4H for the first time, here are some recommended action items:

Set up your .bashrc file#

TLDR: Complete .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
        for rc in ~/.bashrc.d/*; do
                if [ -f "$rc" ]; then
                        . "$rc"
                fi
        done
fi

unset rc

# BHKLAB additions
# User specific aliases and functions
alias bhklab="cd /cluster/projects/bhklab"
alias radiomics="cd /cluster/projects/radiomics"

# File permission setting
# Gives rwx for user and group, r-x for other
umask 002

The .bashrc file is a configuration file for the Bash shell. For a full description of this file, you can check out this article.

To view it, start in your home directory on H4H. You can open the file with your favourite text-editor. If you're unfamiliar with those, you can start with nano

$ pwd
/cluster/home/<YOUR_H4H_USERNAME>
$ nano .bashrc

By default, it should look something like this:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
        for rc in ~/.bashrc.d/*; do
                if [ -f "$rc" ]; then
                        . "$rc"
                fi
        done
fi

unset rc

For some convenience, we're going to add some extra settings to this file.

Data Directory Aliases#

First, to make it easy to get to the BHKLab data directories, we'll add two aliases:

# User specific aliases and functions
alias bhklab="cd /cluster/projects/bhklab"
alias radiomics="cd /cluster/projects/radiomics"

With these aliases, you can access the bhklab and radiomics data directories easily:

$ bhklab
$ pwd
/cluster/projects/bhklab
Access requirement

To use these aliases, you need to be connected to a data node or compute node. See Remote Access Nodes for instructions on how to access these.

Additionally, when you set up your H4H account with Zhibin Lu, he would have granted you access to bhklab, radiomics, or both. This will determine which data directories you have access to.

Default File Permissions#

Second, to make sure any files, directories, etc. you make, either interactively or using a script, is accessible by other lab members, add the following:

# File permission setting
# Gives rwx for user and group, r-x for other
umask 002
Internal or Private data

If you work with any internal or private datasets, you may want to adjust the file permissions setup or utilize subgroups to restrict access. Contact the lab member listed next to High Performance Computing (HPC) on H4H on the Lab Member Expertise page if you need assistance.

Interactive Jobs - salloc#

Familiarize yourself with salloc by reading our documentation on Interactive Jobs and Debugging and the Slurm salloc documentation.

Submitting Jobs - sbatch#

Familiarize yourself with submitting jobs by reading our documentation on Submitting Jobs on H4H and the Slurm sbatch documentation.

Slurm header example

#!/bin/bash
#SBATCH --job-name=my_job_name
#SBATCH --mem=8G
#SBATCH --time 1:0:0
#SBATCH --cpus-per-task 2
#SBATCH --nodes 1
#SBATCH --mail-user=bhklab.johnsmith@gmail.com
#SBATCH --mail-type=BEGIN,FAIL,END
#SBATCH --output="~/slurm_logs/%A-%x.out"
  • This will submit a job called "my_job_name".
  • It requests 2 CPUs with 8G of memory each for 1 hour.
  • An email will be sent to bhklab.johnsmith@gmail.com when the job begins, fails, and/or ends.
  • Logs will be output as a file with the format {job number}-{job name} in a directory called slurm_logs in the user's home directory.