Skip to content

Commit

Permalink
Merge pull request #48 from carlos-encs/master
Browse files Browse the repository at this point in the history
Juyterlabs venv - added to the manual
  • Loading branch information
smokhov authored May 10, 2024
2 parents 6f67a0c + ceb7abc commit 30cfe55
Show file tree
Hide file tree
Showing 3 changed files with 335 additions and 219 deletions.
55 changes: 55 additions & 0 deletions doc/scheduler-scripting.tex
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,61 @@ \subsubsection{Jupyter Labs in Conda and Pytorch}
\end{enumerate}
\end{itemize}
% ------------------------------------------------------------------------------
\subsubsection{Jupyter Labs + Pytorch in Python venv}
\label{sect:jupiterlabs-venv}
This is an example of Jupyter Labs running in a Python Virtual environment (venv), with Pytorch
\begin{itemize}
\item
Environment preparation: for the FIRST time:
\begin{enumerate}
\item
Go to your speed-scratch directory: \texttt{cd /speed-scratch/\$USER}
\item
Open an Interactive session: \texttt{salloc --mem=50G --gpus=1 --constraint=el9}
\item
Create Python venv and install jupyterlab+pytorch
\scriptsize
\begin{verbatim}
module load python/3.11.5/default
setenv TMPDIR /speed-scratch/$USER/tmp
setenv TMP /speed-scratch/$USER/tmp
setenv PIP_CACHE_DIR /speed-scratch/$USER/tmp/cache
python -m venv /speed-scratch/$USER/tmp/jupyter-venv
source /speed-scratch/$USER/tmp/jupyter-venv/bin/activate.csh
pip install jupyterlab
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
exit
\end{verbatim}
\normalsize
\end{enumerate}
\item
Running Jupyter Labs, from \textbf{speed-submit}:
\begin{enumerate}
\item
Open an Interactive session: \texttt{salloc --mem=50G --gpus=1 --constraint=el9}
\scriptsize
\begin{verbatim}
cd /speed-scratch/$USER
module load python/3.11.5/default
setenv PIP_CACHE_DIR /speed-scratch/$USER/tmp/cache
source /speed-scratch/$USER/tmp/jupyter-venv/bin/activate.csh
jupyter lab --no-browser --notebook-dir=$PWD --ip="0.0.0.0" --port=8888 --port-retries=50
\end{verbatim}
\normalsize
\item
Verify which port the system has assigned to Jupyter:
\texttt{http://localhost:XXXX/lab?token=}
\item
SSH Tunnel creation: similar to Jupyter in Singularity, see \xs{sect:jupyter}
\item
Open a browser and type: \texttt {localhost:XXXX} (port assigned)
\end{enumerate}
\end{itemize}
% ------------------------------------------------------------------------------
\subsubsection{VScode}
\label{sect:vscode}
Expand Down
Binary file modified doc/speed-manual.pdf
Binary file not shown.
Loading

0 comments on commit 30cfe55

Please sign in to comment.