diff --git a/src/jupyterlabs/README.md b/src/jupyterlabs/README.md new file mode 100644 index 0000000..6b9d08b --- /dev/null +++ b/src/jupyterlabs/README.md @@ -0,0 +1,31 @@ + +# README + +This directory has example scripts to run Jupyter Labs+conda+python without containers + + +## 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 + + \ No newline at end of file diff --git a/src/jupyterlabs/firsttime.sh b/src/jupyterlabs/firsttime.sh new file mode 100755 index 0000000..f85dca5 --- /dev/null +++ b/src/jupyterlabs/firsttime.sh @@ -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 diff --git a/src/jupyterlabs/run.sh b/src/jupyterlabs/run.sh new file mode 100755 index 0000000..9e8d21f --- /dev/null +++ b/src/jupyterlabs/run.sh @@ -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 +