Skip to content

Commit

Permalink
Merge pull request #47 from carlos-encs/master
Browse files Browse the repository at this point in the history
jupyter labs no container scripts.
  • Loading branch information
smokhov authored May 6, 2024
2 parents 682c55f + b3df430 commit 6f67a0c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/jupyterlabs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!-- TOC --><a name="README"></a>
# README

This directory has example scripts to run Jupyter Labs+conda+python without containers

<!-- TOC --><a name="Preparation"></a>
## Preparation
After opening an interactive session (salloc)

Run the script `firsttime.sh`, ONLY 1 time, it will
- Create a /speed-scratch/$USER/Jupyter directory: change Jupyter to any name of your choice
- Set environment variables for tmp directories and for CONDA_PKGS_DIRS
- Create a conda environmen named: jupyter-env (change it to any name of your choice)
- Install JupyterLabs + pytorch
- exit the interactive session

## Execution
After opening an interactive session (salloc)

Run the script `run.sh`, everytime you want to execute jupyterlabs

## Browsing
After Execution, create an ssh tunnel (read https://nag-devops.github.io/speed-hpc/#jupyter-notebooks-in-singularity)

Open a browser: http://localhost:XXXX/lab?token=XXXXXXXXXX

## REMINDER
Don't forget to setup the 2 scripts with the parameters of your choice
Jupyter: directory, jupiter-env: environment name

<!-- TOC end -->
12 changes: 12 additions & 0 deletions src/jupyterlabs/firsttime.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/encs/bin/tcsh

mkdir -p /speed-scratch/$USER/Jupyter
module load anaconda3/2023.03/default
setenv TMPDIR /speed-scratch/$USER/tmp
setenv TMP /speed-scratch/$USER/tmp
setenv CONDA_PKGS_DIRS /speed-scratch/$USER/Jupyter/pkgs
conda create -p /speed-scratch/$USER/Jupyter/jupyter-env -y
conda activate /speed-scratch/$USER/Jupyter/jupyter-env
conda install -c conda-forge jupyterlab -y
pip3 install --quiet torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
exit
10 changes: 10 additions & 0 deletions src/jupyterlabs/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/encs/bin/tcsh

cd /speed-scratch/$USER/Jupyter
module load anaconda3/2023.03/default
setenv TMPDIR /speed-scratch/$USER/tmp
setenv TMP /speed-scratch/$USER/tmp
setenv CONDA_PKGS_DIRS /speed-scratch/$USER/Jupyter/pkgs
conda activate /speed-scratch/$USER/Jupyter/jupyter-env
jupyter lab --no-browser --notebook-dir=$PWD --ip="0.0.0.0" --port=8888 --port-retries=50

0 comments on commit 6f67a0c

Please sign in to comment.