1 / 10

A PyTrilinos Overview for Developers

A PyTrilinos Overview for Developers. Bill Spotz Trilinos Users Group Meeting November 4, 2004. Outline. Quick PyTrilinos demo Wrapping code for python SWIG (Simple Wrapper Interface Generator) Interface files Compiling wrapped code Python distutils module setup.py scripts

harry
Download Presentation

A PyTrilinos Overview for Developers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A PyTrilinos Overview for Developers Bill Spotz Trilinos Users Group Meeting November 4, 2004

  2. Outline • Quick PyTrilinos demo • Wrapping code for python • SWIG (Simple Wrapper Interface Generator) • Interface files • Compiling wrapped code • Python distutils module • setup.py scripts • Integration into Trilinos repository • Current structure • Alternative structure • Unit test example • PyTrilinos Issues

  3. Quick PyTrilinos Demo

  4. Simple Wrapper Interface Generator Source languages: C C++ Target languages: chicken csharp guile java mzscheme ocaml perl php python ruby sexp tcl xml Generate code using target language API that converts arguments calls function (method) converts return arguments Wrapping Code for Python: SWIG

  5. Wrapping Code for Python: SWIG • SWIG directives in interface file • %{ … %}insert source code • %ignoreignore code • %renamerename function, class, etc. • %typemapdefine argument conversions • %includewrap functions, etc., in header file • %extendnew methods for a class • Command-line invocation: • swig -I../include -python -c++ interface.i • Produces • interface_wrap.cxx • interface.py

  6. Compiling Wrapped Code • Need to compile interface_wrap.cxx and link to compiled source code to produce dynamic library or shared object compatible with python. • Python distutils module to the rescue: knows how python was compiled on current platform and how new modules need to be compiled. • By convention, setup.py script • import distutils • Extension class • setup() function • Commands: • python setup.py build • python setup.py install • etc.

  7. Integration into Trilinos Repository Trilinos config doc packages testharness epetra epetraext nox PyTrilinos Makefile.am configure.ac setup.py src NOX Epetra.i EpetraExt.i Abstract.i Epetra.i Parameter.i Solver.i StatusTest.i

  8. Alternative (Proposed) Structure Trilinos config doc packages testharness epetra epetraext nox Makefile.am configure.ac python src test Makefile.am setup.py Epetra.i

  9. Unit Test Example

  10. PyTrilinos Issues • Dependencies • Currently serial only . . . • Python • Numeric • SWIG (1.3.19 - 1.3.21 . . . not 1.3.22) • SWIG issues • Could make *_wrap.cxx files part of distribution . . . • Currently relies on installed runtime libraries (which are deprecated in 1.3.22) • Could compile runtime library locally . . . libtool • Plans • Eliminate SWIG dependency • Make structure decision • Add MPI • Add more Trilinos packages…

More Related