Вы находитесь на странице: 1из 32

TAU-Python

Gunnar Einarsson, DLR Braunschweig


Institute of Aerodynamics and Flow Technology

Slide 1 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Outline
¾ What is TAU-Python?

¾ Why use TAU-Python?

¾ TAU-Python Implementation

¾ TAU-Python Compilation

¾ TAU-Python and FlowSimulator

¾ TAU-Python: Examples

¾ Summary

Slide 2 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
What is TAU-Python?

TAU-Python:
a term meaning the use of the TAU-Code within a Python
environment
Interfaces for all common TAU modules are available as a library of
functions within Python
Control of a simulation workflow is achieved with a Python script
TAU-Python contains all of the capabilities of the stand-alone TAU-
Code, and has many ‘nice-to-have’ features which are exclusive to
TAU-Python

Slide 3 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Outline
¾ What is TAU-Python?

¾ Why use TAU-Python?

¾ TAU-Python Implementation

¾ TAU-Python Compilation

¾ TAU-Python and FlowSimulator

¾ TAU-Python: Examples

¾ Summary

Slide 4 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Why use TAU-Python?

More flexibility available than when using stand-alone modules


(even with some clever shell-script usage)
Users can create scripts that run within the TAU-Python script
bring their own controls/parameters into the simulation
Can be used to simplify data-file management on Cluster
architectures
Full capability of Python itself is of course available when using
TAU-Python
Relatively straightforward to communicate with external programs
File exchange
Socket communication
File IO is reduced or non-existent during a simulation workflow

Slide 5 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Why use TAU-Python?
Basic Workflow Example

TAU Stand-Alone TAU-Python

Input: para-file Preprocessing Input: para-file


script-file TAU-Python

Preprocessing
DualGrid Files
Solver

Solver

Solution Files Solution Files

Slide 6 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Outline
¾ What is TAU-Python?

¾ Why use TAU-Python?

¾ TAU-Python Implementation

¾ TAU-Python Compilation

¾ TAU-Python and FlowSimulator

¾ TAU-Python: Examples

¾ Summary

Slide 7 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
TAU-Python Implementation

TAU-Python is created by wrapping specific driver functions using


the Simplified Wrapper Interface Generator (SWIG)
The driver functions in the C source-code are used to hide the
internal data-transfers from the Python interface
Practically no knowledge of how TAU works internally is
needed in order to write a functional TAU-Python script

Slide 8 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
TAU-Python Implementation
Driver-Function Example

TAU header-file TAU source-file

int tau_solver_init_prims(void)
int tau_solver_init_prims(void);
{
TauDualGrid *gridlist = get_dualgrid_pointer();
TauPrimVar *p = get_primvar_level(0);
.
.
}

TAU-Python interface-file

%module tau_python
.
.
extern int tau_solver_init_prims(void);

Slide 9 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
TAU-Python Implementation Python
Schematic interface for
script-based
workflow
t=T

Direct data-access in memory


Preprocessor

Solver

Parallel Adaptation
Data Management:
- Primary Grid Deformation
- Solution
(re)-Partitioning

Data Extraction

Driver / Access functions

t = T + dt

Slide 10 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
TAU-Python Implementation: User Scripts

In order to use TAU-Python, the user has to create a Python script


that tells TAU-Python which modules are to be used
The interface for the most common modules (Preprocessor, Solver,
Adaptation) has been simplified by the use of Python classes
A simple script to launch the preprocessor and then the solver may
look like this:

import PyPrep
import PySolv
Prep = PyPrep.Preprocessor(para_path)
Solver = PySolv.Solver(para_path)
Prep.run()
Solver.run()
tau(“exit”)

Slide 11 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
TAU-Python Implementation: User Scripts

The best way to figure out how to build your own TAU-Python script
is to use the example scripts that come with the Code:
The scripts show how to use the more common features of
TAU-Python to achieve results for standard simulation
scenarios in an elegant way
Preprocessing and Solver without Dualgrid File-IO
Polar calculations with multiple parameters
Adaptation loops / Deformation loops
Due to the flexibility of TAU-Python it is nearly impossible to cover
all of the possible variations with the example scripts
Direct manipulation in Python of TAU internal flow variables:
IS NOT SUPPORTED!

Slide 12 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Outline
¾ What is TAU-Python?

¾ Why use TAU-Python?

¾ TAU-Python Implementation

¾ TAU-Python Compilation

¾ TAU-Python and FlowSimulator

¾ TAU-Python: Examples

¾ Summary

Slide 13 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Compiling TAU-Python: Required Software

Python 2.4 or newer


The Python development version has to be installed
On Clusters the installation must be available on all Nodes
SWIG (Simplified Wrapper Interface Generator) version 1.3.31 or
newer
Should be configured to use the appropriate Python
installation
NetCDF
Compiled using the –fPIC flag
For Large-File support (>2 GB) version 3.6.2 or newer is
preferred (is 1st version to support shared-object library)
MPICH or OpenMPI
Current version of the TAU-Code

Slide 14 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Compiling TAU-Python: Clusters with Infiniband

The CASE, GAUSS and Enigma Clusters all have Infiniband


interconnections
The Python installation has to be compiled such that it is linked with
the Infiniband library
Example configuration commands for Python are available
(based on CASE and GAUSS Cluster implementations)
Compiling TAU-Python using the Infiniband-linked Python is
accomplished using the standard TAU-Python Makefile

Slide 15 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Compiling TAU-Python: Clusters with Myrinet

The Python installation has to be compiled such that it is linked with


