Your first Python job
About this tutorial
This tutorial will guide you through running a job with Python on ALICE.
What you will learn?
Setting up the batch script for a simple serial and parallel Python job
Loading the necessary modules
Installing your own or special Python modules
Submitting your job
Monitoring your job
Collect information about your job
What this example will not cover?
Running advanced parallel Python jobs
Optimize Python jobs for HPC
Using Jupyter notebook
Using Conda or Miniconda. For general instructions on conda see: Installing Python packages | Conda, Anaconda, Miniconda and Bioconda
What you should know before starting?
Basic Python. This tutorial is not intended as a tutorial on Python. If you are completely new to Python, we recommend that you go through a generic Python tutorial first. There are many great ones out there.
Basic knowledge of how to use a Linux OS from the command line.
How to connect to ALICE or SHARK: How to login to ALICE or SHARK
How to move files to and from ALICE or SHARK: Transferring Data
How to setup a simple batch job as shown in Your first bash job
- 1 About this tutorial
- 2 Python on ALICE and SHARK
- 3 Preparations
- 4 A serial Python job
- 4.1 Preparations
- 4.1.1 The Python script
- 4.1.2 The Slurm batch file
- 4.2 Job submission
- 4.3 Job output
- 4.1 Preparations
- 5 A parallel Python job
- 5.1 Preparations
- 5.1.1 Parallel Python script
- 5.1.2 Slurm batch file
- 5.2 Job submission
- 5.3 Job output
- 5.1 Preparations
Python on ALICE and SHARK
There are different versions of Python available on ALICE and SHARK. Some have also been build with CUDA support. You can choose whatever version is available and suitable for you.
Python is also always available by default from the operating system. Do not use this version of Python for your jobs. Always make use of a module.
ALICE
You can find a list of available versions with
module -r avail '^Python/'
Choose a module and add it to your environment by loading it, e.g.,:
module load Python/3.11.5-GCCcore-13.2.0
The command python --version
returns the version of Python you have loaded:
[me@nodelogin01 ~]$ python --version
Python 3.11.5
The command which Python
returns the location where the Python exe