Skip to content

Commit

Permalink
adding installation script for miniconda, and SLURM job files for sin…
Browse files Browse the repository at this point in the history
…gularity and Jupyter notebook launchers
  • Loading branch information
root authored and tmiddelkoop committed May 14, 2021
1 parent 308e21c commit 8f5b071
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
21 changes: 21 additions & 0 deletions slurm-gcp/SampleSlurmJobs/helloworld_singularity.slrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
#SBATCH --partition debug
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 1
#SBATCH --mem-per-cpu 2G
#SBATCH --time 1-0:00:00
#SBATCH --job-name singularity-helloworld
#SBATCH --output hellowrold-singularity-%J.log

date
hostname

module load singularity

echo "================================================ "
echo "download image"
singularity pull shub://singularityhub/hello-world
echo "Executing the hello-world image"
singularity run ./hello-world_latest.sif
echo "================================================ "

30 changes: 30 additions & 0 deletions slurm-gcp/SampleSlurmJobs/jupyter_launch.slrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#SBATCH --partition debug
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 1
#SBATCH --mem-per-cpu 4G
#SBATCH --time 2-0:00:00
#SBATCH --job-name jupyter-notebook-tunnel
#SBATCH --output jupyter-notebook-tunnel-%J.log

# get tunneling info
XDG_RUNTIME_DIR=""
# port=$(shuf -i8080-8084 -n1)
port=8080
node=$(hostname -s)
ip=$(hostname -i)
user=$(whoami)
cluster=$(hostname -f)

# print tunneling instructions jupyter-log
echo -e "
CloudShell port forward command for WebPreview
gcloud compute ssh ${node} -- -A -t -l ${user} -f -N -L ${port}:${ip}:${port}
"

module load miniconda

# DON'T USE ADDRESS BELOW.
# DO USE TOKEN BELOW
jupyter-notebook --no-browser --port=${port} --ip=${ip}

27 changes: 27 additions & 0 deletions slurm-gcp/scripts/install_miniconda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
conda_version=4.9.2
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh
chmod +x /tmp/miniconda.sh
/tmp/miniconda.sh -b -p /apps/miniconda/$conda_version -f
/apps/miniconda/$conda_version/bin/conda install jupyter -y

#conda_version=$( /apps/miniconda/bin/conda --version | awk '{print $2}')
mkdir -p /apps/modulefiles/miniconda
bash -c "cat > /apps/modulefiles/miniconda/${conda_version}" << CONDA_MODULEFILE
#%Module1.0#####################################################################
##
## modules miniconda/conda_version
##
## modulefiles/miniconda/conda_version
##
proc ModulesHelp { } {
global version modroot
puts stderr "miniconda/$conda_version - sets the environment for miniconda"
}
module-whatis "Sets the environment for using miniconda"
# for Tcl script use only
set topdir /apps/miniconda/$conda_version
set version $conda_version
set sys linux86
prepend-path PATH /apps/miniconda/$conda_version/bin
CONDA_MODULEFILE

0 comments on commit 8f5b071

Please sign in to comment.