A PyTrilinos Overview for Developers - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

A PyTrilinos Overview for Developers

Description:

include wrap functions, etc., in header file %extend new methods for a class ... Currently relies on installed runtime libraries (which are deprecated in 1.3.22) ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 11
Provided by: willia193
Category:

less

Transcript and Presenter's Notes

Title: A PyTrilinos Overview for Developers


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
Wrapping Code for Python SWIG
  • 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

5
Wrapping Code for Python SWIG
  • SWIG directives in interface file
  • insert source code
  • ignore ignore code
  • rename rename function, class, etc.
  • typemap define argument conversions
  • include wrap functions, etc., in header file
  • extend new 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
Epetra.i
EpetraExt.i
NOX
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
setup.py
Makefile.am
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
Write a Comment
User Comments (0)
About PowerShow.com