TAU - Tuning and Analysis Utilities -

Tuning and Analysis Utilities

TAU

PRL

6.5. Q. How do I instrument Python Code?

A. Create an python wrapper library.

Here to instrument python code

% setenv TAU_MAKEFILE /usr/local/packages/tau/i386_linux/lib/Makefile.tau-mpi-python-pdt
% set path=(/usr/local/packages/tau/i386_linux/bin $path)
% setenv TAU_OPTIONS '-optShared -optVerbose'
(Python needs shared object based TAU library)
% make F90=tau_f90.sh CXX=tau_cxx.sh CC=tau_cc.sh  (build pyMPI w/TAU)
% cat wrapper.py
  import tau
  def OurMain():
      import App
  tau.run('OurMain()')
Uninstrumented:
% mpirun -np 4 $PTOOLSPKGSDIR/pyMPI-2.5b0/bin/pyMPI ./App.py
Instrumented:
% setenv PYTHONPATH $TAU/bindings-python-mpi-pdt-pgi
(same options string as TAU_MAKEFILE)
setenv LD_LIBRARY_PATH $TAU/bindings-icpc-python-mpi-pdt-pgi\:$LD_LIBRARY_PATH
% mpirun -np 4 <dir>/pyMPI-2.4b4-TAU/bin/pyMPI ./wrapper.py
(Instrumented pyMPI with wrapper.py)