Using PyTrilinos: A Tutorial - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Using PyTrilinos: A Tutorial

Description:

import sys. sys.path.append('PREFIX/lib/python2.4/site-packages' ... from PyTrilinos import Teuchos pList = Teuchos.ParameterList() pList.set('one', 1) ... – PowerPoint PPT presentation

Number of Views:55
Avg rating:3.0/5.0
Slides: 9
Provided by: willia193
Category:

less

Transcript and Presenter's Notes

Title: Using PyTrilinos: A Tutorial


1
Using PyTrilinosA Tutorial
  • Bill Spotz
  • Sandia National Laboratories
  • 2006 Trilinos Users Group Meeting
  • Nov 8, 2006

2
Outline
  • Building PyTrilinos (Teuchos Epetra only)
  • Installing PyTrilinos
  • Getting help for PyTrilinos
  • An interactive exploration of Epetra
  • Parameter lists
  • Writing scripts to solve problems

3
Building PyTrilinos
  • Configure script
  • Take a working configure script, and just add
  • --enable-python
  • For our purposes, restrict to Teuchos and Epetra
  • --disable-default-packages \
  • --enable-teuchos \
  • --enable-epetra
  • You may need to be explicit about the C
    compiler
  • CXXg
  • Think about where you want to install
  • --prefixPREFIX
  • Building
  • Invoking configure and make should do the trick

4
Installing PyTrilinos
  • Install command
  • sudo make install
  • If no prefix specified, then PyTrilinos is
    installed where your python knows to find it
  • If you specified prefix, then you need to tell
    python how to find the PyTrilinos package
  • Environment variables
  • LD_LIBRARY_PATHPREFIX/lib
  • PYTHONPATHPREFIX/lib/python2.4/site-packages
  • Within python (e.g. .pythonrc)
  • import sys
  • sys.path.append("PREFIX/lib/python2.4/site-package
    s")
  • Try it
  • python
  • gtgtgt from PyTrilinos import Epetra

5
Getting Help
  • From shell
  • pydoc PyTrilinos
  • From python
  • python
  • gtgtgt from PyTrilinos import Epetra
  • gtgtgt help(Epetra)
  • gtgtgt dir(Epetra)
  • From web site
  • FAQ
  • Overview
  • Release 7.0 (including tutorial)
  • Development (including tutorial)
  • Trilinos doxygen pages
  • Submitting bugs
  • Under bugzilla, submit to the appropriate
    Trilinos package, specifying the Python
    wrappers component

6
Exploring Epetra Interactively
  • Communicators
  • Printing Epetra objects
  • Maps
  • C-arrays as return objects
  • Vectors
  • NumPy hybrids
  • MultiVectors
  • CrsMatrix objects

7
Parameter Lists
  • Old school
  • gtgtgt from PyTrilinos import Teuchos
  • gtgtgt pList Teuchos.ParameterList()
  • gtgtgt pList.set("one", 1)
  • gtgtgt . . .
  • Python dictionaries can be used in place of
    ParameterLists
  • Keys must be strings
  • Values must be bool, int, float, str, or dict (or
    ParameterList)
  • gtgtgt pList "one" 1, "two" 2
  • Returned ParameterLists are actually
    PyDictParameterLists

8
Writing Scripts
  • Feel free to tackle your own problem
  • Write a function that returns your favorite
    Epetra.CrsMatrix
  • Suggestion Power method (see software.sandia.gov/
    Trilinos/packages/docs/dev/ packages/epetra/doc/h
    tml/ index.html)
  • Alternatively CG algorithm (from GvL)
Write a Comment
User Comments (0)
About PowerShow.com