PyTrilinos Logo

Welcome to the PyTrilinos home

PyTrilinos is a set of python wrappers for selected Trilinos packages. This allows a python programmer to dynamically import Trilinos packages into a python script or the python command-line interpreter, allowing the creation and manipulation of Trilinos objects and the execution of Trilinos algorithms, without the need to constantly recompile.

PyTrilinos adds a level of convenience to Trilinos users; quick and dirty tests can be run immediately, unit testing can be built quickly within the python unit testing framework, object-oriented design can be explored more efficiently, and full-fledged applications can be developed using python.

PyTrilinos is intended to supplement the outstanding efforts of the community of SciPy developers by providing robust solver capabilities to the scientific python community. As such, it has a high degree of compatibility with NumPy, the n-dimensional array module that provides contiguous, homogeneous data support for all SciPy modules.

A description of the linear algebra modules of PyTrilinos can be found in the Sandia report SAND2005-3835. You may also examine various conference presentations of PyTrilinos:

General questions can be directed to the PyTrilinos users mailing list.

If you use PyTrilinos for your applications, please let us know by writing an e-mail to the PyTrilinos developers. Please also cite PyTrilinos using the following bibtex entry:

  author      = {M. Sala and W. Spotz and M. Heroux},
  title       = {{PyTrilinos}: High-Performance
                 Distributed-Memory Solvers for {Python}},
  journal     = {ACM Transactions on Mathematical Software (TOMS)},
  year        = {2008},
  month       = {March},
  volume      = {34},
  issue       = {2};


Description. PyTrilinos provides a python interface to several of the most popular Trilinos packages. The following packages are supported:

  • Teuchos
  • Thyra (currently disabled)
  • Epetra
  • TriUtils
  • EpetraExt
  • Pliris
  • AztecOO
  • Galeri
  • Amesos
  • Komplex
  • Anasazi
  • ML
  • NOX
  • LOCA (currently disabled)

External Compatibility. PyTrilinos provides python access to highly robust, sparse and dense, serial and parallel, linear, nonlinear and eigen solver packages. As such, it is a complementary package to SciPy, a collection of python interfaces to scientific open-source software. SciPy works on multidimensional arrays of strided, homogeneous data. This data is provided by the numpy module. PyTrilinos has been designed for extensive compatibility with numpy.

This compatibility comes in two forms. The first form is that many Trilinos C++ methods accept or return pointers to arrays of data. The corresponding PyTrilinos python methods accept or return numpy arrays, or for input arguments, python sequences that can be converted to numpy arrays. The second form of compatibility is that certain Epetra classes, namely

  • Epetra.IntVector
  • Epetra.MultiVector
  • Epetra.Vector
  • Epetra.FEVector
  • Epetra.IntSerialDenseMatrix
  • Epetra.IntSerialDenseVector
  • Epetra.SerialDenseMatrix
  • Epetra.SerialDenseVector

represent contiguous, homogeneous arrays of data, and as such overlap in functionality with numpy arrays. These classes are therefore redesigned in python such that they also inherit essentially from the numpy.ndarray class, meaning that other scientific software will recognize them as numpy arrays.

Parallelism. PyTrilinos also supports MPI parallelism. If Trilinos is built with MPI support enabled, PyTrilinos will support MPI as well. Most of the Trilinos parallelism support is encapsulated in the Epetra_Comm class and its derivatives, which means PyTrilinos parallelism is encapsulated in the Epetra.Comm class and its derivatives. When the Epetra or Teuchos module is imported, it automatically calls MPI_Init() and registers MPI_Finalize() with the python atexit module. Scripts can be executed using a standard python interpreter, called via the standard mpirun command (or equivalent).