Sage from SageMath

Sage is supplied from https://www.sagemath.org/. There are no direct support at LRZ, or guaranties that this software works without issues. Still, users can try to employ it, but must install it by themselves.

The following procedure might be successful.

Setup Conda Framework

Login to the LRZ via SSH.

lrz> module load anaconda3    # will setup the conda framework (please check for other module names)
lrz> conda init bash
lrz> source .bashrc           # or, place the conda initialization section into a separate file, and source it when needed

This needs to be done just once. Afterwards, it suffices to just re-login. The conda framework is then already loaded.

Installation of Sage

(base) lrz> conda create -n sage sage python=3.9

This creates a conda environment sage, and installs the sage package (together with its dependencies). This might take quite a while. Please, be patient!

Possibly, if this fails, you must first add the conda-forge channel.

On SuperMUC-NG, downloads must be redirected through SSH reverse tunnels and a http proxy (described elsewhere in the LRZ documentation), or accomplished via offline repositories copied to the SuperMUC-NG location.

Usage of Sage

At its simplest, just activate the conda environment, and start sage.

(base) lrz> conda activate sage
(sage) lrz> sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.4, Release Date: 2021-08-22                     │
│ Using Python 3.9.7. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
sage:

If you wish to start sage in a jupyter notebook, all terms and conditions hold as for all usage of jupyter on our system (please consult jupyter documentation). Either use SSH forward tunnels, or VNC. Sage is started with jupyter as follows.

(sage) lrz> sage -n jupyter
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.4, Release Date: 2021-08-22                     │
│ Using Python 3.9.7. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...
[I 15:43:14.697 NotebookApp] The port 8888 is already in use, trying another port.
[I 15:43:14.697 NotebookApp] Serving notebooks from local directory: /dss/dsshome1/00/di49zop
[I 15:43:14.697 NotebookApp] Jupyter Notebook 6.4.4 is running at:
[I 15:43:14.697 NotebookApp] http://localhost:8889/?token=7bdd31560f55a6bf801b20b221d307956c473dff7c178716
[I 15:43:14.697 NotebookApp]  or http://127.0.0.1:8889/?token=7bdd31560f55a6bf801b20b221d307956c473dff7c178716
[I 15:43:14.697 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 15:43:14.703 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///dss/dsshome1/00/di49zop/.local/share/jupyter/runtime/nbserver-15579-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/?token=7bdd31560f55a6bf801b20b221d307956c473dff7c178716
     or http://127.0.0.1:8889/?token=7bdd31560f55a6bf801b20b221d307956c473dff7c178716

As jupyter opens the w3m browser. Just close it via pressing "q" then "y". To stop the notebook, issue Ctrl+C, as usual.

General Considerations on LRZ HPC systems

In principle, setting a conda environment and starting sage should also work on compute nodes. Please, don't use the login nodes for intensive workloads or memory consuming tasks. Please use the interactive Slurm queues via salloc, or submit batch jobs via sbatch!

Documentation, Help, and Troubleshooting

Consult first https://doc.sagemath.org/, and the sage user community when spotting problems or questions. Figure out, if the issues are due to sage itself. Only if this can be excluded, and LRZ system issues might cause the observed trouble, please contact the LRZ ServiceDesk.