Jupyter
Foldspace provides access to Jupyter, using the Jupyter Lab interface.
Start the tool
You can access it via:
the
--tool jupyter-latestoption on Leonardo and Pitagora:
foldspace --user <your username> --cluster <cluster name> --tool jupyter-latest [any slurm directive you like]
the
--tool jupyter-iacoption on Galileo100:
foldspace --user <your username> --cluster g100 --tool jupyter-iac [any slurm directive you like]
After the command is executed, a Slurm job is submitted and Jupyter starts on the allocated node. Foldspace will then display a URL to be opened in your browser.
Here it follows some examples of the possible combinations you might want to use:
Start Jupyter on the Leonardo serial partition (default), with a single task (default) for up to 30 minutes (default):
foldspace --user <your username> --cluster leonardo --tool jupyter-latest
Start Jupyter on the Leonardo Booster partition using 8 tasks and a single GPU for up to 120 minutes:
foldspace --user <your username> --cluster leonardo --tool jupyter-latest --partition boost_usr_prod --ntasks 8 --gres gpu:1 --time 02:00:00
Start Jupyter on the Galileo100 prod partition using a full node in exclusive mode for up to 4 hours:
foldspace --user <your username> --cluster g100 --tool jupyter-iac --partition g100_usr_prod --exclusive --ntasks 32 --time 04:00:00
Note
The jupyter-latest tool undergoes rolling updates approximately every 45-60 days.
These updates apply to all bundled software, including Python environments, CUDA versions, and the Jupyter release; consequently, please ensure your code remains compatible with the latest versions of the core software. A jupyter-stable tool will be released in the future to make backward compatibility easier to mantain.
Warning
The Jupyter tool, provided by Foldspace, runs in a container. Consequently, some Linux system paths may differ from those encountered via SSH or through non-containerized tools such as Code Server. While this is generally transparent during standard operations, issues may arise when linking dependencies for code compiled outside the container. If your pre-compiled code fails to run within Jupyter, we recommend recompiling it directly from the Jupyter terminal, building a separate installation to be used in Jupyter. Please note that on Pitagora containers are not allowed on the serial partition, thus Pitagora users may want to always specify the --partition option.
Default environments
The following content is provided by default in the Jupyter tools (click to expand):
User custom Python environments
You can create your own customized Python environment and display them in the Jupyter launcher. In the Jupyter container some scripts are provided to build your own environments, either via Python environments or via Conda (relying on Miniforge).
Tip
Nodes in the serial partition have external internet access, enabling you to create custom environments using pip or conda. You won’t be able to use pip install or conda install using a different value in the --partition option. The serial partition is always the default, thus you can simply omit the --partition option when you need to deploy a new custom environment in your Jupyter interface. Once you have created your environments from the serial partition, you can use them from any other partition as well.
Note
On Pitagora, containers are not allowed on the serial partition, thus this section does not apply for Pitagora users.
You can proceed as follows:
open a terminal from your launcher and move in a path where you want to build your environment (a build subdirectory will be created in it)
Warning
Be careful to run the following commands from the terminal in the launcher, i.e. clicking on Terminal in the Jupyter web interface) and not via ssh, where they would fail.
copy the following directory in your current path; you can rename it as you wish (myenv in the following example):
cp -r /opt/venvs/template ./myenv
Tip
In the same
/opt/venvsdirectory you can also find the building directories of the default environments, in case you want to replicate them with your own customizations.move inside the directory:
cd ./myenv
You will find a config file: edit it with your favourite text editor, replacing its values with your own:
env_name
the name of the virtual environment to be created (single word)
display_name
the name of the kernel displayed in the Jupyter interface ( can contain whitespaces)
logo_svg
an svg file for the logo (can be left to the default “python.svg”)
requirements_file_list
a list of txt requirements file containing the list of packages to be installed (check the Pip documentation for details)
module_list
an (optional) list of modules to be loaded from the cluster module environment, both when using the Jupyter kernel and during the installation
edit the content of requirements.txt (or add in the myenv directory any requirements file you listed in the
requirements_file_listparameter inside config), to select the Python packages you want to install via piprun the following command:
./env.sh installThis will create a build subdirectory inside myenv, with the virtual environment related to your configuration
refresh the browser page, to show your custom environment in your Jupyter Launcher and in your kernels list;
Note
In case you will need to change the content of the environment in the future, you can change the configuration files mentioned above in myenv and then run:
./env.sh reinstallIn case you will need to delete the environment and the related kernel from the Jupyter interface you can run the following:
./env.sh remove
open a terminal from your launcher and move in a path where you want to build your environment (a build subdirectory will be created in it)
Warning
Be careful to run the following commands from the terminal in the launcher, i.e. clicking on Terminal in the Jupyter web interface) and not via ssh, where they would fail.
copy the following directory in your current path; you can rename it as you wish (myenv in the following example):
cp -r /opt/conda_envs/template ./myenv
move inside the directory:
cd ./myenv
You will find a config file: edit it with your favourite text editor, replacing its values with your own:
env_name
the name of the virtual environment to be created (single word)
display_name
the name of the kernel displayed in the Jupyter interface ( can contain whitespaces)
logo_svg
an svg file for the logo (can be left to the default “forge.svg”)
environment_file
a yaml file containing the list of packages to be installed (check the Anaconda documentation for details)
module_list
an (optional) list of modules to be loaded from the cluster module environment, both when using the Jupyter kernel and during the installation
edit the content of environment,yml (or any other yaml file you specified in the
environment_fileparameter above)run the following command:
./env.sh installThis will create a build subdirectory inside myenv, with the virtual environment related to your configuration
refresh the browser page, to show your custom environment in your Jupyter Launcher and in your kernels list;
Note
In case you will need to change the content of the environment in the future, you can change the configuration files mentioned above in myenv and then run:
./env.sh reinstallIn case you will need to delete the environment and the related kernel from the Jupyter interface you can run the following:
./env.sh remove
Monitoring tools
On the (very) left side of your dashboard there is a vertical menu, which allows the user to access some additional functions. From GPU Dashboards you can monitor the resources usage of your job in real-time, either running on GPUs or only on CPUs. In particular:
in the “Machine Resources” section, you can monitor CPUs and memory utilization, and network and I/O bandwidth;
if you requested GPUs in the initial job submission, you would see several additional menu to monitor, for example, GPUs utilization, memory bandwidth and occupation, PCIe and NVLink throughput.
Access to WORK and SCRATCH areas
In the left column of the principal page, you can see the content of your $HOME area on the cluster.
Your $WORK and $SCRATCH areas are not visible from your default Jupyter interface. To make them visible and reachable, you need to create a symbolic link in your $HOME directory pointing those areas. In the following example, you create a link to the $SCRATCH area and a link to the $WORK area inside your $HOME directory by launching the following commands in a terminal on the cluster:
ln -s $SCRATCH $HOME/scratch
ln -s $WORK $HOME/work
Thus now you can see a work and a scratch icons in the file manager on the left side of our interface, and you can access them.
Note
It is strongly suggested to create such links to make all the storage available to the Jupyter sessions (and not just the $HOME storage). Please remember that the $WORK variable refers to the work area of your current default account, so you may want to create different links for different accounts and keep them updated over time.
Tip
You can pin scratch and work (or any other path) on top of your Jupyter file browser on the left, by right-clicking them and then choosing “Add Favorite”.