the Myrinet library
Due to the proprietary nature of Myrinet I have not been able
to dynamically link the Python installation with the Myrinet
library
Solution:
Compile a local, static version of Python which includes
TAU-Python as an integrated Module of Python itself
Requires a specific Makefile for TAU-Python and
manipulation of Python source-files and library

Slide 16 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Outline
¾ What is TAU-Python?

¾ Why use TAU-Python?

¾ TAU-Python Implementation

¾ TAU-Python Compilation

¾ TAU-Python and FlowSimulator

¾ TAU-Python: Examples

¾ Summary

Slide 17 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
TAU-Python and FlowSimulator

FlowSimulator is envisioned as the central simulation environment


for future aerodynamic design simulations at Airbus
The backbone of the FlowSimulator is the fully parallel Data
Manager (FSDM)
All modules which are made available within the FlowSimulator
environment read and write data from / to the FSDM
The TAU-Code interfaces with the FSDM through the TAU-Python
interface

Slide 18 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
TAU-Python and FlowSimulator
Python steering script

TAU Python layer


FlowSimulator Interface
FSDM FSDM TAU-PY TAU-DM
Python layer interface data TAU
Python data manager modules
convert interface for
(to/from) arbitrary data
storage in
arbitrary
Implemen dictionaries
dictionaries datasets
tation module
specialized to
FSDM generic generic specific
data structs

TAU internal data transfer


data transfer between TAU & FSDM

Slide 19 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Outline
¾ What is TAU-Python?

¾ Why use TAU-Python?

¾ TAU-Python Implementation

¾ TAU-Python Compilation

¾ TAU-Python and FlowSimulator

¾ TAU-Python: Examples

¾ Summary

Slide 20 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Multi-Disciplinary Simulations with TAU-Python

Coupling TAU-Python to simulation tools of other disciplines can be


relatively straight-forward
TAU-Python has access to the network / socket modules of
Python
Simple control commands can be sent back and forth
between modules which:
Do not share memory-space
Are located on different hardware
Are running on different architectures
File-transfer of large binary-data files is accomplished using
the local operating-system protocols

Slide 21 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Multi-Disciplinary Simulations with TAU-Python
PC
Workstation Filename

CM

FM Filename
Angles / Rates TAU-Python
Forces / Moments
PC
Workstation PC
Cluster

PC
CSM
Workstation
File IO

CSM
FM – –TAU
TAUCoupling:
Coupling: Classic
Classic Staggered with Sub-Cycling
File IO, Filename
No File SentOver
IO, Data Sent OverSocket-Connection
Socket-Connection

Slide 22 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Multi-Disciplinary Simulations with TAU-Python:
Trim Simulation
Create an initial solution for which trimming should be done
Write a short Python-class to handle the trim-sensor / resulting flap
deflection
Create TAU-Python script that uses the Trim-class functions
Begin Trim Loop
Get integrated forces and moments from Solver, send to Trim-class
Trim-class calculates pitch-acceleration, determines direction
of flap deflection to reach a Pitch-Moment equilibrium
(My = 0 Nm)
Trim-class sends resulting motion-string back to TAU-Python
script
Update Motion-Library with new flap-deflection
Run Solver with new configuration

Slide 23 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Slide 24 > TAU-Python > G. Einarsson
TAU-Python.ppt > 25.04.2007
Slide 25 > TAU-Python > G. Einarsson
TAU-Python.ppt > 25.04.2007
TAU-Python Feature:
Visualization of Bad Grid-Elements

Good practice:
Before starting a simulation on a configuration for which a new grid has
been created
Have the code that will actually do the simulation identify any areas
which might be problematic
Obtain a visual representation of the problematic areas, in relation
to the surface of the configuration
Decide whether the identified areas are critical to the simulation
and need to be corrected, or not

Slide 26 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
TAU-Python Feature:
Visualization of Bad Grid-Elements
Plt = PyPlt.Pltutil(para_path,\
exclude_treatment=exclude_treatment,\
variables=variables,\
format=plot_format
)

### write out bad elements & visualize surfaces by bar-lines


############################################################
Plt.extract_bad_elements()
Plt.extract_surface_bar_curves()
Plt.plot_output('tauplt')

tau("exit")

Slide 27 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Geometry surface curves
Slide 28 > TAU-Python > G. Einarsson
TAU-Python.ppt > 25.04.2007
Elements with bad angles ( Inner angle < 3o )
Slide 29 > TAU-Python > G. Einarsson
TAU-Python.ppt > 25.04.2007
Elements with bad volumes ( Vol. < 8 x Neighbour Vol.)
Slide 30 > TAU-Python > G. Einarsson
TAU-Python.ppt > 25.04.2007
Outline
¾ What is TAU-Python?

¾ Why use TAU-Python?

¾ TAU-Python Implementation

¾ TAU-Python Compilation

¾ TAU-Python and FlowSimulator

¾ TAU-Python: Examples

¾ Summary

Slide 31 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007
Summary

TAU-Python enhances the capabilities of the TAU Simulation Suite


in several ways:
Allows the user to build fairly complex Workflows using a
straight-forward interface
Reduces or eliminates File-IO during the simulation
Æ More productive use of CPU-time on Clusters
Many “Nice-to-Have” features available with TAU-Python,
which are not possible with the stand-alone modules
Multi-Disciplinary simulations become much more
manageable:
Control logic through socket-communications
Simplified file management on massively parallel
architectures

Slide 32 > TAU-Python > G. Einarsson


TAU-Python.ppt > 25.04.2007

Вам также может понравиться