please email sanjeev@slac.stanford.edu or cropp@slac.stanford.edu with any problems.

S3df management doesn't like it when heavy compute jobs are run on the interactive cluster (Iana). A solution to this is to run jupyter lab on batch compute on the milano cluster.

Make sure your account is part of FACET or ad:beamphysics before trying to access batch compute. Confused? look here and read the section Accessing AD and FACET Resources.

Jupyter Notebooks via Open OnDemand

VIDEO TUTORIAL

This is the easiest method. 


  1. login to open ondemand at https://s3df.slac.stanford.edu/ondemand
  2. click on the top menu bar and choose interactive apps → Jupyter
  3. Select Custom for Jupyter Image
  4. Select Conda Environment
  5. Make sure the conda env you pick has jupyterlab installed. if not: conda install -c conda-forge jupyterlab
  6. Customize this text that is shown:
  7. export CONDA_PREFIX=<path-to-miniconda3>
    export PATH=${CONDA_PREFIX}/bin/:$PATH
    source ${CONDA_PREFIX}/etc/profile.d/conda.sh
    conda env list
    conda activate <your-environment-name>
  8. Set the path to the conda env setup (CONDA_PREFIX) to run the jupyter notebook. ( conda info | grep "active env location"  can show the path to the current conda env setup (probably miniforge3). You would need to ssh into iana on s3df, activate a conda env that you made with jupyterlab and then run the command to find its path. ) An example output is /sdf/home/s/sanjeev/miniforge3/
     (an example of setting up a conda env for the first time for jupyter lab is here in the lume impact jupyter example)
  9. change <environment> to be the desired conda env, for example I have a conda env called bmad. Another explanation is here.
  10. Click use JupyterLab instead of Jupyter Notebook
  11. For run on cluster type select: Batch; s3df; account: FACET; Partition Milano *make sure your account is part of the FACET repo or use ad:beamphysics if your part of that. 

  12. Select number of hours and cores (max cores is 120)
  13. Configure rest of settings
  14. Launch and connect



Jupyter Notebooks via SSH and port forwarding

This method is a little more complicated but more reliable overall. 

These are steps for running a jupyter notebook on S3DF via juptyerlab. These instructions assume a first time setup of connecting to s3df and that your are part of the FACET repo (more info here). 

  1. Get a S3DF account
  2. Wait for approval
  3. Open your favorite terminal. I like termius and warp.
  4. Ssh into s3df login node with port forwarding (5555 can be changed to any preferred port): note: make sure this ssh is from your local machine as we need to have port 5555 open on the connection all the way from your local machine to jupyter lab on s3df. 

     ssh -L 5555:localhost:5555 <SLAC UNIX USERNAME>@s3dflogin.slac.stanford.edu

    if connecting from Windows' command line (cmd), specify the following:

     ssh -m hmac-sha2-512 -L 5555:localhost:5555 <SLAC UNIX USERNAME>@s3dflogin.slac.stanford.edu
  5. Connect to Iana:

     ssh -L 5555:localhost:5555 iana
  6. Allocate compute via slurm and connect to it. *this step may be skipped if your notebook is not computationally intensive. *make sure your account is part of the FACET repo or use ad:beamphysics if you are a part of that repo (more info). You can change the parameter after -n  to choose how many cores you want the notebook to have and change the time too.


     srun --partition milano --account FACET -n 100 --time=01:00:00 --pty /bin/bash
     
  7. Activate conda env: If conda is not installed see instructions here

    conda activate <CONDA ENV>
  8. ** do only first time ** install jupyter lab if not installed: 

    conda install jupyterlab
  9. Run jupyter and click on the link localhost url to open in your browser:
 jupyter lab --no-browser --port 5555 


You can also use mamba instead of conda for a faster time creating environments. Mamba is used by first installing miniconda and then using the mamba command instead of the conda command.

  • No labels

1 Comment

  1. Allocate compute via slurm and connect to it. *this step may be skipped if your notebook is not computationally intensive. *make sure your account is part of the FACET repo or use ad:beamphysics if you are a part of that repo (more info). You can change the parameter after -n to choose how many cores you want the notebook to have and change the time too.
    fix - port not tunneled after srun