Python is a high level programming language that aims to combine remarkable power with very clear syntax. The Enthought Python Distribution is a cross-platform environment for scientific computing in Python, and includes the Canopy IDE and package manager. MSI has installed an academic licensed version that includes hundreds of modules, including tools that enable efficient parallel computations.
To run this software interactively in a Linux environment run the commands:
module load python-epd ipython
This opens the IPython interpreter and allows interactive execution of Python commands. Instead of IPython, you can open the Canopy graphical development environment by typing the command
Loading the module python-epd makes the Enthought python installation your default python for all python-related commands.
If you would like to run a script, myscript.py, use the following command
module load python-epd python myscript.py
Programs can be submitted to a queue using PBS script such as the one below.
#PBS -l nodes=1:ppn=1,mem=1gb,walltime=4:00:00 #PBS -m abe cd /location/of/the/script module load python-epd python myscript.py
MSI has installed the MPI module mpi4y, which allows large parallel computations using MPI. A program using mpi4py to run on ten nodes with 8 cores per node would be submitted to a queue using PBS script such as this:
#PBS -l nodes=10:ppn=8,pmem=1gb,walltime=4:00:00 #PBS -m abe cd /location/of/the/script module load python-epd mpirun python mpi_program.py
Note that this installation is linked against the Intel Math Kernel Library, so many math operations using NumPy or SciPy will be automatically parallelized to use all available CPU cores on the machine.
Enthought python makes use of virtual environments, a technology that enables the creation of multiple, lightweight, independent Python environments. Using a command like
module load python-epd venv -s ~/mypython
will create a virtual environment that inherits all the capabilities of the main Canopy installation in your home directory, where you can modify it or build your own python modules. The command
would then make this local python directory your default in that terminal until you log out or type the command deactivate. With a virtual environment activated, you can easily install new python modules. In many cases, simply using the pip packages manager like so:
pip install newpackage
is all that is needed.