How to use Python on Seawulf

Audience: Faculty, Researchers and Staff

This KB Article References: High Performance Computing
This Information is Intended for: Faculty, Researchers, Staff
Last Updated: December 13, 2023
Average Rating: Not Rated
Your feedback is important to us, help us by logging in to rate this article and provide feedback.

Current Version

Three versions of python are currently available on Seawulf: a standard distribution of python 2.7, along with python 2, and python 3 managed through Anaconda. 

Anaconda2 and Anaconda3 are installed on Seawulf. If your script requires python 2, run:

module load anaconda/2

If your script requires python 3 and does not use MPI, run:

module load anaconda/3

 

To ensure that you are executing the correct version, type which python to confirm that Anaconda2 or 3 is loaded:

which python

/gpfs/software/Anaconda2/bin/python

You can also confirm that you are running the correct python version by typing python --version.


MPI with Python

Anaconda2 and Anaconda3 are used to manage packages.   These versions come with many commonly used scientific computing libraries.

For multi-node programming in Python, mpi4py is installed.  A python script must interface with this package to run across nodes.  Example scripts can be found here, and in our examples folder:

/gpfs/projects/samples/python

To launch a Python  job using Slurm that requires python 2, load the following modules:

module load slurm
module load anaconda/2 
module load mvapich2/gcc/64/2.2rc1

If your Python job requires python 3, load the following modules:

module load slurm
module load mpi4py/3.0.3
module load mvapich2/gcc/64/2.2rc1

To run your script, use mpirun:

mpirun python my_script.py

 

Submit a ticket

Additional Information


There are no additional resources available for this article.

Provide Feedback


Your feedback is important to us, help us by logging in to rate this article and provide feedback.

Sign in with NetID

Getting Help


The Division of Information Technology provides support on all of our services. If you require assistance please submit a support ticket through the IT Service Management system.

Submit A Quick Ticket