cambiotraining / hpc-intro

Practical course on running jobs on a HPC
https://cambiotraining.github.io/hpc-intro/
Other
14 stars 13 forks source link

Software setup on CSD3 workshops #46

Open tavareshugo opened 4 months ago

tavareshugo commented 4 months ago

Might be good to have a script for setting things up on a fresh CSD3 account.

Collecting loose commands here.


Script to download data

cd ~/rds/rds-introhpc/
# workshop data
wget -O data.zip "https://www.dropbox.com/scl/fo/x1ery8kni952gz450jt3z/ADbTA_FLJxPejtY30QLf1G4?rlkey=dq2sah0gknmdfx9dp1nvdzd51&dl=1"
# mamba installer
wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"

Script to setup instances

# backup bashrc
cp ~/.bashrc ~/.bashrc_bkp

# unzip data to hpc-work
unzip ~/rds/rds-introhpc/data.zip -d ~/rds/hpc-work/hpc_workshop

# install mamba
bash ~/rds/rds-introhpc/Miniforge3-$(uname)-$(uname -m).sh -b -p $HOME/miniforge3
$HOME/miniforge3/bin/mamba init
source ~/.bashrc
conda config --add channels defaults; conda config --add channels bioconda; conda config --add channels conda-forge
conda config --set remote_read_timeout_secs 1000

# set R up
mamba install -y -n base r-argparse==2.2.2

# cache some conda environments
mamba create -y -n scipy scipy==1.12.0 numpy==1.26.4 matplotlib==3.8.3
mamba create -y -n mapping bowtie2==2.5.3
tavareshugo commented 4 months ago

(edit: at the moment this approach doesn't work because miniforge hard-codes the path to the python executable upon installation, so moving things around is not a good idea)

Alternative with no need to install mamba from scratch.

Set things up in shared space (this script is semi-broken don't copy/paste the whole thing, run it interactively on a fresh account):

# install mamba in shared space
bash ~/rds/rds-introhpc/Miniforge3-$(uname)-$(uname -m).sh -b -p ~/rds/rds-introhpc/miniforge3

~/rds/rds-introhpc/miniforge3/bin/mamba init
source ~/.bashrc
conda config --add channels defaults; conda config --add channels bioconda; conda config --add channels conda-forge
conda config --set remote_read_timeout_secs 1000

# set R up
mamba install -y -n base r-argparse==2.2.2

# cache some conda environments
mamba install -y -n scipy scipy==1.12.0 numpy==1.26.4 matplotlib==3.8.3
mamba install -y -n mapping bowtie2==2.5.3

On a new user, we can run this:

# backup bashrc
cp ~/.bashrc ~/.bashrc_bkp

# unzip data to hpc-work
unzip ~/rds/rds-introhpc/data.zip -d ~/rds/hpc-work/hpc_workshop

# copy miniforge into the users' directory
cp -r ~/rds/rds-introhpc/miniforge3 ~/

# initialise
$HOME/miniforge3/bin/mamba init

# add default channels
cat << 'EOF' > ~/.condarc
channels:
  - conda-forge
  - bioconda
  - defaults
remote_read_timeout_secs: 1000.0
EOF