TAU Instrumentation API
Introduction
-
C++
The C API is a set of macros that can be inserted in the C source code. An extension of the same API is available to instrument C and Fortran sources.
At the beginning of each instrumented source file, include the following header
#include <TAU.h>
-
C
The API for instrumenting C source code is similar to the C++ API. The primary difference is that the
TAU_PROFILE()
macro is not available for identifying an entire block of code or function. Instead, routine transitions are explicitly specified usingTAU_PROFILE_TIMER()
macro withTAU_PROFILE_START()
andTAU_PROFILE_STOP()
macros to indicate the entry and exit from a routine. Note that,TAU_TYPE_STRING()
and CT() macros are not applicable for C. It is important to declare theTAU_PROFILE_TIMER()
macro after all the variables have been declared in the function and before the execution of the first C statement.Example:
#include <TAU.h> int main (int argc, char **argv) { int ret; pthread_attr_t attr; pthread_t tid; TAU_PROFILE_TIMER(tautimer,"main()", "int (int, char **)", TAU_DEFAULT); TAU_PROFILE_START(tautimer); TAU_PROFILE_INIT(argc, argv); TAU_PROFILE_SET_NODE(0); pthread_attr_init(&attr); printf("Started Main...\n"); // other statements TAU_PROFILE_STOP(tautimer); return 0; }
-
Fortran 77/90/95
The Fortran90 TAU API allows source code written in Fortran to be instrumented for TAU. This API is comprised of Fortran routines. As explained in Chapter 2, the instrumentation can be disabled in the program by using the TAU stub makefile variable
TAU_DISABLE
on the link command line. This points to a library that contains empty TAU instrumentation routines.
Timers
-
Static timers
These are commonly used in most profilers where all invocations of a routine are recorded. The name and group registration takes place when the timer is created (typically the first time a routine is entered). A given timer is started and stopped at routine entry and exit points. A user defined timer can also measure the time spent in a group of statements. Timers may be nested but they may not overlap. The performance data generated can typically answer questions such as: what is the total time spent in MPI_Send() across all invocations?
-
Dynamic timers
To record the execution of each invocation of a routine, TAU provides dynamic timers where a unique name may be constructed for a dynamic timer for each iteration by embedding the iteration count in it. It uses the start/stop calls around the code to be examined, similar to static timers. The performance data generated can typically answer questions such as: what is the time spent in the routine foo() in iterations 24, 25, and 40?
-
Static phases
An application typically goes through several phases in its execution. To track the performance of the application based on phases, TAU provides static and dynamic phase profiling. A profile based on phases highlights the context in which a routine is called. An application has a default phase within which other routines and phases are invoked. A phase based profile shows the time spent in a routine when it was in a given phase. So, if a set of instrumented routines are called directly or indirectly by a phase, we’d see the time spent in each of those routines under the given phase. Since phases may be nested, a routine may belong to only one phase. When more than one phase is active for a given routine, the closest ancestor phase of a routine along its callstack is its phase for that invocation. The performance data generated can answer questions such as: what is the total time spent in MPI_Send() when it was invoked in all invocations of the IO (IO ⇒ MPI_Send()) phase?
-
Dynamic phases
Dynamic phases borrow from dynamic timers and static phases to create performance data for all routines that are invoked in a given invocation of a phase. If we instrument a routine as a dynamic phase, creating a unique name for each of its invocations (by embedding the invocation count in the name), we can examine the time spent in all routines and child phases invoked directly or indirectly from the given phase. The performance data generated can typically answer questions such as: what is the total time spent in MPI_Send() when it was invoked directly or indirectly in iteration 24? Dynamic phases are useful for tracking per-iteration profiles for an adaptive computation where iterations may differ in their execution times.
-
Callpaths
In phase-based profiles, we see the relationship between routines and parent phases. Phase profiles do not show the calling structure between different routines as is represented in a callgraph. To do so, TAU provides callpath profiling capabilities where the time spent in a routine along an edge of a callgraph is captured. Callpath profiles present the full flat profiles of routines (or nodes in the callgraph), as well as routines along a callpath. A callpath is represented syntactically as a list of routines separated by a delimiter. The maximum depth of a callpath is controlled by an environment variable.
-
User-defined Events
Besides timers and phases that measure the time spent between a pair of start and stop calls in the code, TAU also provides support for user-defined atomic events. After an event is registered with a name, it may be triggered with a value at a given point in the source code. At the application level, we can use user-defined events to track the progress of the simulation by keeping track of application specific parameters that explain program dynamics, for example, the number of iterations required for convergence of a solver at each time step, or the number of cells in each iteration of an adaptive mesh refinement application.
TAU_START
Starts a timer.
C/C++:
TAU_START
char* name
Fortran:
TAU_START
character name(2)
Starts the timer given by name
C/C++ :
int foo(int a) { TAU_START("t1"); ... TAU_STOP("t2"); return a; }
Fortran :
subroutine F1() character(13) cvar write (cvar,'(a9,i2)') 'Iteration', val call TAU_START(cvar) ... call TAU_STOP(cvar) end
TAU_STOP
Stops a timer.
C/C++:
TAU_STOP
char* name
Fortran:
TAU_STOP
character name(2)
Stops the timer given by timer
. It is important to note that timers can be nested, but not overlapping. TAU detects programming errors that lead to such overlaps at runtime, and prints a warning message.
C/C++ :
int foo(int a) { TAU_START("t1"); ... TAU_STOP("t2"); return a; }
Fortran :
subroutine F1() character(13) cvar write (cvar,'(a9,i2)') 'Iteration', val call TAU_START(cvar) ... call TAU_STOP(cvar) end
TAU_PROFILE
Profile a C++ function
TAU_PROFILE
char* or string& function_name
char* or string& type
TauGroup_t group
TAU_PROFILE
profiles a function. This macro defines the function and takes care of the timer start and stop as well. The timer will stop when the macro goes out of scope (as in C++ destruction).
int foo(char *str) { TAU_PROFILE(foo","int (char *)",TAU_DEFAULT); ... }
TAU_DYNAMIC_PROFILE
dynamic_profile a c++ function
TAU_DYNAMIC_PROFILE
char* or string& function_name
char* or string& type
taugroup_t group
TAU_DYNAMIC_PROFILE
profiles a function dynamically creating a separate profile for each time the function is called. this macro defines the function and takes care of the timer start and stop as well. the timer will stop when the macro goes out of scope (as in c++ destruction).
int foo(char *str) { tau_dynamic_profile("foo","int (char *)",tau_default); ... }
TAU_PROFILE_CREATE_DYNAMIC
Creates a dynamic timer
C/C++:
TAU_PROFILE_CREATE_DYNAMIC
Timer timer
char* or string& function_name
char* or string& type
taugroup_t group
Fortran:
TAU_PROFILE_CREATE_DYNAMIC
integer timer(2)
character name(size)
TAU_PROFILE_CREATE_DYNAMIC
creates a dynamic timer the name of the timer should be different for each execution.
C/C++:
int main(int argc, char **argv) { int i; TAU_PROFILE_TIMER(t,"main()", "", TAU_DEFAULT); TAU_PROFILE_SET_NODE(0); TAU_PROFILE_START(t); for (i=0; i&5; i++) { char buf[32]; sprintf(buf, "Iteration %d", i); TAU_PROFILE_CREATE_DYNAMIC(timer, buf, "", TAU_USER); TAU_PROFILE_START(timer); printf("Iteration %d\n", i); f1(); TAU_PROFILE_STOP(timer); } return 0; }
Fortran:
subroutine ITERATION(val) integer val character(13) cvar integer profiler(2) / 0, 0 / save profiler print *, "Iteration ", val write (cvar,'(a9,i2)') 'Iteration', val call TAU_PROFILE_CREATE_DYNAMIC(profiler, cvar) call TAU_PROFILE_START(profiler) call F1() call TAU_PROFILE_STOP(profiler) return end
TAU_CREATE_DYNAMIC_AUTO
Creates a dynamic timer for C/C++
TAU_CREATE_DYNAMIC_AUTO
Timer timer
char* or string& function_name
char* or string& type
taugroup_t group
TAU_CREATE_DYNAMIC_AUTO
creates a dynamic timer automatically incrementing the name each time the timer is executed.
int tau_ret_val; TAU_PROFILE_CREATE_DYNAMIC_AUTO(tautimer, "int foo1(int) C [{foo.c} {22,1}-{29,1}]", " ",TAU_USER); TAU_PROFILE_START(tautimer); { printf("inside foo1: calling bar: x = %d\n", x); printf("before calling bar in foo1\n"); bar(x-1); /* 26 */ printf("after calling bar in foo1\n"); { tau_ret_val = x; TAU_PROFILE_STOP(tautimer); return (tau_ret_val); }
TAU_PROFILE_DYNAMIC_ITER
Creates a dynamic timer in Fortran.
TAU_PROFILE_DYNAMIC_ITER
integer iterator
integer timer(2)
character name(size)
TAU_PROFILE_DYNAMIC_ITER
creates a dynamic timer the name of the timer is appended by the iterator.
integer tau_iter / 0 / save tau_iter tau_iter = tau_iter + 1 call TAU_PROFILE_DYNAMIC_ITER(tau_iter, profiler, ' & &FOO1 [{foo.f90} {16,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo1: calling bar, x = ", x call bar(x-1) print *, "after calling bar" call TAU_PROFILE_STOP(profiler)
TAU_PHASE_DYNAMIC_ITER
Creates a dynamic phase in Fortran.
TAU_PHASE_DYNAMIC_ITER
integer iterator
integer timer(2)
character name(size)
TAU_PHASE_DYNAMIC_ITER
creates a dynamic phase the name of which is appended by the iterator.
integer tau_iter / 0 / save tau_iter tau_iter = tau_iter + 1 call TAU_PHASE_DYNAMIC_ITER(tau_iter, profiler, ' & &FOO1 [{foo.f90} {16,18}]') call TAU_PHASE_START(profiler) print *, "inside foo1: calling bar, x = ", x call bar(x-1) print *, "after calling bar" call TAU_PROFILE_STOP(profiler)
TAU_PROFILE_TIMER
Defines a static timer.
C/C++:
TAU_PROFILE_TIMER
Profiler timer
char* or string& function_name
char* or string& type
TauGroup_t group
Fortran:
TAU_PROFILE_TIMER
integer profiler(2)
character name(size)
C/C++ : With TAU_PROFILE_TIMER
, a group of one or more statements is profiled. This macro has a timer variable as its first argument, and then strings for name and type, as described earlier. It associates the timer to the profile group specified in the last parameter. Fortran : To profile a block of Fortran code, such as a function, subroutine, loop etc., the user must first declare a profiler, which is an integer array of two elements (pointer) with the save attribute, and pass it as the first parameter to the TAU_PROFILE_TIMER
subroutine. The second parameter must contain the name of the routine, which is enclosed in a single quote. TAU_PROFILE_TIMER
declares the profiler that must be used to profile a block of code. The profiler is used to profile the statements using TAU_PROFILE_START
and TAU_PROFILE_STOP
as explained later.
C/C++ :
template< class T, unsigned Dim > void BareField<T,Dim>::fillGuardCells(bool reallyFill) {y // profiling macros TAU_TYPE_STRING(taustr, CT(*this) + " void (bool)" ); TAU_PROFILE("BareField::fillGuardCells()", taustr, TAU_FIELD); TAU_PROFILE_TIMER(sendtimer, "fillGuardCells-send", taustr, TAU_FIELD); TAU_PROFILE_TIMER(localstimer, "fillGuardCells-locals", taustr, TAU_FIELD); ... }
Fortran :
subroutine bcast_inputs implicit none integer profiler(2) save profiler include 'mpinpb.h' include 'applu.incl' interger IERR call TAU_PROFILE_TIMER(profiler, 'bcast_inputs')
TAU_PROFILE_TIMER_DYNAMIC , TAU_PROFILE_START , TAU_PROFILE_STOP
TAU_PROFILE_START
Starts a timer.
C/C++:
TAU_PROFILE_START
Profiler timer
Fortran:
TAU_PROFILE_START
integer profiler(2)
Starts the timer given by timer
C/C++ :
int foo(int a) { TAU_PROFILE_TIMER(timer, "foo", "int (int)", TAU_USER); TAU_PROFILE_START(timer); ... TAU_PROFILE_STOP(timer); return a; }
Fortran :
subroutine F1() integer profiler(2) / 0, 0 / save profiler call TAU_PROFILE_TIMER(profiler,'f1()') call TAU_PROFILE_START(profiler) ... call TAU_PROFILE_STOP(profiler) end
TAU_PROFILE_STOP
Stops a timer.
C/C++:
TAU_PROFILE_STOP
Profiler timer
Fortran:
TAU_PROFILE_STOP
integer profiler(2)
Stops the timer given by timer
. It is important to note that timers can be nested, but not overlapping. TAU detects programming errors that lead to such overlaps at runtime, and prints a warning message.
C/C++ :
int foo(int a) { TAU_PROFILE_TIMER(timer, "foo", "int (int)", TAU_USER); TAU_PROFILE_START(timer); ... TAU_PROFILE_STOP(timer); return a; }
Fortran :
subroutine F1() integer profiler(2) / 0, 0 / save profiler call TAU_PROFILE_TIMER(profiler,'f1()') call TAU_PROFILE_START(profiler) ... call TAU_PROFILE_STOP(profiler) end
TAU_STATIC_TIMER_START
Starts a timer.
C/C++:
TAU_STATIC_TIMER_START
Profiler timer
Fortran:
TAU_STATIC_TIMER_START
integer profiler(2)
Starts a static timer defined by TAU_PROFILE .
C/C++ :
TAU_PROFILE("int foo(int) [{foo.cpp} {13,1}-{20,1}]", " ", TAU_USER); printf("inside foo: calling bar: x = %d\n", x); printf("before calling bar in foo\n"); TAU_STATIC_TIMER_START("foo_bar"); bar(x-1); /* 17 */ printf("after calling bar in foo\n"); TAU_STATIC_TIMER_STOP("foo_bar");
Fortran :
call TAU_PROFILE_TIMER(profiler, 'FOO [{foo.f90} {8,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo: calling bar, x = ", x call TAU_STATIC_TIMER_START("foo_bar"); call bar(x-1) print *, "after calling bar" call TAU_STATIC_TIMER_STOP("foo_bar"); call TAU_PROFILE_STOP(profiler)
TAU_PROFILE , TAU_STATIC_PHASE_START , TAU_STATIC_PHASE_STOP
TAU_STATIC_TIMER_STOP
Starts a timer.
C/C++:
TAU_STATIC_TIMER_STOP
Profiler timer
Fortran:
TAU_STATIC_TIMER_STOP
integer profiler(2)
Starts a static timer defined by TAU_PROFILE .
C/C++ :
TAU_PROFILE("int foo(int) [{foo.cpp} {13,1}-{20,1}]", " ", TAU_USER); printf("inside foo: calling bar: x = %d\n", x); printf("before calling bar in foo\n"); TAU_STATIC_TIMER_START("foo_bar"); bar(x-1); /* 17 */ printf("after calling bar in foo\n"); TAU_STATIC_TIMER_STOP("foo_bar");
Fortran :
call TAU_PROFILE_TIMER(profiler, 'FOO [{foo.f90} {8,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo: calling bar, x = ", x call TAU_STATIC_TIMER_START("foo_bar"); call bar(x-1) print *, "after calling bar" call TAU_STATIC_TIMER_STOP("foo_bar"); call TAU_PROFILE_STOP(profiler)
TAU_PROFILE , TAU_STATIC_PHASE_START , TAU_STATIC_PHASE_STOP
TAU_DYNAMIC_TIMER_START
Starts a dynamic timer.
C/C++:
TAU_DYNAMIC_TIMER_START
String name
Fortran:
TAU_DYNAMIC_TIMER_START
integer iteration
char name(size)
Starts a new dynamic timer concating the iterator to the end of the name.
C/C++ :
int foo(int a) { TAU_PROFILE_TIMER(timer, "foo", "int (int)", TAU_USER); TAU_DYNAMIC_TIMER_START(timer); ... TAU_PROFILE_STOP(timer); return a; }
Fortran :
integer tau_iteration / 0 / save tau_iteration call TAU_PROFILE_TIMER(profiler, 'FOO1 [{foo.f90} {16,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo1: calling bar, x = ", x tau_iteration = tau_iteration + 1 call TAU_DYNAMIC_TIMER_START(tau_iteration,"foo1_bar"); call bar(x-1) print *, "after calling bar" call TAU_DYNAMIC_TIMER_STOP(tau_iteration,"foo1_bar"); call TAU_PROFILE_STOP(profiler)
TAU_DYNAMIC_TIMER_STOP
Starts a dynamic timer.
C/C++:
TAU_DYNAMIC_TIMER_STOP
String name
Fortran:
TAU_DYNAMIC_TIMER_STOP
integer iteration
char name(size)
Stops a new dynamic timer concating the iterator to the end of the name. timer
C/C++ :
int foo(int a) { TAU_PROFILE_TIMER(timer, "foo", "int (int)", TAU_USER); TAU_DYNAMIC_TIMER_START(timer); ... TAU_PROFILE_STOP(timer); return a; }
Fortran :
integer tau_iteration / 0 / save tau_iteration call TAU_PROFILE_TIMER(profiler, 'FOO1 [{foo.f90} {16,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo1: calling bar, x = ", x tau_iteration = tau_iteration + 1 call TAU_DYNAMIC_TIMER_START(tau_iteration,"foo1_bar"); call bar(x-1) print *, "after calling bar" call TAU_DYNAMIC_TIMER_STOP(tau_iteration,"foo1_bar"); call TAU_PROFILE_STOP(profiler)
TAU_PROFILE_TIMER_DYNAMIC
Defines a dynamic timer.
C/C++:
TAU_PROFILE_TIMER_DYNAMIC
Profiler timer
char* or string& function_name
char* or string& type
TauGroup_t group
Fortran:
TAU_PROFILE_TIMER_DYNAMIC
integer profiler(2)
character name(size)
TAU_PROFILE_TIMER_DYNAMIC
operates similar to TAU_PROFILE_TIMER
except that the timer is created each time the statement is invoked. This way, the name of the timer can be different for each execution.
C/C++ :
int main(int argc, char **argv) { int i; TAU_PROFILE_TIMER(t,"main()", "", TAU_DEFAULT); TAU_PROFILE_SET_NODE(0); TAU_PROFILE_START(t); for (i=0; i&5; i++) { char buf[32]; sprintf(buf, "Iteration %d", i); TAU_PROFILE_TIMER_DYNAMIC(timer, buf, "", TAU_USER); TAU_PROFILE_START(timer); printf("Iteration %d\n", i); f1(); TAU_PROFILE_STOP(timer); } return 0; }
Fortran :
subroutine ITERATION(val) integer val character(13) cvar integer profiler(2) / 0, 0 / save profiler print *, "Iteration ", val write (cvar,'(a9,i2)') 'Iteration', val call TAU_PROFILE_TIMER_DYNAMIC(profiler, cvar) call TAU_PROFILE_START(profiler) call F1() call TAU_PROFILE_STOP(profiler) return end
TAU_PROFILE_DECLARE_TIMER
Declares a timer for C
C:
TAU_PROFILE_DECLARE_TIMER
Profiler timer
Because C89 does not allow mixed code and declarations, TAU_PROFILE_TIMER
can only be used once in a function. To declare two timers in a C function, use TAU_PROFILE_DECLARE_TIMER
and TAU_PROFILE_CREATE_TIMER
.
C :
int f1(void) { TAU_PROFILE_DECLARE_TIMER(t1); TAU_PROFILE_DECLARE_TIMER(t2); TAU_PROFILE_CREATE_TIMER(t1, "timer1", "", TAU_USER); TAU_PROFILE_CREATE_TIMER(t2, "timer2", "", TAU_USER); TAU_PROFILE_START(t1); ... TAU_PROFILE_START(t2); ... TAU_PROFILE_STOP(t2); TAU_PROFILE_STOP(t1); return 0; }
TAU_PROFILE_CREATE_TIMER
Creates a timer for C
C:
TAU_PROFILE_CREATE_TIMER
Profiler timer
Because C89 does not allow mixed code and declarations, TAU_PROFILE_TIMER
can only be used once in a function. To declare two timers in a C function, use TAU_PROFILE_DECLARE_TIMER
and TAU_PROFILE_CREATE_TIMER
.
C :
int f1(void) { TAU_PROFILE_DECLARE_TIMER(t1); TAU_PROFILE_DECLARE_TIMER(t2); TAU_PROFILE_CREATE_TIMER(t1, "timer1", "", TAU_USER); TAU_PROFILE_CREATE_TIMER(t2, "timer2", "", TAU_USER); TAU_PROFILE_START(t1); ... TAU_PROFILE_START(t2); ... TAU_PROFILE_STOP(t2); TAU_PROFILE_STOP(t1); return 0; }
TAU_PROFILE_DECLARE_TIMER , TAU_PROFILE_START , TAU_PROFILE_STOP
TAU_GLOBAL_TIMER
Declares a global timer
C/C++:
TAU_GLOBAL_TIMER
Profiler timer
char* or string& function_name
char* or string& type
TauGroup_t group
As TAU_PROFILE_TIMER
is used within the scope of a block (typically a routine), TAU_GLOBAL_TIMER
can be used across different routines.
C/C++ :
/* f1.c */ TAU_GLOBAL_TIMER(globalTimer, "global timer", "", TAU_USER); /* f2.c */ TAU_GLOBAL_TIMER_EXTERNAL(globalTimer); int foo(void) { TAU_GLOBAL_TIMER_START(globalTimer); /* ... */ TAU_GLOBAL_TIMER_STOP(); }
TAU_GLOBAL_TIMER_EXTERNAL
Declares a global timer from an external compilation unit
C/C++:
TAU_GLOBAL_TIMER_EXTERNAL
Profiler timer
TAU_GLOBAL_TIMER_EXTERNAL
allows you to access a timer defined in another compilation unit.
C/C++ :
/* f1.c */ TAU_GLOBAL_TIMER(globalTimer, "global timer", "", TAU_USER); /* f2.c */ TAU_GLOBAL_TIMER_EXTERNAL(globalTimer); int foo(void) { TAU_GLOBAL_TIMER_START(globalTimer); /* ... */ TAU_GLOBAL_TIMER_STOP(); }
TAU_GLOBAL_TIMER , TAU_GLOBAL_TIMER_START , TAU_GLOBAL_TIMER_STOP
TAU_GLOBAL_TIMER_START
Starts a global timer
C/C++:
TAU_GLOBAL_TIMER_START
Profiler timer
TAU_GLOBAL_TIMER_START
starts a global timer.
C/C++ :
/* f1.c */ TAU_GLOBAL_TIMER(globalTimer, "global timer", "", TAU_USER); /* f2.c */ TAU_GLOBAL_TIMER_EXTERNAL(globalTimer); int foo(void) { TAU_GLOBAL_TIMER_START(globalTimer); /* ... */ TAU_GLOBAL_TIMER_STOP(); }
TAU_GLOBAL_TIMER_STOP
Stops a global timer
C/C++:
TAU_GLOBAL_TIMER_STOP
TAU_GLOBAL_TIMER_STOP
stops a global timer.
C/C++ :
/* f1.c */ TAU_GLOBAL_TIMER(globalTimer, "global timer", "", TAU_USER); /* f2.c */ TAU_GLOBAL_TIMER_EXTERNAL(globalTimer); int foo(void) { TAU_GLOBAL_TIMER_START(globalTimer); /* ... */ TAU_GLOBAL_TIMER_STOP(); }
TAU_PHASE
Profile a C++ function as a phase
TAU_PHASE
char* or string& function_name
char* or string& type
TauGroup_t group
TAU_PHASE
profiles a function as a phase. This macro defines the function and takes care of the timer start and stop as well. The timer will stop when the macro goes out of scope (as in C++ destruction).
int foo(char *str) { TAU_PHASE(foo","int (char *)",TAU_DEFAULT); ... }
TAU_DYNAMIC_PHASE
Defines a dynamic phase.
C/C++:
TAU_DYNAMIC_PHASE
Phase phase
char* or string& function_name
char* or string& type
TauGroup_t group
Fortran:
TAU_DYNAMIC_PHASE
integer phase(2)
character name(size)
TAU_DYNAMIC_PHASE
creates a dynamic phase. The name of the timer can be different for each execution.
C/C++ :
int main(int argc, char **argv) { int i; TAU_PROFILE_TIMER(t,"main()", "", TAU_DEFAULT); TAU_PROFILE_SET_NODE(0); TAU_PROFILE_START(t); for (i=0; i&5; i++) { char buf[32]; sprintf(buf, "Iteration %d", i); TAU_DYNAMIC_PHASE(timer, buf, "", TAU_USER); TAU_PHASE_START(timer); printf("Iteration %d\n", i); f1(); TAU_PHASE_STOP(timer); } return 0; }
Fortran :
subroutine ITERATION(val) integer val character(13) cvar integer profiler(2) / 0, 0 / save profiler print *, "Iteration ", val write (cvar,'(a9,i2)') 'Iteration', val call TAU_DYNAMIC_PHASE(profiler, cvar) call TAU_PHASE_START(profiler) call F1() call TAU_PHASE_STOP(profiler) return end
TAU_PHASE_CREATE_DYNAMIC
Defines a dynamic phase.
C/C++:
TAU_PHASE_CREATE_DYNAMIC
Phase phase
char* or string& function_name
char* or string& type
TauGroup_t group
Fortran:
TAU_PHASE_CREATE_DYNAMIC
integer phase(2)
character name(size)
TAU_PHASE_CREATE_DYNAMIC
creates a dynamic phase. The name of the timer can be different for each execution.
C/C++ :
int main(int argc, char **argv) { int i; TAU_PROFILE_TIMER(t,"main()", "", TAU_DEFAULT); TAU_PROFILE_SET_NODE(0); TAU_PROFILE_START(t); for (i=0; i&5; i++) { char buf[32]; sprintf(buf, "Iteration %d", i); TAU_PHASE_CREATE_DYNAMIC(timer, buf, "", TAU_USER); TAU_PHASE_START(timer); printf("Iteration %d\n", i); f1(); TAU_PHASE_STOP(timer); } return 0; }
Fortran :
subroutine ITERATION(val) integer val character(13) cvar integer profiler(2) / 0, 0 / save profiler print *, "Iteration ", val write (cvar,'(a9,i2)') 'Iteration', val call TAU_PHASE_CREATE_DYNAMIC(profiler, cvar) call TAU_PHASE_START(profiler) call F1() call TAU_PHASE_STOP(profiler) return end
TAU_PHASE_CREATE_STATIC
Defines a static phase.
C/C++:
TAU_PHASE_CREATE_STATIC
Phase phase
char* or string& function_name
char* or string& type
TauGroup_t group
Fortran:
TAU_PHASE_CREATE_STATIC
integer phase(2)
character name(size)
TAU_PHASE_CREATE_STATIC
creates a static phase. Static phases (and timers) are more efficient than dynamic ones because the function registration only takes place once.
C/C++ :
int f2(void) { TAU_PHASE_CREATE_STATIC(t2,"IO Phase", "", TAU_USER); TAU_PHASE_START(t2); input(); output(); TAU_PHASE_STOP(t2); return 0; }
Fortran :
subroutine F2() integer phase(2) / 0, 0 / save phase call TAU_PHASE_CREATE_STATIC(phase,'IO Phase') call TAU_PHASE_START(phase) call INPUT() call OUTPUT() call TAU_PHASE_STOP(phase) end
Python:
import pytau ptr = pytau.phase("foo") pytau.start(ptr) foo(2) pytau.stop(ptr)
TAU_PHASE_START
Enters a phase.
C/C++:
TAU_PHASE_START
Phase phase
Fortran:
TAU_PHASE_START
integer phase(2)
TAU_PHASE_START
enters a phase. Phases can be nested, but not overlapped.
C/C++ :
int f2(void) { TAU_PHASE_CREATE_STATIC(t2,"IO Phase", "", TAU_USER); TAU_PHASE_START(t2); input(); output(); TAU_PHASE_STOP(t2); return 0; }
Fortran :
subroutine F2() integer phase(2) / 0, 0 / save phase call TAU_PHASE_CREATE_STATIC(phase,'IO Phase') call TAU_PHASE_START(phase) call INPUT() call OUTPUT() call TAU_PHASE_STOP(phase) end
TAU_PHASE_STOP
Exits a phase.
C/C++:
TAU_PHASE_STOP
Phase phase
Fortran:
TAU_PHASE_STOP
integer phase(2)
TAU_PHASE_STOP
exits a phase. Phases can be nested, but not overlapped.
C/C++ :
int f2(void) { TAU_PHASE_CREATE_STATIC(t2,"IO Phase", "", TAU_USER); TAU_PHASE_START(t2); input(); output(); TAU_PHASE_STOP(t2); return 0; }
Fortran :
subroutine F2() integer phase(2) / 0, 0 / save phase call TAU_PHASE_CREATE_STATIC(phase,'IO Phase') call TAU_PHASE_START(phase) call INPUT() call OUTPUT() call TAU_PHASE_STOP(phase) end
TAU_DYNAMIC_PHASE_START
Enters a DYNAMIC_PHASE.
C/C++:
TAU_DYNAMIC_PHASE_START
string name
Fortran:
TAU_DYNAMIC_PHASE_START
char name(size)
TAU_DYNAMIC_PHASE_START
enters a DYNAMIC phase. Phases can be nested, but not overlapped.
C/C++ :
TAU_PROFILE("int foo(int) [{foo.cpp} {13,1}-{20,1}]", " ", TAU_USER); printf("inside foo: calling bar: x = %d\n", x); printf("before calling bar in foo\n"); TAU_DYNAMIC_PHASE_START("foo_bar"); bar(x-1); /* 17 */ printf("after calling bar in foo\n"); TAU_DYNAMIC_PHASE_STOP("foo_bar"); return x;
Fortran :
call TAU_PROFILE_TIMER(profiler, 'FOO [{foo.f90} {8,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo: calling bar, x = ", x call TAU_DYNAMIC_PHASE_START("foo_bar"); call bar(x-1) print *, "after calling bar" call TAU_DYNAMIC_PHASE_STOP("foo_bar"); call TAU_PROFILE_STOP(profiler)
TAU_DYNAMIC_PHASE_STOP
Enters a DYNAMIC_PHASE.
C/C++:
TAU_DYNAMIC_PHASE_STOP
string name
Fortran:
TAU_DYNAMIC_PHASE_STOP
char name(size)
TAU_DYNAMIC_PHASE_STOP
leaves a DYNAMIC phase. Phases can be nested, but not overlapped.
C/C++ :
TAU_PROFILE("int foo(int) [{foo.cpp} {13,1}-{20,1}]", " ", TAU_USER); printf("inside foo: calling bar: x = %d\n", x); printf("before calling bar in foo\n"); TAU_DYNAMIC_PHASE_START("foo_bar"); bar(x-1); /* 17 */ printf("after calling bar in foo\n"); TAU_DYNAMIC_PHASE_STOP("foo_bar"); return x;
Fortran :
call TAU_PROFILE_TIMER(profiler, 'FOO [{foo.f90} {8,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo: calling bar, x = ", x call TAU_DYNAMIC_PHASE_START("foo_bar"); call bar(x-1) print *, "after calling bar" call TAU_DYNAMIC_PHASE_STOP("foo_bar"); call TAU_PROFILE_STOP(profiler)
TAU_STATIC_PHASE_START
Enters a STATIC_PHASE.
C/C++:
TAU_STATIC_PHASE_START
string name
Fortran:
TAU_STATIC_PHASE_START
char name(size)
TAU_STATIC_PHASE_START
enters a static phase. Phases can be nested, but not overlapped.
C/C++ :
TAU_PROFILE("int foo(int) [{foo.cpp} {13,1}-{20,1}]", " ", TAU_USER); printf("inside foo: calling bar: x = %d\n", x); printf("before calling bar in foo\n"); TAU_STATIC_PHASE_START("foo_bar"); bar(x-1); /* 17 */ printf("after calling bar in foo\n"); TAU_STATIC_PHASE_STOP("foo_bar"); return x;
Fortran :
call TAU_PROFILE_TIMER(profiler, 'FOO [{foo.f90} {8,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo: calling bar, x = ", x call TAU_STATIC_PHASE_START("foo_bar"); call bar(x-1) print *, "after calling bar" call TAU_STATIC_PHASE_STOP("foo_bar"); call TAU_PROFILE_STOP(profiler)
TAU_STATIC_PHASE_STOP
Enters a STATIC_PHASE.
C/C++:
TAU_STATIC_PHASE_STOP
string name
Fortran:
TAU_STATIC_PHASE_STOP
char name(size)
TAU_STATIC_PHASE_STOP
leaves a static phase. Phases can be nested, but not overlapped.
C/C++ :
TAU_PROFILE("int foo(int) [{foo.cpp} {13,1}-{20,1}]", " ", TAU_USER); printf("inside foo: calling bar: x = %d\n", x); printf("before calling bar in foo\n"); TAU_STATIC_PHASE_START("foo_bar"); bar(x-1); /* 17 */ printf("after calling bar in foo\n"); TAU_STATIC_PHASE_STOP("foo_bar"); return x;
Fortran :
call TAU_PROFILE_TIMER(profiler, 'FOO [{foo.f90} {8,18}]') call TAU_PROFILE_START(profiler) print *, "inside foo: calling bar, x = ", x call TAU_STATIC_PHASE_START("foo_bar"); call bar(x-1) print *, "after calling bar" call TAU_STATIC_PHASE_STOP("foo_bar"); call TAU_PROFILE_STOP(profiler)
TAU_GLOBAL_PHASE
Declares a global phase
C/C++:
TAU_GLOBAL_PHASE
Phase phase
char* or string& function_name
char* or string& type
TauGroup_t group
Declares a global phase to be used in multiple compilation units.
C/C++ :
/* f1.c */ TAU_GLOBAL_PHASE(globalPhase, "global phase", "", TAU_USER); /* f2.c */ int bar(void) { TAU_GLOBAL_PHASE_START(globalPhase); /* ... */ TAU_GLOBAL_PHASE_STOP(globalPhase); }
TAU_GLOBAL_PHASE_EXTERNAL
Declares a global phase from an external compilation unit
C/C++:
TAU_GLOBAL_PHASE_EXTERNAL
Profiler timer
TAU_GLOBAL_PHASE_EXTERNAL
allows you to access a phase defined in another compilation unit.
C/C++ :
/* f1.c */ TAU_GLOBAL_PHASE(globalPhase, "global phase", "", TAU_USER); /* f2.c */ int bar(void) { TAU_GLOBAL_PHASE_START(globalPhase); /* ... */ TAU_GLOBAL_PHASE_STOP(globalPhase); }
TAU_GLOBAL_PHASE , TAU_GLOBAL_PHASE_START , TAU_GLOBAL_PHASE_STOP
TAU_GLOBAL_PHASE_START
Starts a global phase
C/C++:
TAU_GLOBAL_PHASE_START
Phase phase
TAU_GLOBAL_PHASE_START
starts a global phase.
C/C++ :
/* f1.c */ TAU_GLOBAL_PHASE(globalPhase, "global phase", "", TAU_USER); /* f2.c */ int bar(void) { TAU_GLOBAL_PHASE_START(globalPhase); /* ... */ TAU_GLOBAL_PHASE_STOP(globalPhase); }
TAU_GLOBAL_PHASE_STOP
Stops a global phase
C/C++:
TAU_GLOBAL_PHASE_STOP
Phase phase
TAU_GLOBAL_PHASE_STOP
stops a global phase.
C/C++ :
/* f1.c */ TAU_GLOBAL_PHASE(globalPhase, "global phase", "", TAU_USER); /* f2.c */ int bar(void) { TAU_GLOBAL_PHASE_STOP(globalPhase); /* ... */ TAU_GLOBAL_PHASE_STOP(globalPhase); }
TAU_PROFILE_EXIT
Alerts the profiling system to an exit call
C/C++:
TAU_PROFILE_EXIT
const char * message
Fortran:
TAU_PROFILE_EXIT
character message(size)
TAU_PROFILE_EXIT
should be called prior to an error exit from the program so that any profiles or event traces can be dumped to disk before quitting.
C/C++ :
if ((ret = open(...)) < 0) { TAU_PROFILE_EXIT("ERROR in opening a file"); perror("open() failed"); exit(1); }
Fortran :
call TAU_PROFILE_EXIT('abort called')
TAU_REGISTER_THREAD
Register a thread with the profiling system
C/C++:
TAU_REGISTER_THREAD
Fortran:
TAU_REGISTER_THREAD
To register a thread with the profiling system, invoke the TAU_REGISTER_THREAD
macro in the run method of the thread prior to executing any other TAU macro. This sets up thread identifiers that are later used by the instrumentation system.
C/C++ :
void * threaded_func(void *data) { TAU_REGISTER_THREAD(); { /**** NOTE WE START ANOTHER BLOCK IN THREAD */ TAU_PROFILE_TIMER(tautimer, "threaded_func()", "int ()", TAU_DEFAULT); TAU_PROFILE_START(tautimer); work(); /* work done by this thread */ TAU_PROFILE_STOP(tautimer); } return NULL; }
Fortran :
call TAU_REGISTER_THREAD()
PDT based tau_instrumentor does not insert TAU_REGISTER_THREAD
calls, they must be inserted manually
TAU_PROFILE_GET_NODE
Returns the measurement system’s node id
C/C++:
TAU_PROFILE_GET_NODE
int node
Fortran:
TAU_PROFILE_GET_NODE
integer node
TAU_PROFILE_GET_NODE
gives the node id for the processes in which it is called. When using MPI node id is the same as MPI rank.
C/C++ :
int main (int argc, char **argv) { int nodeid; TAU_PROFILE_GET_NODE(nodeid); return 0; }
Fortran :
PROGRAM SUM_OF_CUBES INTEGER :: N call TAU_PROFILE_GET_NODE(N) END PROGRAM SUM_OF_CUBES
Python:
import pytau pytau.setNode(0)
TAU_PROFILE_GET_CONTEXT
Gives the measurement system’s context id
C/C++:
TAU_PROFILE_GET_CONTEXT
int context
Fortran:
TAU_PROFILE_GET_CONTEXT
integer context
TAU_PROFILE_GET_CONTEXT
gives the context id for the processes in which it is called.
C/C++ :
int main (int argc, char **argv) { int i; TAU_PROFILE_GET_CONTEXT(i); return 0; }
Fortran :
PROGRAM SUM_OF_CUBES INTEGER :: C call TAU_PROFILE_GET_CONTEXT(C) END PROGRAM SUM_OF_CUBES
TAU_PROFILE_SET_THREAD
Informs the measurement system of the THREAD id
C/C++:
TAU_PROFILE_SET_THREAD
int THREAD
Fortran:
TAU_PROFILE_SET_THREAD
integer THREAD
The TAU_PROFILE_SET_THREAD
macro sets the thread identifier of the executing task for profiling and tracing. Tasks are identified using node, context and thread ids. The profile data files generated will accordingly be named profile.<THREAD>.<context>.<thread>. Note that it is not necessary to call TAU_PROFILE_SET_THREAD
when you configued with a threading package (including OpenMP).
C/C++ :
int main (int argc, char **argv) { int ret, i; pthread_attr_t attr; pthread_t tid; TAU_PROFILE_TIMER(tautimer,"main()", "int (int, char **)", TAU_DEFAULT); TAU_PROFILE_START(tautimer); TAU_PROFILE_INIT(argc, argv); TAU_PROFILE_SET_THREAD(0); /* ... */ TAU_PROFILE_STOP(tautimer); return 0; }
Fortran :
PROGRAM SUM_OF_CUBES integer profiler(2) / 0, 0 / save profiler INTEGER :: H, T, U call TAU_PROFILE_INIT() call TAU_PROFILE_TIMER(profiler, 'PROGRAM SUM_OF_CUBES') call TAU_PROFILE_START(profiler) call TAU_PROFILE_SET_THREAD(0) ! This program prints all 3-digit numbers that ! equal the sum of the cubes of their digits. DO H = 1, 9 DO T = 0, 9 DO U = 0, 9 IF (100*H + 10*T + U == H**3 + T**3 + U**3) THEN PRINT "(3I1)", H, T, U ENDIF END DO END DO END DO call TAU_PROFILE_STOP(profiler) END PROGRAM SUM_OF_CUBES
Python:
import pytau pytau.setThread(0)
TAU_PROFILE_GET_THREAD
Gives the measurement system’s thread id
C/C++:
TAU_PROFILE_GET_THREAD
int thread
Fortran:
TAU_PROFILE_GET_THREAD
integer THREAD
TAU_PROFILE_GET_THREAD
gives the thread id for the processes in which it is called.
C/C++ :
int main (int argc, char **argv) { int i; TAU_PROFILE_GET_THREAD(i); return 0; }
Fortran :
PROGRAM SUM_OF_CUBES INTEGER :: T call TAU_PROFILE_GET_THREAD(T) ! This program prints all 3-digit numbers that ! equal the sum of the cubes of their digits. END PROGRAM SUM_OF_CUBES
Python:
import pytau pytau.getThread(i)
TAU_PROFILE_SET_NODE
Informs the measurement system of the node id
C/C++:
TAU_PROFILE_SET_NODE
int node
Fortran:
TAU_PROFILE_SET_NODE
integer node
The TAU_PROFILE_SET_NODE
macro sets the node identifier of the executing task for profiling and tracing. Tasks are identified using node, context and thread ids. The profile data files generated will accordingly be named profile.<node>.<context>.<thread>. Note that it is not necessary to call TAU_PROFILE_SET_NODE
when using the TAU MPI wrapper library.
C/C++ :
int main (int argc, char **argv) { int ret, i; pthread_attr_t attr; pthread_t tid; TAU_PROFILE_TIMER(tautimer,"main()", "int (int, char **)", TAU_DEFAULT); TAU_PROFILE_START(tautimer); TAU_PROFILE_INIT(argc, argv); TAU_PROFILE_SET_NODE(0); /* ... */ TAU_PROFILE_STOP(tautimer); return 0; }
Fortran :
PROGRAM SUM_OF_CUBES integer profiler(2) / 0, 0 / save profiler INTEGER :: H, T, U call TAU_PROFILE_INIT() call TAU_PROFILE_TIMER(profiler, 'PROGRAM SUM_OF_CUBES') call TAU_PROFILE_START(profiler) call TAU_PROFILE_SET_NODE(0) ! This program prints all 3-digit numbers that ! equal the sum of the cubes of their digits. DO H = 1, 9 DO T = 0, 9 DO U = 0, 9 IF (100*H + 10*T + U == H**3 + T**3 + U**3) THEN PRINT "(3I1)", H, T, U ENDIF END DO END DO END DO call TAU_PROFILE_STOP(profiler) END PROGRAM SUM_OF_CUBES
Python:
import pytau pytau.setNode(0)
TAU_PROFILE_SET_CONTEXT
Informs the measurement system of the context id
C/C++:
TAU_PROFILE_SET_CONTEXT
int context
Fortran:
TAU_PROFILE_SET_CONTEXT
integer context
The TAU_PROFILE_SET_CONTEXT
macro sets the context identifier of the executing task for profiling and tracing. Tasks are identified using context, context and thread ids. The profile data files generated will accordingly be named profile.<context>.<context>.<thread>. Note that it is not necessary to call TAU_PROFILE_SET_CONTEXT
when using the TAU MPI wrapper library.
C/C++ :
int main (int argc, char **argv) { int ret, i; pthread_attr_t attr; pthread_t tid; TAU_PROFILE_TIMER(tautimer,"main()", "int (int, char **)", TAU_DEFAULT); TAU_PROFILE_START(tautimer); TAU_PROFILE_INIT(argc, argv); TAU_PROFILE_SET_NODE(0); TAU_PROFILE_SET_CONTEXT(1); /* ... */ TAU_PROFILE_STOP(tautimer); return 0; }
Fortran :
PROGRAM SUM_OF_CUBES integer profiler(2) / 0, 0 / save profiler INTEGER :: H, T, U call TAU_PROFILE_INIT() call TAU_PROFILE_TIMER(profiler, 'PROGRAM SUM_OF_CUBES') call TAU_PROFILE_START(profiler) call TAU_PROFILE_SET_NODE(0) call TAU_PROFILE_SET_CONTEXT(1) ! This program prints all 3-digit numbers that ! equal the sum of the cubes of their digits. DO H = 1, 9 DO T = 0, 9 DO U = 0, 9 IF (100*H + 10*T + U == H**3 + T**3 + U**3) THEN PRINT "(3I1)", H, T, U ENDIF END DO END DO END DO call TAU_PROFILE_STOP(profiler) END PROGRAM SUM_OF_CUBES
TAU_REGISTER_FORK
Informs the measurement system that a fork has taken place
C/C++:
TAU_REGISTER_FORK
int pid
enum TauFork_t option
To register a child process obtained from the fork() syscall, invoke the TAU_REGISTER_FORK
macro. It takes two parameters, the first is the node id of the child process (typically the process id returned by the fork call or any 0..N-1 range integer). The second parameter specifies whether the performance data for the child process should be derived from the parent at the time of fork ( TAU_INCLUDE_PARENT_DATA
) or should be independent of its parent at the time of fork ( TAU_EXCLUDE_PARENT_DATA
). If the process id is used as the node id, before any analysis is done, all profile files should be converted to contiguous node numbers (from 0..N-1). It is highly recommended to use flat contiguous node numbers in this call for profiling and tracing.
C/C++ :
pID = fork(); if (pID == 0) { printf("Parent : pid returned %d\n", pID) } else { // If we'd used the TAU_INCLUDE_PARENT_DATA, we get // the performance data from the parent in this process // as well. TAU_REGISTER_FORK(pID, TAU_EXCLUDE_PARENT_DATA); printf("Child : pid = %d", pID); }
TAU_REGISTER_EVENT
Registers a user event
C/C++:
TAU_REGISTER_EVENT
TauUserEvent variable
char *event_name
Fortran:
TAU_REGISTER_EVENT
int variable(2)
character event_name(size)
TAU can profile user-defined events using TAU_REGISTER_EVENT
. The meaning of the event is determined by the user. The first argument to TAU_REGISTER_EVENT
is the pointer to an integer array. This array is declared with a save attribute as shown below.
C/C++ :
int user_square(int count) { TAU_REGISTER_EVENT(ue1, "UserSquare Event"); TAU_EVENT(ue1, count * count); return 0; }
Fortran :
integer eventid(2) save eventid call TAU_REGISTER_EVENT(eventid, 'Error in Iteration') call TAU_EVENT(eventid, count)
TAU_PROFILER_REGISTER_EVENT
Registers a user event
C/C++:
TAU_PROFILER_REGISTER_EVENT
TauUserEvent variable
void *event
char *event_name
Fortran:
TAU_PROFILER_REGISTER_EVENT
int integer (2)
character event_name(size)
TAU can profile user-defined events using TAU_PROFILER_REGISTER_EVENT
. The meaning of the event is determined by the user. The first argument to TAU_PROFILER_REGISTER_EVENT
is the pointer to an integer array. This array is declared with a save attribute as shown below.
C/C++ :
int user_square(int count) { void *ue1; TAU_PROFILER_REGISTER_EVENT(ue1, "UserSquare Event"); TAU_EVENT(ue1, count * count); return 0; }
Fortran :
integer eventid(2) save eventid call TAU_PROFILER_REGISTER_EVENT(eventid, 'Error in Iteration') call TAU_EVENT(eventid, count)
TAU_EVENT
Triggers a user event
C/C++:
TAU_TRIGGER_EVENT
const char * name
double value
Fortran:
TAU_TRIGGER_EVENT
int integer (2)
character event_name(size)
Triggers an named event with the given value
C/C++ :
int user_square(int count) { TAU_TRIGGER_EVENT("Error in Iteration", count * count); return 0; }
Fortran :
call TAU_EVENT(count, 'Error in Iteration')
TAU_EVENT
Triggers a user event
C/C++:
TAU_TRIGGER_EVENT_THREAD
const char * name
double value
int thread
Fortran:
TAU_TRIGGER_EVENT_THREAD
int integer (2)
int integer (2)
character event_name(size)
Triggers an named event with the given value on a given thead or task.
C/C++ :
int user_square(int count) { TAU_TRIGGER_EVENT("Error in Iteration", count * count, workTask); return 0; }
Fortran :
call TAU_EVENT(count, workTask, 'Error in Iteration')
TAU_EVENT
Triggers a user event
C/C++:
TAU_EVENT
TauUserEvent variable
double value
Fortran:
TAU_EVENT
integer variable(2)
real value
Triggers an event that was registered with TAU_REGISTER_EVENT
.
C/C++ :
int user_square(int count) { TAU_REGISTER_EVENT(ue1, "UserSquare Event"); TAU_EVENT(ue1, count * count); return 0; }
Fortran :
integer eventid(2) save eventid call TAU_REGISTER_EVENT(eventid, 'Error in Iteration') call TAU_EVENT(eventid, count)
TAU_EVENT_THREAD
Triggers a user event on a given thread
C/C++:
TAU_EVENT_THREAD
TauUserEVENT_THREAD variable
double value
int thread id
Fortran:
TAU_EVENT_THREAD
integer variable(2)
real value
integer thread id
Triggers an event that was registered with TAU_REGISTER_EVENT
on a given thread.
C/C++ :
int user_square(int count) { TAU_REGISTER_EVENT(ue1, "UserSquare Event"); TAU_EVENT_THREAD(ue1, count * count, threadid); return 0; }
Fortran :
integer eventid(2) save eventid call TAU_REGISTER_EVENT(eventid, 'Error in Iteration') call TAU_EVENT_THREAD(eventid, count, threadid)
TAU_REGISTER_CONTEXT_EVENT
Registers a context event
C/C++:
TAU_REGISTER_CONTEXT_EVENT
TauUserEvent variable
char *event_name
Fortran:
TAU_REGISTER_CONTEXT_EVENT
int variable(2)
character event_name(size)
Creates a context event with name. A context event appends the names of routines executing on the callstack to the name specified by the user. Whenver a context event is triggered, the callstack is examined to determine the context of execution. Starting from the parent function where the event is triggered, TAU walks up the callstack to a depth specified by the user in the environment variable TAU_CALLPATH_DEPTH
. If this environment variable is not specified, TAU uses 2 as the default depth. For e.g., if the user registers a context event with the name "memory used" and specifies 3 as the callpath depth, and if the event is triggered in two locations (in routine a, when it was called by b, when it was called by c, and in routine h, when it was called by g, when it was called by i), then, we’d see the user defined event information for "memory used: c() ⇒ b() ⇒ a()" and "memory used: i() ⇒ g() ⇒ h()".
C/C++ :
int f2(void) { static int count = 0; count ++; TAU_PROFILE("f2()", "(sleeps 2 sec, calls f3)", TAU_USER); TAU_REGISTER_CONTEXT_EVENT(event, "Iteration count"); /* if (count == 2) TAU_DISABLE_CONTEXT_EVENT(event); */ printf("Inside f2: sleeps 2 sec, calls f3\n"); TAU_CONTEXT_EVENT(event, 232+count); sleep(2); f3(); return 0; }
Fortran :
subroutine foo(id) integer id integer profiler(2) / 0, 0 / integer maev(2) / 0, 0 / integer mdev(2) / 0, 0 / save profiler, maev, mdev integer :: ierr integer :: h, t, u INTEGER, ALLOCATABLE :: STORAGEARY(:) DOUBLEPRECISION edata call TAU_PROFILE_TIMER(profiler, 'FOO') call TAU_PROFILE_START(profiler) call TAU_PROFILE_SET_NODE(0) call TAU_REGISTER_CONTEXT_EVENT(maev, "STORAGEARY Alloc [cubes.f:20]") call TAU_REGISTER_CONTEXT_EVENT(mdev, "STORAGEARY Dealloc [cubes.f:37]") allocate(STORAGEARY(1:999), STAT=IERR) edata = SIZE(STORAGEARY)*sizeof(INTEGER) call TAU_CONTEXT_EVENT(maev, edata) ... deallocate(STORAGEARY) edata = SIZE(STORAGEARY)*sizeof(INTEGER) call TAU_CONTEXT_EVENT(mdev, edata) call TAU_PROFILE_STOP(profiler) end subroutine foo
TAU_CONTEXT_EVENT
Triggers a context event
C/C++:
TAU_CONTEXT_EVENT
TauUserEvent variable
double value
Fortran:
TAU_CONTEXT_EVENT
integer variable(2)
real value
Triggers a context event. A context event associates the name with the list of routines along the callstack. A context event tracks information like a user defined event and TAU records the maxima, minima, mean, std. deviation and the number of samples for each context event. A context event helps distinguish the data supplied by the user based on the location where an event occurs and the sequence of actions (routine/timer invocations) that preceeded the event. The depth of the the callstack embedded in the context event’s name is specified by the user in the environment variable TAU_CALLPATH_DEPTH
. If this variable is not specified, TAU uses a default depth of 2.
C/C++ :
int f2(void) { static int count = 0; count ++; TAU_PROFILE("f2()", "(sleeps 2 sec, calls f3)", TAU_USER); TAU_REGISTER_CONTEXT_EVENT(event, "Iteration count"); /* if (count == 2) TAU_DISABLE_CONTEXT_EVENT(event); */ printf("Inside f2: sleeps 2 sec, calls f3\n"); TAU_CONTEXT_EVENT(event, 232+count); sleep(2); f3(); return 0; }
Fortran :
integer memevent(2) / 0, 0 / save memevent call TAU_REGISTER_CONTEXT_EVENT(memevent, "STORAGEARY mem allocated') call TAU_CONTEXT_EVENT(memevent, SIZEOF(STORAGEARY)*sizeof(INTEGER))
TAU_TRIGGER_CONTEXT_EVENT
Triggers a context event
C/C++:
TAU_TRIGGER_CONTEXT_EVENT
const char * name
double value
Fortran:
TAU_TRIGGER_CONTEXT_EVENT
real value
character event_name(size)
Triggers an event with a name and the list of routines along the callstack. A context event tracks information like a user defined event and TAU records the maxima, minima, mean, std. deviation and the number of samples for each context event. A context event helps distinguish the data supplied by the user based on the location where an event occurs and the sequence of actions (routine/timer invocations) that preceeded the event. The depth of the the callstack embedded in the context event’s name is specified by the user in the environment variable TAU_CALLPATH_DEPTH
. If this variable is not specified, TAU uses a default depth of 2.
C/C++ :
int f2(void) { static int count = 0; count ++; TAU_PROFILE("f2()", "(sleeps 2 sec, calls f3)", TAU_USER); /* if (count == 2) TAU_DISABLE_CONTEXT_EVENT(event); */ printf("Inside f2: sleeps 2 sec, calls f3\n"); TAU_TRIGGER_CONTEXT_EVENT("Iteration count", 232+count); sleep(2); f3(); return 0; }
Fortran :
integer memevent(2) / 0, 0 / save memevent call TAU_TRIGGER_CONTEXT_EVENT(memevent, SIZEOF(STORAGEARY)*sizeof(INTEGER), "STORAGEARY mem allocated")
TAU_EVENT
Triggers a context user event
C/C++:
TAU_TRIGGER_CONTEXT_EVENT_THREAD
const char * name
double value
int thread
Fortran:
TAU_TRIGGER_CONTEXT_EVENT_THREAD
int integer (2)
int integer (2)
character event_name(size)
Triggers an event with a name and the list of routines along the callstack. A context event tracks information like a user defined event and TAU records the maxima, minima, mean, std. deviation and the number of samples for each context event. A context event helps distinguish the data supplied by the user based on the location where an event occurs and the sequence of actions (routine/timer invocations) that preceeded the event. The depth of the the callstack embedded in the context event’s name is specified by the user in the environment variable TAU_CALLPATH_DEPTH
. If this variable is not specified, TAU uses a default depth of 2.
C/C++ :
int user_square(int count) { TAU_TRIGGER_CONTEXT_EVENT_THREAD("Error in Iteration", count * count, workTask); return 0; }
Fortran :
call TAU_TRIGGER_CONTEXT_EVENT_THREAD(count, workTask, 'Error in Iteration')
TAU_ENABLE_CONTEXT_EVENT
Enable a context event
C/C++:
TAU_ENABLE_CONTEXT_EVENT
TauUserEvent event
Enables a context event.
C/C++ :
int f2(void) { static int count = 0; count ++; TAU_PROFILE("f2()", "(sleeps 2 sec, calls f3)", TAU_USER); TAU_REGISTER_CONTEXT_EVENT(event, "Iteration count"); if (count == 2) TAU_DISABLE_CONTEXT_EVENT(event); else TAU_ENABLE_CONTEXT_EVENT(event); printf("Inside f2: sleeps 2 sec, calls f3\n"); TAU_CONTEXT_EVENT(event, 232+count); sleep(2); f3(); return 0; }
TAU_DISABLE_CONTEXT_EVENT
Disable a context event
C/C++:
TAU_DISABLE_CONTEXT_EVENT
TauUserEvent event
Disables a context event.
C/C++ :
int f2(void) { static int count = 0; count ++; TAU_PROFILE("f2()", "(sleeps 2 sec, calls f3)", TAU_USER); TAU_REGISTER_CONTEXT_EVENT(event, "Iteration count"); if (count == 2) TAU_DISABLE_CONTEXT_EVENT(event); else TAU_ENABLE_CONTEXT_EVENT(event); printf("Inside f2: sleeps 2 sec, calls f3\n"); TAU_CONTEXT_EVENT(event, 232+count); sleep(2); f3(); return 0; }
TAU_EVENT_SET_NAME
Sets the name of an event
C/C++:
TAU_EVENT_SET_NAME
TauUserEvent event
const char *name
Changes the name of an event.
C/C++ :
TAU_EVENT_SET_NAME(event, "new name");
TAU_EVENT_DISABLE_MAX
Disables tracking of maximum statistic for a given event
C/C++:
TAU_EVENT_DISABLE_MAX
TauUserEvent event
Disables tracking of maximum statistic for a given event
C/C++ :
TAU_EVENT_DISABLE_MAX(event);
TAU_EVENT_DISABLE_MEAN
Disables tracking of mean statistic for a given event
C/C++:
TAU_EVENT_DISABLE_MEAN
TauUserEvent event
Disables tracking of mean statistic for a given event
C/C++ :
TAU_EVENT_DISABLE_MEAN(event);
TAU_EVENT_DISABLE_MIN
Disables tracking of minimum statistic for a given event
C/C++:
TAU_EVENT_DISABLE_MIN
TauUserEvent event
Disables tracking of minimum statistic for a given event
C/C++ :
TAU_EVENT_DISABLE_MIN(event);
TAU_EVENT_DISABLE_STDDEV
Disables tracking of standard deviation statistic for a given event
C/C++:
TAU_EVENT_DISABLE_STDDEV
TauUserEvent event
Disables tracking of standard deviation statistic for a given event
C/C++ :
TAU_EVENT_DISABLE_STDDEV(event);
TAU_REPORT_STATISTICS
Outputs statistics
C/C++:
TAU_REPORT_STATISTICS
Fortran:
TAU_REPORT_STATISTICS
TAU_REPORT_STATISTICS
prints the aggregate statistics of user events across all threads in each node. Typically, this should be called just before the main thread exits.
C/C++ :
TAU_REPORT_STATISTICS();
Fortran :
call TAU_REPORT_STATISTICS()
TAU_REPORT_THREAD_STATISTICS
Outputs statistics, plus thread statistics
C/C++:
TAU_REPORT_THREAD_STATISTICS
Fortran:
TAU_REPORT_THREAD_STATISTICS
TAU_REPORT_THREAD_STATISTICS
prints the aggregate, as well as per thread user event statistics. Typically, this should be called just before the main thread exits.
C/C++ :
TAU_REPORT_THREAD_STATISTICS();
Fortran :
call TAU_REPORT_THREAD_STATISTICS()
TAU_ENABLE_INSTRUMENTATION
Enables instrumentation
C/C++:
TAU_ENABLE_INSTRUMENTATION
Fortran:
TAU_ENABLE_INSTRUMENTATION
TAU_ENABLE_INSTRUMENTATION
macro re-enables all TAU instrumentation. All instances of functions and statements that occur between the disable/enable section are ignored by TAU. This allows a user to limit the trace size, if the macros are used to disable recording of a set of iterations that have the same characteristics as, for example, the first recorded instance.
C/C++ :
int main(int argc, char **argv) { foo(); TAU_DISABLE_INSTRUMENTATION(); for (int i =0; i < N; i++) { bar(); // not recorded } TAU_ENABLE_INSTRUMENTATION(); bar(); // recorded }
Fortran :
call TAU_DISABLE_INSTRUMENTATION() ... call TAU_ENABLE_INSTRUMENTATION()
Python:
import pytau pytau.enableInstrumentation() ... pytau.disableInstrumentation()
TAU_DISABLE_INSTRUMENTATION , TAU_ENABLE_GROUP , TAU_DISABLE_GROUP , TAU_INIT , TAU_PROFILE_INIT
TAU_DISABLE_INSTRUMENTATION
Disables instrumentation
C/C++:
TAU_DISABLE_INSTRUMENTATION
Fortran:
TAU_DISABLE_INSTRUMENTATION
TAU_DISABLE_INSTRUMENTATION
macro disables all entry/exit instrumentation within all threads of a context. This allows the user to selectively enable and disable instrumentation in parts of his/her code. It is important to re-enable the instrumentation within the same basic block and scope.
C/C++ :
int main(int argc, char **argv) { foo(); TAU_DISABLE_INSTRUMENTATION(); for (int i =0; i < N; i++) { bar(); // not recorded } TAU_DISABLE_INSTRUMENTATION(); bar(); // recorded }
Fortran :
call TAU_DISABLE_INSTRUMENTATION() ... call TAU_DISABLE_INSTRUMENTATION()
Python:
import pytau pytau.enableInstrumentation() ... pytau.disableInstrumentation()
TAU_ENABLE_INSTRUMENTATION , TAU_ENABLE_GROUP , TAU_DISABLE_GROUP , TAU_INIT , TAU_PROFILE_INIT
TAU_ENABLE_GROUP
Enables tracking of a given group
C/C++:
TAU_ENABLE_GROUP
TauGroup_t group
Fortran:
TAU_ENABLE_GROUP
integer group
Enables the instrumentation for a given group. By default, it is already on.
C/C++ :
void foo() { TAU_PROFILE("foo()", " ", TAU_USER); ... TAU_ENABLE_GROUP(TAU_USER); }
Fortran :
include 'Profile/TauFAPI.h' call TAU_ENABLE_GROUP(TAU_USER)
Python:
import pytau pytau.enableGroup(TAU_USER)
TAU_DISABLE_GROUP
Disables tracking of a given group
C/C++:
TAU_DISABLE_GROUP
TauGroup_t group
Fortran:
TAU_DISABLE_GROUP
integer group
Disables the instrumentation for a given group. By default, it is on.
C/C++ :
void foo() { TAU_PROFILE("foo()", " ", TAU_USER); ... TAU_DISABLE_GROUP(TAU_USER); }
Fortran :
include 'Profile/TauFAPI.h' call TAU_DISABLE_GROUP(TAU_USER)
Python:
import pytau pytau.disableGroup(TAU_USER)
TAU_PROFILE_TIMER_SET_GROUP
Change the group of a timer
C/C++:
TAU_PROFILE_TIMER_SET_GROUP
Profiler timer
TauGroup_t group
TAU_PROFILE_TIMER_SET_GROUP
changes the group associated with a timer.
C/C++ :
void foo() { TAU_PROFILE_TIMER(t, "foo loop timer", " ", TAU_USER1); ... TAU_PROFILE_TIMER_SET_GROUP(t, TAU_USER3); }
TAU_PROFILE_TIMER_SET_GROUP_NAME
Changes the group name for a timer
C/C++:
TAU_PROFILE_TIMER_SET_GROUP_NAME
Profiler timer
char *groupname
TAU_PROFILE_TIMER_SET_GROUP_NAME
changes the group name associated with a given timer.
C/C++ :
void foo() { TAU_PROFILE_TIMER(looptimer, "foo: loop1", " ", TAU_USER); TAU_PROFILE_START(looptimer); for (int i = 0; i < N; i++) { /* do something */ } TAU_PROFILE_STOP(looptimer); TAU_PROFILE_TIMER_SET_GROUP_NAME("Field"); }
TAU_PROFILE_TIMER_SET_NAME
Changes the name of a timer
C/C++:
TAU_PROFILE_TIMER_SET_NAME
Profiler timer
string newname
TAU_PROFILE_TIMER_SET_NAME
macro changes the name associated with a timer to the newname argument.
C/C++ :
void foo() { TAU_PROFILE_TIMER(timer1, "foo:loop1", " ", TAU_USER); ... TAU_PROFILE_TIMER_SET_NAME(timer1, "foo:lines 21-34"); }
TAU_PROFILE_TIMER_SET_TYPE
Changes the type of a timer
C/C++:
TAU_PROFILE_TIMER_SET_TYPE
Profiler timer
string newname
TAU_PROFILE_TIMER_SET_TYPE
macro changes the type associated with a timer to the newname argument.
C/C++ :
void foo() { TAU_PROFILE_TIMER(timer1, "foo", "int", TAU_USER); ... TAU_PROFILE_TIMER_SET_TYPE(timer1, "long"); }
TAU_PROFILE_SET_GROUP_NAME
Changes the group name of a profiled section
C/C++:
TAU_PROFILE_SET_GROUP_NAME
char *groupname
TAU_PROFILE_SET_GROUP_NAME
macro allows the user to change the group name associated with the instrumented routine. This macro must be called within the instrumented routine.
C/C++ :
void foo() { TAU_PROFILE("foo()", "void ()", TAU_USER); TAU_PROFILE_SET_GROUP_NAME("Particle"); /* gives a more meaningful group name */ }
TAU_INIT
Processes command-line arguments for selective instrumentation
C/C++:
TAU_INIT
int *argc
char ***argv
TAU_INIT
parses and removes the command-line arguments for the names of profile groups that are to be selectively enabled for instrumentation. By default, if this macro is not used, functions belonging to all profile groups are enabled. TAU_INIT
differs from TAU_PROFILE_INIT
only in the argument types.
C/C++ :
int main(int argc, char **argv) { TAU_PROFILE("main()", "int (int, char **)", TAU_GROUP_12); TAU_INIT(&argc, &argv); ... } % ./a.out --profile 12+14
TAU_PROFILE_INIT
Processes command-line arguments for selective instrumentation
C/C++:
TAU_PROFILE_INIT
int argc
char **argv
Fortran:
TAU_PROFILE_INIT
TAU_PROFILE_INIT
parses the command-line arguments for the names of profile groups that are to be selectively enabled for instrumentation. By default, if this macro is not used, functions belonging to all profile groups are enabled. TAU_INIT
differs from TAU_PROFILE_INIT
only in the argument types.
C/C++ :
int main(int argc, char **argv) { TAU_PROFILE("main()", "int (int, char **)", TAU_DEFAULT); TAU_PROFILE_INIT(argc, argv); ... } % ./a.out --profile 12+14
Fortran :
PROGRAM SUM_OF_CUBES integer profiler(2) save profiler call TAU_PROFILE_INIT() ...
TAU_GET_PROFILE_GROUP
Creates groups based on names
C/C++:
TAU_GET_PROFILE_GROUP
char *groupname
TAU_GET_PROFILE_GROUP
allows the user to dynamically create groups based on strings, rather than use predefined, statically assigned groups such as TAU_USER1, TAU_USER2
etc. This allows names to be associated in creating unique groups that are more meaningful, using names of files or directories for instance.
C/C++ :
#define PARTICLES TAU_GET_PROFILE_GROUP("PARTICLES") void foo() { TAU_PROFILE("foo()", " ", PARTICLES); } void bar() { TAU_PROFILE("bar()", " ", PARTICLES); }
Python:
import pytau pytau.getProfileGroup("PARTICLES")
TAU_ENABLE_GROUP_NAME
Enables a group based on name
C/C++:
TAU_ENABLE_GROUP_NAME
char *groupname
Fortran:
TAU_ENABLE_GROUP_NAME
character groupname(size)
TAU_ENABLE_GROUP_NAME
macro can turn on the instrumentation associated with routines based on a dynamic group assigned to them. It is important to note that this and the TAU_DISABLE_GROUP_NAME
macros apply to groups created dynamically using TAU_GET_PROFILE_GROUP.
C/C++ :
/* tau_instrumentor was invoked with -g DTM for a set of files */ TAU_DISABLE_GROUP_NAME("DTM"); dtm_routines(); /* disable and then re-enable the group with the name DTM */ TAU_ENABLE_GROUP_NAME("DTM");
Fortran :
! tau_instrumentor was invoked with -g DTM for this file call TAU_PROFILE_TIMER(profiler, "ITERATE>DTM") call TAU_DISABLE_GROUP_NAME("DTM") ! Disable, then re-enable DTM group call TAU_ENABLE_GROUP_NAME("DTM")
Python:
import pytau pytau.enableGroupName("DTM")
TAU_DISABLE_GROUP_NAME
Disables a group based on name
C/C++:
TAU_DISABLE_GROUP_NAME
char *groupname
Fortran:
TAU_DISABLE_GROUP_NAME
character groupname(size)
Similar to TAU_ENABLE_GROUP_NAME
, this macro turns off the instrumentation in all routines associated with the dynamic group created using the tau_instrumentor -g <group_name> argument.
C/C++ :
/* tau_instrumentor was invoked with -g DTM for a set of files */ TAU_DISABLE_GROUP_NAME("DTM"); dtm_routines(); /* disable and then re-enable the group with the name DTM */ TAU_ENABLE_GROUP_NAME("DTM");
Fortran :
! tau_instrumentor was invoked with -g DTM for this file call TAU_PROFILE_TIMER(profiler, "ITERATE>DTM") call TAU_DISABLE_GROUP_NAME("DTM") ! Disable, then re-enable DTM group call TAU_ENABLE_GROUP_NAME("DTM")
Python:
import pytau pytau.disableGroupName("DTM")
TAU_ENABLE_ALL_GROUPS
Enables instrumentation in all groups
C/C++:
TAU_ENABLE_ALL_GROUPS
Fortran:
TAU_ENABLE_ALL_GROUPS
This macro turns on instrumentation in all groups
C/C++ :
TAU_ENABLE_ALL_GROUPS();
Fortran :
call TAU_ENABLE_ALL_GROUPS();
Python:
import pytau pytau.enableAllGroups()
TAU_DISABLE_ALL_GROUPS
Disables instrumentation in all groups
C/C++:
TAU_DISABLE_ALL_GROUPS
Fortran:
TAU_DISABLE_ALL_GROUPS
This macro turns off instrumentation in all groups.
C/C++ :
void foo() { TAU_DISABLE_ALL_GROUPS(); TAU_ENABLE_GROUP_NAME("PARTICLES"); }
Fortran :
call TAU_DISABLE_ALL_GROUPS();
Python:
import pytau pytau.disableAllGroups()
TAU_GET_EVENT_NAMES
Gets the registered user events.
C/C++:
TAU_GET_EVENT_NAMES
const char ***eventList
int *numEvents
Retrieves user event names for all user-defined events
C/C++ :
const char **eventList; int numEvents; TAU_GET_EVENT_NAMES(eventList, numEvents); cout << "numEvents: " << numEvents << endl;
TAU_GET_EVENT_VALS
Gets user event data for given user events.
C/C++:
TAU_GET_EVENT_VALS
const char **inUserEvents
int numUserEvents
int **numEvents
double **max
double **min
double **mean
double **sumSqe
Retrieves user defined event data for the specified user defined events. The list of events are specified by the first parameter (eventList) and the user specifies the number of events in the second parameter (numUserEvents). TAU returns the number of times the event was invoked in the numUserEvents. The max, min, mean values are returned in the following parameters. TAU computes the sum of squares of the given event and returns this value in the next argument (sumSqe).
C/C++ :
const char **eventList; int numEvents; TAU_GET_EVENT_NAMES(eventList, numEvents); cout << "numEvents: " << numEvents << endl; if (numEvents > 0) { int *numSamples; double *max; double *min; double *mean; double *sumSqr; TAU_GET_EVENT_VALS(eventList, numEvents, numSamples, max, min, mean, sumSqr); for (int i=0; i<numEvents; i++) { cout << "-------------------\n"; cout << "User Event: " << eventList[i] << endl; cout << "Number of Samples: " << numSamples[i] << endl; cout << "Maximum Value: " << max[i] << endl; cout << "Minimum Value: " << min[i] << endl; cout << "Mean Value: " << mean[i] << endl; cout << "Sum Squared: " << sumSqr[i] << endl; } } }
TAU_GET_COUNTER_NAMES
Gets the counter names
C/C++:
TAU_GET_COUNTER_NAMES
char **counterList
int numCounters
TAU_GET_COUNTER_NAMES
returns the list of counter names and the number of counters used for measurement. When wallclock time is used, the counter name of "default" is returned.
C/C++ :
int numOfCounters; const char ** counterList; TAU_GET_COUNTER_NAMES(counterList, numOfCounters); for(int j=0;j<numOfCounters;j++){ cout << "The counter names so far are: " << counterList[j] << endl; }
Python:
import pytau pytau.getCounterNames(counterList, numOfCounters);
TAU_GET_FUNC_NAMES
Gets the function names
C/C++:
TAU_GET_FUNC_NAMES
char **functionList
int numFuncs
This macro fills the funcList argument with the list of timer and routine names. It also records the number of routines active in the numFuncs argument.
C/C++ :
const char ** functionList; int numOfFunctions; TAU_GET_FUNC_NAMES(functionList, numOfFunctions); for(int i=0;i<numOfFunctions;i++){ cout << "This function names so far are: " << functionList[i] << endl; }
Python:
import pytau pytau.getFuncNames(functionList, numOfFunctions)
TAU_GET_FUNC_VALS
Gets detailed performance data for given functions
C/C++:
TAU_GET_FUNC_VALS
const char **inFuncs
int numOfFuncs
double ***counterExclusiveValues
double ***counterInclusiveValues
int **numOfCalls
int **numOfSubRoutines
const char ***counterNames
int *numOfCounters
int tid
It gets detailed performance data for the list of routines. The user specifies inFuncs and the number of routines; TAU then returns the other arguments with the performance data. counterExclusiveValues and counterInclusiveValues are two dimensional arrays: the first dimension is the routine id and the second is counter id. The value is indexed by these two dimensions. numCalls and numSubrs (or child routines) are one dimensional arrays.
C/C++ :
const char **inFuncs; /* The first dimension is functions, and the second dimension is counters */ double **counterExclusiveValues; double **counterInclusiveValues; int *numOfCalls; int *numOfSubRoutines; const char **counterNames; int numOfCouns; TAU_GET_FUNC_NAMES(functionList, numOfFunctions); /* We are only interested in the first two routines that are executing in this context. So, we allocate space for two routine names and get the performance data for these two routines at runtime. */ if (numOfFunctions >=2 ) { inFuncs = (const char **) malloc(sizeof(const char *) * 2); inFuncs[0] = functionList[0]; inFuncs[1] = functionList[1]; //Just to show consistency. TAU_DB_DUMP(); TAU_GET_FUNC_VALS(inFuncs, 2, counterExclusiveValues, counterInclusiveValues, numOfCalls, numOfSubRoutines, counterNames, numOfCouns); TAU_DUMP_FUNC_VALS_INCR(inFuncs, 2); cout << "@@@@@@@@@@@@@@@" << endl; cout << "The number of counters is: " << numOfCouns << endl; cout << "The first counter is: " << counterNames[0] << endl; cout << "The Exclusive value of: " << inFuncs[0] << " is: " << counterExclusiveValues[0][0] << endl; cout << "The numOfSubRoutines of: " << inFuncs[0] << " is: " << numOfSubRoutines[0] << endl; cout << "The Inclusive value of: " << inFuncs[1] << " is: " << counterInclusiveValues[1][0] << endl; cout << "The numOfCalls of: " << inFuncs[1] << " is: " << numOfCalls[1] << endl; cout << "@@@@@@@@@@@@@@@" << endl; } TAU_DB_DUMP_INCR();
Python:
import pytau pytau.dumpFuncVals("foo", "bar", "bar2")
TAU_ENABLE_TRACKING_MEMORY
Enables memory tracking
C/C++:
TAU_ENABLE_TRACKING_MEMORY
Fortran:
TAU_ENABLE_TRACKING_MEMORY
Enables tracking of the heap memory utilization in the program. TAU takes a sample of the heap memory utilized (as reported by the mallinfo system call) and associates it with a single global user defined event. An interrupt is generated every 10 seconds and the value of the heap memory used is recorded in the user defined event. The inter-interrupt interval (default of 10 seconds) may be set by the user using the call TAU_SET_INTERRUPT_INTERVAL
.
C/C++ :
TAU_ENABLE_TRACKING_MEMORY();
Fortran :
call TAU_ENABLE_TRACKING_MEMORY()
Python:
import pytau pytau.enableTrackingMemory()
TAU_DISABLE_TRACKING_MEMORY
Disables memory tracking
C/C++:
TAU_DISABLE_TRACKING_MEMORY
Fortran:
TAU_DISABLE_TRACKING_MEMORY
Disables tracking of heap memory utilization. This call may be used in sections of code where TAU should not interrupt the execution to periodically track the heap memory utilization.
C/C++ :
TAU_DISABLE_TRACKING_MEMORY();
Fortran :
call TAU_DISABLE_TRACKING_MEMORY()
Python:
import pytau pytau.disableTrackingMemory()
TAU_TRACK_POWER
Initializes POWER tracking system
C/C++:
TAU_TRACK_POWER
Fortran:
TAU_TRACK_POWER
For power profiling, there are two modes of operation: 1) the user explicitly inserts TAU_TRACK_POWER_HERE() calls in the source code and the power event is triggered at those locations, and 2) the user enables tracking POWER by calling TAU_TRACK_POWER() and an interrupt is generated every 10 seconds and the POWER event is triggered with the current value. Also, this interrupt interval can be changed by calling TAU_SET_INTERRUPT_INTERVAL(value). The tracking of power events in both cases can be explictly enabled or disabled by calling the macros TAU_ENABLE_TRACKING_POWER() or TAU_DISABLE_TRACKING_() respectively.
C/C++ :
TAU_TRACK_POWER();
Fortran :
call TAU_TRACK_POWER()
Python:
import pytau pytau.trackPower()
TAU_TRACK_POWER_HERE
Triggers power tracking at a given execution point
C/C++:
TAU_TRACK_POWER_HERE
Fortran:
TAU_TRACK_POWER_HERE
Triggers power tracking at a given execution point
C/C++ :
int main(int argc, char **argv) { TAU_PROFILE("main()", " ", TAU_DEFAULT); TAU_PROFILE_SET_NODE(0); TAU_TRACK_POWER_HERE(); int *x = new int[5*1024*1024]; TAU_TRACK_POWER_HERE(); return 0; }
Fortran :
INTEGER, ALLOCATABLE :: STORAGEARY(:) allocate(STORAGEARY(1:999), STAT=IERR) ! if we wish to record a sample of the heap POWER ! utilization at this point, invoke the following call: call TAU_TRACK_POWER_HERE()
Python:
import pytau pytau.trackPowerHere()
TAU_ENABLE_TRACKING_POWER
Enables power headroom tracking
C/C++:
TAU_ENABLE_TRACKING_POWER
Fortran:
TAU_ENABLE_TRACKING_POWER
TAU_ENABLE_TRACKING_POWER()
enables power tracking after a TAU_DISABLE_TRACKING_POWER()
.
C/C++ :
TAU_DISABLE_TRACKING_POWER(); /* do some work */ ... /* re-enable tracking POWER */ TAU_ENABLE_TRACKING_POWER();
Fortran :
call TAU_ENABLE_TRACKING_POWER();
Fortran :
import pytau pytau.enableTrackingPowerHeadroom()
TAU_DISABLE_TRACKING_POWER
Disables power headroom tracking
C/C++:
TAU_DISABLE_TRACKING_POWER
Fortran:
TAU_DISABLE_TRACKING_POWER
TAU_DISABLE_TRACKING_POWER()
disables power tracking.
C/C++ :
TAU_DISABLE_TRACKING_POWER();
Fortran :
call TAU_DISABLE_TRACKING_POWER()
Python:
import pytau pytau.disableTrackingPowerHeadroom()
TAU_TRACK_MEMORY
Initializes memory tracking system
C/C++:
TAU_TRACK_MEMORY
Fortran:
TAU_TRACK_MEMORY
For memory profiling, there are two modes of operation: 1) the user explicitly inserts TAU_TRACK_MEMORY_HERE() calls in the source code and the memory event is triggered at those locations, and 2) the user enables tracking memory by calling TAU_TRACK_MEMORY() and an interrupt is generated every 10 seconds and the memory event is triggered with the current value. Also, this interrupt interval can be changed by calling TAU_SET_INTERRUPT_INTERVAL(value). The tracking of memory events in both cases can be explictly enabled or disabled by calling the macros TAU_ENABLE_TRACKING_MEMORY() or TAU_DISABLE_TRACKING_MEMORY() respectively.
C/C++ :
TAU_TRACK_MEMORY();
Fortran :
call TAU_TRACK_MEMORY()
Python:
import pytau pytau.trackMemory()
TAU_TRACK_MEMORY_HERE
Triggers memory tracking at a given execution point
C/C++:
TAU_TRACK_MEMORY_HERE
Fortran:
TAU_TRACK_MEMORY_HERE
Triggers memory tracking at a given execution point
C/C++ :
int main(int argc, char **argv) { TAU_PROFILE("main()", " ", TAU_DEFAULT); TAU_PROFILE_SET_NODE(0); TAU_TRACK_MEMORY_HERE(); int *x = new int[5*1024*1024]; TAU_TRACK_MEMORY_HERE(); return 0; }
Fortran :
INTEGER, ALLOCATABLE :: STORAGEARY(:) allocate(STORAGEARY(1:999), STAT=IERR) ! if we wish to record a sample of the heap memory ! utilization at this point, invoke the following call: call TAU_TRACK_MEMORY_HERE()
Python:
import pytau pytau.trackMemoryHere()
TAU_TRACK_MEMORY_FOOTPRINT
Initializes memory footprint tracking system
C/C++:
TAU_TRACK_MEMORY_FOOTPRINT
Fortran:
TAU_TRACK_MEMORY_FOOTPRINT
Similar to TAU_TRACK_MEMORY but uses the Virtual Memory Resident Set Size (VmRSS) and High Water Mark (VmHWM) to produce an interval event and an atomic event respectively.
C/C++ :
TAU_TRACK_MEMORY_FOOTPRINT();
Fortran :
call TAU_TRACK_MEMORY_FOOTPRINT()
TAU_TRACK_MEMORY_FOOTPRINT_HERE
Triggers memory footprint tracking at a given execution point
C/C++:
TAU_TRACK_MEMORY_FOOTPRINT_HERE
Fortran:
TAU_TRACK_MEMORY_FOOTPRINT_HERE
Similar to TAU_TRACK_MEMORY_HERE but uses the Virtual Memory Resident Set Size (VmRSS) and High Water Mark (VmHWM) to produce an interval event and an atomic event respectively.
C/C++ :
int main(int argc, char **argv) { TAU_PROFILE("main()", " ", TAU_DEFAULT); TAU_PROFILE_SET_NODE(0); TAU_TRACK_MEMORY_FOOTPRINT_HERE(); int *x = new int[5*1024*1024]; TAU_TRACK_MEMORY_FOOTPRINT_HERE(); return 0; }
Fortran :
INTEGER, ALLOCATABLE :: STORAGEARY(:) allocate(STORAGEARY(1:999), STAT=IERR) call TAU_TRACK_MEMORY_FOOTPRINT_HERE()
TAU_ENABLE_TRACKING_MEMORY_HEADROOM
Enables memory headroom tracking
C/C++:
TAU_ENABLE_TRACKING_MEMORY_HEADROOM
Fortran:
TAU_ENABLE_TRACKING_MEMORY_HEADROOM
TAU_ENABLE_TRACKING_MEMORY_HEADROOM()
enables memory headroom tracking after a TAU_DISABLE_TRACKING_MEMORY_HEADROOM()
.
C/C++ :
TAU_DISABLE_TRACKING_MEMORY_HEADROOM(); /* do some work */ ... /* re-enable tracking memory headroom */ TAU_ENABLE_TRACKING_MEMORY_HEADROOM();
Fortran :
call TAU_ENABLE_TRACKING_MEMORY_HEADROOM();
Fortran :
import pytau pytau.enableTrackingMemoryHeadroom()
TAU_DISABLE_TRACKING_MEMORY_HEADROOM
Disables memory headroom tracking
C/C++:
TAU_DISABLE_TRACKING_MEMORY_HEADROOM
Fortran:
TAU_DISABLE_TRACKING_MEMORY_HEADROOM
TAU_DISABLE_TRACKING_MEMORY_HEADROOM()
disables memory headroom tracking.
C/C++ :
TAU_DISABLE_TRACKING_MEMORY_HEADROOM();
Fortran :
call TAU_DISABLE_TRACKING_MEMORY_HEADROOM()
Python:
import pytau pytau.disableTrackingMemoryHeadroom()
TAU_TRACK_MEMORY_HEADROOM
Track the headroom (amount of memory for a process to grow) by periodically interrupting the program
C/C++:
TAU_TRACK_MEMORY_HEADROOM
Fortran:
TAU_TRACK_MEMORY_HEADROOM
Tracks the amount of memory available for the process before it runs out of free memory on the heap. This call sets up a signal handler that is invoked every 10 seconds by an interrupt (this interval may be altered by using the TAU_SET_INTERRUPT_INTERVAL
call). Inside the interrupt handler, TAU evaluates how much memory it can allocate and associates it with the callstack using the TAU context events (See TAU_REGISTER_CONTEXT_EVENT ). The user can vary the size of the callstack by setting the environment variable TAU_CALLPATH_DEPTH
(default is 2). This call is useful on machines like IBM BG/L where no virtual memory (or paging using the swap space) is present. The amount of heap memory available to the program is limited by the amount of available physical memory. TAU executes a series of malloc calls with a granularity of 1MB and determines the amount of memory available for the program to grow.
C/C++ :
TAU_TRACK_MEMORY_HEADROOM();
Fortran :
call TAU_TRACK_MEMORY_HEADROOM()
Python:
import pytau pytau.trackMemoryHeadroom()
TAU_TRACK_MEMORY_HEADROOM_HERE
Takes a sample of the amount of memory available at a given point.
C/C++:
TAU_TRACK_MEMORY_HEADROOM_HERE
Fortran:
TAU_TRACK_MEMORY_HEADROOM_HERE
Instead of relying on a periodic interrupt to track the amount of memory available to grow, this call may be used to take a sample at a given location in the source code. Context events are used to track the amount of memory headroom.
C/C++ :
ary = new double [1024*1024*50]; TAU_TRACK_MEMORY_HEADROOM_HERE();
Fortran :
INTEGER, ALLOCATABLE :: STORAGEARY(:) allocate(STORAGEARY(1:999), STAT=IERR) TAU_TRACK_MEMORY_HEADROOM_HERE();
Python:
import pytau pytau.trackMemoryHeadroomHere()
TAU_SET_INTERRUPT_INTERVAL
Change the inter-interrupt interval for tracking memory and headroom
C/C++:
TAU_SET_INTERRUPT_INTERVAL
int value
Fortran:
TAU_SET_INTERRUPT_INTERVAL
integer value
Set the interrupt interval for tracking memory and headroom (See TAU_TRACK_MEMORY and TAU_TRACK_MEMORY_HEADROOM ). By default an inter-interrupt interval of 10 seconds is used in TAU. This call allows the user to set it to a different value specified by the argument value.
C/C++ :
TAU_SET_INTERRUPT_INTERVAL(2) /* invokes the interrupt handler for memory every 2s */
Fortran :
call TAU_SET_INTERRUPT_INTERVAL(2)
Python:
import pytau pytau.setInterruptTnterval(2)
CT
Returns the type information for a variable
C/C++:
CT
<type> variable
The CT
macro returns the runtime type information string of a variable. This is useful in constructing the type parameter of the TAU_PROFILE
macro. For templates, the type information can be constructed using the type of the return and the type of each of the arguments (parameters) of the template. The example in the following macro will clarify this.
C/C++ :
TAU_PROFILE("foo::memberfunc()", CT(*this), TAU_DEFAULT);
TAU_TYPE_STRING
Creates a type string
C++:
TAU_TYPE_STRING
string &variable
string &type_string
This macro assigns the string constructed in type_string to the variable. The + operator and the CT macro can be used to construct the type string of an object. This is useful in identifying templates uniquely, as shown below.
C++ :
template<class PLayout> ostream& operator<<(ostream& out, const ParticleBase<PLayout>& P) { TAU_TYPE_STRING(taustr, "ostream (ostream, " + CT(P) + " )"); TAU_PROFILE("operator<<()"taustr, TAU_PARTICLE | TAU_IO); ... }
When PLayout is instantiated with " UniformCartesian<3U, double>
",this generates the unique template name:
operator<<() ostream const ParticleBase<UniformCartesian<3U, double> > )
The following example illustrates the usage of the CT macro to extract the name of the class associated with the given object using CT(*this);
template<class PLayout> unsigned ParticleBase<PLayout7>::GetMessage(Message& msg, int node) { TAU_TYPE_STRING(taustr, CT(*this) + "unsigned (Message, int)"); TAU_PROFILE("ParticleBase::GetMessage()", taustr, TAU_PARTICLE); ... }
When PLayout is instantiated with " UniformCartesian<3U, double>
",this generates the unique template name:
ParticleBase::GetMessage() ParticleBase<UniformCartesian<3U, double> > unsigned (Message, int)
TAU_DB_DUMP
Dumps the profile database to disk
C/C++:
TAU_DB_DUMP
Fortran:
TAU_DB_DUMP
Dumps the profile database to disk. The format of the files is the same as regular profiles, they are simply prefixed with "dump" instead of "profile".
C/C++ :
TAU_DB_DUMP();
Fortran :
call TAU_DB_DUMP()
TAU_DB_MERGED_DUMP
Dumps the profile database to disk
C/C++:
TAU_DB_MERGED_DUMP
Fortran:
TAU_DB_MERGED_DUMP
Dumps the profile database to disk. The format of the files is the same as merged profiles: tauprofile.xml
C/C++ :
TAU_DB_MERGED_DUMP();
Fortran :
call TAU_DB_MERGED_DUMP()
TAU_DB_DUMP_INCR
Dumps profile database into timestamped profiles on disk
C/C++:
TAU_DB_DUMP_INCR
This is similar to the TAU_DB_DUMP macro but it produces dump files that have a timestamp in their names. This allows the user to record timestamped incremental dumps as the application executes.
C/C++ :
TAU_DB_DUMP_INCR();
Python:
import pytau pytau.dbDumpIncr("prefix")
TAU_DB_DUMP_PREFIX
Dumps the profile database into profile files with a given prefix
C/C++:
TAU_DB_DUMP_PREFIX
char *prefix
Fortran:
TAU_DB_DUMP_PREFIX
character prefix(size)
The TAU_DB_DUMP_PREFIX
macro dumps all profile data to disk and records a checkpoint or a snapshot of the profile statistics at that instant. The dump files are named <prefix>.<node>.<context>.<thread>. If prefix is "profile", the files are named profile.0.0.0, etc. and may be read by paraprof/pprof tools as the application executes.
C/C++ :
TAU_DB_DUMP_PREFIX("prefix");
Fortran :
call TAU_DB_DUMP_PREFIX("prefix")
Python :
import pytau pytau.dbDump("prefix")
TAU_DB_DUMP_PREFIX_TASK
Dumps the profile database into profile files with a given task
C/C++:
TAU_DB_DUMP_PREFIX_TASK
char *PREFIX_TASK
Fortran:
TAU_DB_DUMP_PREFIX_TASK
character prefix(size)
integer task(size)
The TAU_DB_DUMP_PREFIX_TASK
macro dumps all profile data to disk and records a checkpoint or a snapshot of the profile statistics on a particular task at that instant. The dump files are named <prefix>.<node>.<context>.<thread>. If prefix is "profile", the files are named profile.0.0.0, etc. and may be read by paraprof/pprof tools as the application executes.
C/C++ :
TAU_DB_DUMP_PREFIX_TASK("PREFIX", taskid);
Fortran :
call TAU_DB_DUMP_PREFIX_TASK("PREFIX", taskid)
Python :
import pytau pytau.dbDump("PREFIX", taskid)
TAU_DB_PURGE
Purges the performance data.
C/C++:
TAU_DB_PURGE
Purges the performance data collected so far.
C/C++ :
TAU_DB_PURGE();
TAU_DUMP_FUNC_NAMES
Dumps function names to disk
C/C++:
TAU_DUMP_FUNC_NAMES
This macro writes the names of active functions to a file named dump_functionnames_<node>.<context>.
C/C++ :
TAU_DUMP_FUNC_NAMES();
Python:
import pytau pytau.dumpFuncNames()
TAU_DUMP_FUNC_VALS
Dumps performance data for given functions to disk.
C/C++:
TAU_DUMP_FUNC_VALS
char **inFuncs
int numFuncs
TAU_DUMP_FUNC_VALS
writes the data associated with the routines listed in inFuncs to disk. The number of routines is specified by the user in numFuncs.
C/C++ :
TAU_DUMP_FUNC_VALS_INCR
Dumps function values with a timestamp
C/C++:
TAU_DUMP_FUNC_VALS_INCR
char **inFuncs
int numFuncs
Similar to TAU_DUMP_FUNC_VALS
. This macro creates an incremental selective dump and dumps the results with a date stamp to the filename such as sel_dumpThu-Mar-28-16:30:48-2002.0.0.0. In this manner the previous TAU_DUMP_FUNC_VALS_INCR(…)
are not overwritten (unless they occur within a second).
C/C++ :
const char **inFuncs; /* The first dimension is functions, and the second dimension is counters */ double **counterExclusiveValues; double **counterInclusiveValues; int *numOfCalls; int *numOfSubRoutines; const char **counterNames; int numOfCouns; TAU_GET_FUNC_VALS(inFuncs, 2, counterExclusiveValues, counterInclusiveValues, numOfCalls, numOfSubRoutines, counterNames, numOfCouns); TAU_DUMP_FUNC_VALS(inFuncs, 2);
Python:
import pytau pytau.dumpFuncValsIncr("foo", "bar", "bar2")
TAU_PROFILE_STMT
Executes a statement only when TAU is used.
C/C++:
TAU_PROFILE_STMT
statement statement
TAU_PROFILE_STMT
executes a statement, or declares a variable that is used only during profiling or for execution of a statement that takes place only when the instrumentation is active. When instrumentation is inactive (i.e., when profiling and tracing are turned off as described in Chapter 2), all macros are defined as null.
C/C++ :
TAU_PROFILE_STMT(T obj;); // T is a template parameter) TAU_TYPE_STRING(str, "void () " + CT(obj) );
TAU_PROFILE_CALLSTACK
Generates a callstack trace at a given location.
C/C++:
TAU_PROFILE_CALLSTACK
When TAU is configured with -PROFILECALLSTACK
configuration option, and this call is invoked, a callpath trace is generated. A GUI for viewing this trace is included in TAU’s utils/csUI directory. This option is deprecated.
C/C++ :
TAU_PROFILE_CALLSTACK();
TAU_TRACE_RECVMSG
Traces a receive operation
C/C++:
TAU_TRACE_RECVMSG
int tag
int source
int length
Fortran:
TAU_TRACE_RECVMSG
integer tag
integer source
integer length
TAU_TRACE_RECVMSG
traces a receive operation where tag represents the type of the message received from the source process. NOTE: When TAU is configured to use MPI (-mpiinc=<dir> -mpilib=<dir>), the TAU_TRACE_RECVMSG
and TAU_TRACE_SENDMSG
macros are not required. The wrapper interposition library in ---- $(TAU_MPI_LIBS) uses these macros internally for logging messages. ---- uses these macros internally for logging messages.
C/C++ :
if (pid == 0) { TAU_TRACE_SENDMSG(currCol, sender, ncols * sizeof(T)); MPI_Send(vctr2, ncols * sizeof(T), MPI_BYTE, sender, currCol, MPI_COMM_WORLD); } else { MPI_Recv(&ans, sizeof(T), MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG,MPI_COMM_WORLD, &stat); MPI_Get_count(&stat, MPI_BYTE, &recvcount); TAU_TRACE_RECVMSG(stat.MPI_TAG, stat.MPI_SOURCE, recvcount); }
Fortran :
call TAU_TRACE_RECVMSG(tag, source, length) call TAU_TRACE_SENDMSG(tag, destination, length)
TAU_TRACE_SENDMSG
Traces a receive operation
C/C++:
TAU_TRACE_SENDMSG
int tag
int source
int length
Fortran:
TAU_TRACE_SENDMSG
integer tag
integer source
integer length
TAU_TRACE_SENDMSG
traces an inter-process message communication when a tagged message is sent to a destination process. NOTE: When TAU is configured to use MPI (-mpiinc=<dir> -mpilib=<dir>), the TAU_TRACE_SENDMSG
and TAU_TRACE_SENDMSG
macros are not required. The wrapper interposition library in ---- $(TAU_MPI_LIBS) uses these macros internally for logging messages. ---- uses these macros internally for logging messages.
C/C++ :
if (pid == 0) { TAU_TRACE_SENDMSG(currCol, sender, ncols * sizeof(T)); MPI_Send(vctr2, ncols * sizeof(T), MPI_BYTE, sender, currCol, MPI_COMM_WORLD); } else { MPI_Recv(&ans, sizeof(T), MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG,MPI_COMM_WORLD, &stat); MPI_Get_count(&stat, MPI_BYTE, &recvcount); TAU_TRACE_RECVMSG(stat.MPI_TAG, stat.MPI_SOURCE, recvcount); }
Fortran :
call TAU_TRACE_RECVMSG(tag, source, length) call TAU_TRACE_SENDMSG(tag, destination, length)
TAU_PROFILE_PARAM1L
Creates a snapshot of the current apllication profile
C/C++:
TAU_PROFILE_PARAM1L
long number
char* name
Fortran:
TAU_PROFILE_PARAM1L
char* name
integer number
integer length
Track the a given numerial parameter to a function and records each value as a seperate event. number
is the parameter to be tracked. name
is the name of this event.
C/C++: ---- int f1(int x) { TAU_PROFILE("f1()", "", TAU_USER); TAU_PROFILE_PARAM1L((long) x, "x"); … ---- Fortran: ---- subroutine ITERATION(val) integer val integer profiler(2) / 0, 0 / save profiler call TAU_PROFILE_TIMER(profiler, 'INTERATION') call TAU_PROFILE_START(profiler) call TAU_PROFILE_PARAM1L('value', val, 4) …. call TAU_PROFILE_STOP(profiler) return end ----
TAU_PROFILE_SNAPSHOT
Creates a snapshot of the current apllication profile
C/C++:
TAU_PROFILE_SNAPSHOT
char* name
Fortran:
TAU_PROFILE_SNAPSHOT
char* name
integer length
TAU_PROFILE_SNAPSHOT
writes a snapshot profile representing the program’s execution up to this point. These file are written the system as snapshot.[node].[context].[thread] format. They can be merged by appending one to another. Uploading a snapshot to a PerfDMF database or packing them into a PPK file will condense them to a single profile (the last one).
C/C++: ---- TAU_PROFILE_SNAPSHOT(name); ---- Fortran: ---- TAU_PROFILE_SNAPSHOT(name, length); ---- Python: ---- import pytau; pytau.snapshot("name") ----
TAU_PROFILE_SNAPSHOT_1L
Creates a snapshot of the current apllication profile
C/C++:
TAU_PROFILE_SNAPSHOT_1L
char* name
int number
Fortran:
TAU_PROFILE_SNAPSHOT_1L
char* name
integer number
integer length
Calls TAU_PROFILE_SNAPSHOT
giving it the as a name the name with a number appended.
TAU_PROFILER_CREATE
Creates a profiler object referenced as a standard pointer
C/C++:
TAU_PROFILER_CREATE
Timer timer
char* or string& function_name
char* or string& type
taugroup_t group
TAU_PROFILER_CREATE
creates a timer the that can be controlled by the Timer pointer object. The TAU_PROFILER_* API is intended for applications to easily layer their legacy timing measurements APIs on top of TAU, Unlike other TAU API calls (TAU_PROFILE_TIMER) that are statically expanded in the source code, these calls allocate TAU entities on the heap. So the pointer to the TAU timer may be used as a handle to access the TAU performance data.
C/C++:
void *ptr; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr);
Python:
import pytau ptr = pytau.profileTimer("foo") pytau.start(ptr) foo(2) pytau.stop(ptr)
TAU_CREATE_TASK
Creates a task id.
C/C++:
TAU_CREATE_TASK
Integer taskid
TAU_CREATE_TASK
creates a task with id 'taskid' this task is an independent event stream for which Profiler objects can be started and stop on. TAU will increment the taskids as needed an write out profiles and traces from the task as if they were thread.
C/C++:
void *ptr; int taskid; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_CREATE_TASK(taskid); TAU_PROFILER_START_TASK(ptr,taskid); foo(2); TAU_PROFILER_STOP_TASK(ptr,taskid);
TAU_PROFILER_START
starts a profiler object created by
C/C++:
TAU_PROFILER_START
Timer timer
TAU_PROFILER_START
starts a profiler timer by passing the pointer created by the TAU_PROFILER_CREATE .
C/C++:
void *ptr; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr);
Python:
import pytau ptr = pytau.profileTimer("foo") pytau.start(ptr) foo(2) pytau.stop(ptr)
TAU_PROFILER_START_TASK
Starts a profiler object created by
C/C++:
TAU_PROFILER_START_TASK
Timer timer
TAU_PROFILER_START_TASK
starts a profiler timer on a task by passing the pointer created by the TAU_PROFILER_CREATE and a task created by TAU_CREATE_TASK on a given task.
C/C++:
void *ptr; int taskid; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_CREATE_TASK(taskid); TAU_PROFILER_START_TASK(ptr,taskid); foo(2); TAU_PROFILER_STOP_TASK(ptr,taskid);
TAU_PROFILER_STOP
stops a profiler object created by
C/C++:
TAU_PROFILER_STOP
Timer timer
TAU_PROFILER_STOP
stops a profiler timer by passing the pointer created by the TAU_PROFILER_CREATE .
C/C++:
void *ptr; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr);
Python:
import pytau ptr = pytau.profileTimer("foo") pytau.start(ptr) foo(2) pytau.stop(ptr)
TAU_PROFILER_STOP_TASK
Stops a profiler object on a task
C/C++:
TAU_PROFILER_STOP_TASK
Timer timer
TAU_PROFILER_STOP_TASK
STOPs a profiler timer on a task by passing the pointer created by the TAU_PROFILER_CREATE and a task created by TAU_CREATE_TASK .
C/C++:
void *ptr; int taskid; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_CREATE_TASK(taskid); TAU_PROFILER_START_TASK(ptr,taskid); foo(2); TAU_PROFILER_STOP_TASK(ptr,taskid);
TAU_PROFILER_GET_CALLS
Gets the number of times this timer, created by
C/C++:
TAU_PROFILER_GET_CALLS
Timer timer
long& calls
TAU_PROFILER_GET_CALLS
returns the number of times this timer is started (ie. The number of times the section of code being profiled was executed).
C/C++:
void *ptr; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_PROFILER_START(ptr); foo(2); long calls; TAU_PROFILER_GET_CALLS(ptr, &calls);
TAU_PROFILER_GET_CALLS_TASK
Gets the number of times this timer, created by
C/C++:
TAU_PROFILER_GET_CALLS_TASK
Timer timer
long& calls
int taskid
TAU_PROFILER_GET_CALLS_TASK
returns the number of times this timer is started (ie. The number of times the section of code being profiled was executed) on a given task.
C/C++:
void *ptr; int taskid; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_CREATE_TASK(taskid); TAU_PROFILER_START_TASK(ptr, taskid); foo(2); long calls; TAU_PROFILER_GET_CALLS_TASK(ptr, &calls, taskid);
TAU_PROFILER_GET_CHILD_CALLS
Gets the number of calls made while this timer was running
C/C++:
TAU_PROFILER_GET_CHILD_CALLS
Timer timer
long& calls
TAU_PROFILER_GET_CHILD_CALLS
Gets the number of timers started while timer
was running. This is non-recursive, only timers started directly count.
C/C++:
void *ptr; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr); long calls; TAU_PROFILER_GET_CHILD_CALLS(ptr, &calls);
TAU_PROFILER_GET_CHILD_CALLS_TASK
Gets the number of child call for this timer, created by
C/C++:
TAU_PROFILER_GET_CHILD_CALLS_TASK
Timer timer
long& child_calls
int taskid
TAU_PROFILER_GET_CHILD_CALLS_TASK
returns the number of times this timer is started (ie. The number of times the section of code being profiled was executed).
C/C++:
void *ptr; int taskid; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_CREATE_TASK(taskid); TAU_PROFILER_START_TASK(ptr, taskid); foo(2); long child_calls; TAU_PROFILER_GET_CHILD_CALLS_TASK(ptr, &child_calls, taskid);
TAU_PROFILER_GET_INCLUSIVE_VALUES
Returns the inclusive amount of a metric spend by this timer.
C/C++:
TAU_PROFILER_GET_INCLUSIVE_VALUES
Timer timer
double& incl
TAU_PROFILER_GET_INCLUSIVE_VALUES
Returns the inclusive amount of a metric spend while this timer was running (and any subsequent timers called from this timer.)
C/C++:
void *ptr; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr); double incl[TAU_MAX_COUNTERS]; TAU_PROFILER_GET_INCLUSIVE_VALUES(ptr, &incl);
TAU_PROFILER_GET_INCLUSIVE_VALUES_TASK
Returns the inclusive amount of a metric spend by this timer on a given task.
C/C++:
TAU_PROFILER_GET_INCLUSIVE_VALUES_TASK
Timer timer
double& incl
int taskid
TAU_PROFILER_GET_INCLUSIVE_VALUES_TASK
Returns the inclusive amount of a metric spend while this timer was running (and any subsequent timers called from this timer) on a given task.
C/C++:
void *ptr; int taskid; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_CREATE_TASK(taskid); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr); double incl[TAU_MAX_COUNTERS]; TAU_PROFILER_GET_INCLUSIVE_VALUES_TASK(ptr, &incl, taskid);
TAU_PROFILER_GET_EXCLUSIVE_VALUES
Returns the exclusive amount of a metric spend by this timer.
C/C++:
TAU_PROFILER_GET_EXCLUSIVE_VALUES
Timer timer
double& excl
TAU_PROFILER_GET_EXCLUSIVE_VALUES
Returns the exclusive amount of the metric spend while this timer was running (and while no other subsequent timers was running.)
C/C++:
void *ptr; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr); double excl[TAU_MAX_COUNTERS]; TAU_PROFILER_GET_EXCLUSIVE_VALUES(ptr, &excl);
TAU_PROFILER_GET_EXCLUSIVE_VALUES_TASK
Returns the exclusive amount of a metric spend by this timer on a given task.
C/C++:
TAU_PROFILER_GET_EXCLUSIVE_VALUES_TASK
Timer timer
double& excl
int taskid
TAU_PROFILER_GET_EXCLUSIVE_VALUES_TASK
Returns the exclusive amount of the metric spend while this timer was running (and while no other subsequent timers was running) on a given task.
C/C++:
void *ptr; int taskid; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_CREATE_TASK(taskid); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr); double excl[TAU_MAX_COUNTERS]; TAU_PROFILER_GET_EXCLUSIVE_VALUES_TASK(ptr, &excl, taskid);
TAU_PROFILER_GET_COUNTER_INFO
Returns information about all the timers created.
C/C++:
TAU_PROFILER_GET_COUNTER_INFO
const char * counters
int &num_counters
TAU_PROFILER_GET_COUNTER_INFO
Gets the number of counters created and an array of the counters containing information about the counters.
C/C++:
void *ptr; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_PROFILER_START(ptr); foo(2); TAU_PROFILER_STOP(ptr); const char **counters; int numcounters; TAU_PROFILER_GET_COUNTER_INFO(&counters, &numcounters); printf("numcounters = %d\n", numcounters); for (j = 0; j < numcounters ; j++) { printf(">>>"); printf("counter [%d] = %s\n", j, counters[j]); }
TAU_PROFILER_GET_COUNTER_INFO_TASK
Returns information about all the timers created on a task.
C/C++:
TAU_PROFILER_GET_COUNTER_INFO_TASK
const char * counters
int &num_counters
int taskid
TAU_PROFILER_GET_COUNTER_INFO_TASK
Gets the number of counters created and an array of the counters containing information about the counters on a given task.
C/C++:
void *ptr; int taskid; TAU_PROFILER_CREATE(ptr, "foo","", TAU_USER); TAU_CREATE_TASK(taskid); TAU_PROFILER_START_TASK(ptr, taskid); foo(2); TAU_PROFILER_STOP_TASK(ptr, taskid); const char **counters; int numcounters; TAU_PROFILER_GET_COUNTER_INFO_TASK(&counters, &numcounters, taskid); printf("numcounters = %d\n", numcounters); for (j = 0; j < numcounters ; j++) { printf(">>>"); printf("counter [%d] = %s\n", j, counters[j]); }
TAU_QUERY_DECLARE_EVENT
Returns a event handle.
C/C++:
TAU_QUERY_DECLARE_EVENT
void * event
TAU_QUERY_DECLARE_EVENT
Creates a event handle for querying TAU events.
C/C++:
char[100] str; TAU_QUERY_DECLARE_EVENT(event); TAU_QUERY_GET_CURRENT_EVENT(event); TAU_QUERY_GET_EVENT_NAME(event, str); printf("current event is: %d.\n", str);
TAU_QUERY_GET_CURRENT_EVENT
set event to be the current TAU event.
C/C++:
TAU_QUERY_GET_CURRENT_EVENT
void * event
TAU_QUERY_GET_CURRENT_EVENT
Set event to be the current TAU event in the context in which this call is made.
C/C++:
char[100] str; TAU_QUERY_DECLARE_EVENT(event); TAU_QUERY_GET_CURRENT_EVENT(event); TAU_QUERY_GET_EVENT_NAME(event, str); printf("current event is: %d.\n", str);
TAU_QUERY_GET_EVENT_NAME
Gets the name of a given event.
C/C++:
TAU_QUERY_GET_EVENT_NAME
void * event
char * str
TAU_QUERY_GET_EVENT_NAME
Set str to be the event name to the given event name.
C/C++:
char[100] str; TAU_QUERY_DECLARE_EVENT(event); TAU_QUERY_GET_CURRENT_EVENT(event); TAU_QUERY_GET_EVENT_NAME(event, str); printf("current event is: %d.\n", str);
TAU_QUERY_GET_PARENT_EVENT
gets the parent of the current event.
C/C++:
TAU_QUERY_GET_PARENT_EVENT
void * event
TAU_QUERY_GET_PARENT_EVENT
Set event to be the parent event to the current event.
C/C++:
char[100] str; TAU_QUERY_DECLARE_EVENT(event); TAU_QUERY_GET_PARENT_EVENT(event); TAU_QUERY_GET_EVENT_NAME(event, str); printf("parent event is: %d.\n", str);