Table of Contents
- 1. Measurement APIs
-
- 1.1. TAU_PROFILE(function_name, type, group);
- 1.2. TAU_PROFILE_TIMER(timer, name, type, group);
- 1.3. TAU_PROFILE_START(timer);
- 1.4. TAU_PROFILE_STOP(timer);
- 1.5. TAU_PROFILE_TIMER_DYNAMIC(var, name, type, group);
- 1.6. TAU_PROFILE_CREATE_TIMER(var, name, type, group);
- 1.7. TAU_PROFILE_DECLARE_TIMER(var);
- 1.8. TAU_GLOBAL_TIMER(timer, name, type, group);
- 1.9. TAU_GLOBAL_TIMER_EXTERNAL(timer)
- 1.10. TAU_GLOBAL_TIMER_START(timer);
- 1.11. TAU_GLOBAL_TIMER_STOP(timer);
- 1.12. TAU_PHASE(name, type, group);
- 1.13. TAU_PHASE_CREATE_DYNAMIC(var, name, type, group);
- 1.14. TAU_PHASE_CREATE_STATIC(var, name, type, group);
- 1.15. TAU_PHASE_START(var);
- 1.16. TAU_PHASE_STOP(var);
- 1.17. TAU_GLOBAL_PHASE(timer, name, type, group)
- 1.18. TAU_GLOBAL_PHASE_EXTERNAL(timer)
- 1.19. TAU_GLOBAL_PHASE_START(timer)
- 1.20. TAU_GLOBAL_PHASE_STOP(timer)
- 1.21. TAU_PROFILE_EXIT(message);
- 1.22. TAU_REGISTER_THREAD();
- 1.23. TAU_PROFILE_SET_NODE(myNode);
- 1.24. TAU_REGISTER_FORK(nodeid, option);
- 1.25. TAU_PROFILE_SET_CONTEXT(myContext);
- 1.26. TAU_REGISTER_EVENT(variable, event_name);
- 1.27. TAU_EVENT(variable, value);
- 1.28. TAU_REGISTER_CONTEXT_EVENT(variable, event_name)
- 1.29. TAU_CONTEXT_EVENT(event, data)
- 1.30. TAU_ENABLE_CONTEXT_EVENT(event);
- 1.31. TAU_DISABLE_CONTEXT_EVENT(event)
- 1.32. TAU_EVENT_SET_NAME(event,name)
- 1.33. TAU_EVENT_DISABLE_MAX(event)
- 1.34. TAU_EVENT_DISABLE_MEAN(event)
- 1.35. TAU_EVENT_DISABLE_MIN(event)
- 1.36. TAU_EVENT_DISABLE_STDDEV(event)
- 1.37. TAU_REPORT_STATISTICS();
- 1.38. TAU_REPORT_THREAD_STATISTICS();
- 1.39. TAU_ENABLE_INSTRUMENTATION();
- 1.40. TAU_DISABLE_INSTRUMENTATION()
- 1.41. TAU_ENABLE_GROUP(group);
- 1.42. TAU_DISABLE_GROUP(group);
- 1.43. TAU_PROFILE_TIMER_SET_GROUP(t, group)
- 1.44. TAU_PROFILE_TIMER_SET_GROUP_NAME(timer, groupname);
- 1.45. TAU_PROFILE_TIMER_SET_NAME(t, newname)
- 1.46. TAU_PROFILE_TIMER_SET_TYPE(t, newtype)
- 1.47. TAU_PROFILE_SET_GROUP_NAME(groupname);
- 1.48. TAU_INIT(argc, argv);
- 1.49. TAU_PROFILE_INIT(argc, argv);
- 1.50. TAU_GET_PROFILE_GROUP(groupname);
- 1.51. TAU_ENABLE_GROUP_NAME(groupname);
- 1.52. TAU_DISABLE_GROUP_NAME(groupname);
- 1.53. TAU_ENABLE_ALL_GROUPS();
- 1.54. TAU_DISABLE_ALL_GROUPS();
- 1.55. TAU_GET_EVENT_NAMES(eventList, numEvents);
- 1.56. TAU_GET_EVENT_VALS(v1, v2, v3, v4, v5, v6, v7);
- 1.57. TAU_GET_COUNTER_NAMES(counterList, numCounters);
- 1.58. TAU_GET_FUNC_NAMES(functionList, numFuncs);
- 1.59. TAU_GET_FUNC_VALS(inFuncs, numRoutines, counterExclusiveValues, counterInclusiveValues, numCalls, numSubrs, counterNames, numOfCounters);
- 1.60. TAU_ENABLE_TRACKING_MEMORY()
- 1.61. TAU_DISABLE_TRACKING_MEMORY()
- 1.62. TAU_TRACK_MEMORY()
- 1.63. TAU_TRACK_MEMORY_HERE()
- 1.64. TAU_ENABLE_TRACKING_MEMORY_HEADROOM()
- 1.65. TAU_DISABLE_TRACKING_MEMORY_HEADROOM()
- 1.66. TAU_TRACK_MEMORY_HEADROOM()
- 1.67. TAU_TRACK_MEMORY_HEADROOM_HERE()
- 1.68. TAU_SET_INTERRUPT_INTERVAL(value)
- 1.69. string& CT(variable);
- 1.70. TAU_TYPE_STRING(variable, type_string);
- 1.71. TAU_DB_DUMP()
- 1.72. TAU_DB_DUMP_INCR();
- 1.73. TAU_DB_DUMP_PREFIX(prefix);
- 1.74. TAU_DB_PURGE()
- 1.75. TAU_DUMP_FUNC_NAMES();
- 1.76. TAU_DUMP_FUNC_VALS(inFuncs, numFuncs);
- 1.77. TAU_DUMP_FUNC_VALS_INCR(inFuncs, numFuncs);
- 1.78. TAU_PROFILE_STMT(statement);
- 1.79. TAU_PROFILE_CALLSTACK();
- 1.80. TAU_TRACE_RECVMSG(tag, source, length);
- 1.81. TAU_TRACE_SENDMSG(tag, destination, length);
- 1.82. TAU_ENABLE_TRACKING_MUSE_EVENTS()
- 1.83. TAU_DISABLE_TRACKING_MUSE_EVENTS()
- 1.84. TAU_TRACK_MUSE_EVENTS()
- 2. TAU Mapping API
-
- 2.1. TAU_MAPPING(statement, key);
- 2.2. TAU_MAPPING_CREATE(name, type, key, groupname, tid);
- 2.3. TAU_MAPPING_LINK(FuncIdVar, Key);
- 2.4. TAU_MAPPING_OBJECT(FuncIdVar);
- 2.5. TAU_MAPPING_PROFILE (FuncIdVar);
- 2.6. TAU_MAPPING_PROFILE_START(timer, tid);
- 2.7. TAU_MAPPING_PROFILE_STOP(tid);
- 2.8. TAU_MAPPING_PROFILE_TIMER(timer, FuncIdVar);
- 3. Summary
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 <Profile/Profiler.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 using
TAU_PROFILE_TIMER()
macro with
TAU_PROFILE_START()
and
TAU_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 the
TAU_PROFILE_TIMER()
macro after all the variables
have been declared in the function and before the execution of the first
C statement.
Example:
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; }
Fortran90
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.
Arguments:
char *function_name or string& function_name
char *type_name or string& type
TauGroup_t group
With TAU_PROFILE
, the function
function_name
is profiled. TAU_PROFILE
identifies the function uniquely by the combination of its name and type
parameters. Each function is also associated with the group specified.
This information can selectively enable or disable instrumentation in a
set of profile groups. A function that belongs to the
TAU_DEFAULT
group is always profiled. Other user
defined groups are
TAU_USER, TAU_USER1, TAU_USER2, TAU_USER3, TAU_USER4
. The top level function in any thread must be
profiled using the TAU_DEFAULT
group. For details on
using selective instrumentation, please refer to the section Running the
application in Chapter 4.
Example:
int main(int argc, char **argv) { TAU_PROFILE(main()","int (int, char **)",TAU_DEFAULT);
Arguments:
Profiler timer;
char *name or string& name;
char *type or string& type;
TauGroup_t group;
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.
Example: template< class T, unsigned Dim > void BareField<T,Dim>::fillGuardCells(bool reallyFill) { // 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);
Arguments:
integer profiler(2)
character name(size)
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. Example:
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')
Arguments:
Profiler timer;
The macro TAU_PROFILE_START
starts the timer associated with the set of statements that are to be profiled.
Arguments:
Profiler timer;
The macro TAU_PROFILE_STOP
stops the 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.
Example:
template< class T, unsigned Dim > void BareField<T,Dim>::fillGuardCells(bool reallyFill) { // 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); // ... TAU_PROFILE_START(sendtimer); // set up messages to be sent Message** mess = new Message*[nprocs]; int iproc; for (iproc=0; iproc<nprocs; ++iproc) { mess[iproc] = NULL; recvmsg[iproc] = false; }//... other code TAU_PROFILE_STOP(sendtimer); ... }
Arguments:
integer profiler(2)
TAU_PROFILE_STOP
stops the timer used to
profile a set of statements. It is used in conjunction with
TAU_PROFILE_TIMER
and
TAU_PROFILE_START
subroutines.
Example:
subroutine setbv implicit none include 'applu.incl' c-------------------------------------------------- c local variables c-------------------------------------------------- integer profiler(2) save profiler integer i, j, k integer iglob, jglob call TAU_PROFILE_TIMER(profiler, 'setbv') call TAU_PROFILE_START(profiler) c set the dependent variable values along the top and c bottom faces do j = 1, ny jglob = jpt + j do i = 1, nx iglob = ipt + i call exact( iglob, jglob, 1, u( 1, i, j, 1 ) ) call exact( iglob, jglob, nz, u( 1, i, j, nz )) end do end do call TAU_PROFILE_STOP(profiler) return end
Arguments:
Profiler timer;
string name, 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
in the same file.
Arguments:
Profiler timer;
TAU_GLOBAL_TIMER_START
starts the timer. The timer in this case is declared in the file scope.
Arguments:
Profiler timer;
(ARGUMENT USE DEPRECATED?)
TAU_GLOBAL_TIMER_STOP
stops the timer which is declared in the file scope.
Example:
TAU_GLOBAL_TIMER(looptimer, "Loops in foo.cpp", " ", TAU_USER); void foo() { TAU_GLOBAL_TIMER_START(looptimer); for (i=0; i<N; i++) { /* do something */ } TAU_GLOBAL_TIMER_STOP(looptimer); } void bar() { TAU_GLOBAL_TIMER_START(looptimer); for(j=0; j<N; j++) { /* do something */ } TAU_GLOBAL_TIMER_STOP(looptimer); }
Argument:
const char * message;
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.
Example
if ((ret = open(...)) < 0) { TAU_PROFILE_EXIT("ERROR in opening a file"); perror("open() failed"); exit(1); }
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.
Arguments:
int myNode;
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>.
Arguments:
int nodeid;
enum TauFork_t option;
/* TAU_INCLUDE_PARENT_DATA or TAU_EXCLUDE_PARENT_DATA*/
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.
Example:
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); }
Argument:
int myContext;
TAU_PROFILE_SET_CONTEXT
sets the context
parameter of the executing task for profiling and tracing purposes. This
is similar to setting the node parameter with
TAU_PROFILE_SET_NODE
.
Arguments:
TauUserEvent & variable;
char * event_name;
TAU can profile user-defined events using TAU_REGISTER_EVENT
. The meaning of the event is determined by the user.
Arguments:
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.
Example:
integer eventid(2) save eventid call TAU_REGISTER_EVENT(eventid, 'Error in Iteration')
Arguments: TauUserEvent & variable;
double value;
TAU_EVENT
associates a value with some
user-defined event. When the event is triggered and this macro is
executed, TAU maintains statistics, such as maximum, minimum values,
standard deviation, number of samples, etc. for tracking this
event.
Example:
int ArraySend(int arrayid) { TAU_REGISTER_EVENT(taumsgsize, \ "Size of message associated with Arrays"); int size = GetArraySize(arrayid); TAU_EVENT(size); // ... }
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.
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.
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.
Example:
main() { foo(); TAU_DISABLE_INSTRUMENTATION(); for (int i =0; i < N; i++) { bar(); // not recorded } TAU_ENABLE_INSTRUMENTATION(); bar(); // recorded }
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.
Arguments:
TauGroup_t group;
TAU_ENABLE_GROUP
macro turns on instrumentation in all routines associated with the profile group.
Example
void foo() { TAU_PROFILE("foo()", " ", TAU_USER); ... TAU_ENABLE_GROUP(TAU_USER); }
Arguments:
TauGroup_t group;
TAU_DISABLE_GROUP
macro turns off instrumentation in all routines associated with the profile group.
Examples:
void foo() { TAU_PROFILE("foo()", " ", TAU_USER); ... TAU_DISABLE_GROUP(TAU_USER); }
Arguments:
Profiler t;
TauGroup_t group;
TAU_PROFILE_TIMER_SET_GROUP
changes the group associated with a timer.
Example:
void foo() { TAU_PROFILE_TIMER(t, "foo loop timer", " ", TAU_USER1); ... TAU_PROFILE_TIMER_SET_GROUP(t, TAU_USER3); }
(C++ Only)
Arguments:
Profiler timer;
char *groupname;
TAU_PROFILE_TIMER_SET_GROUP_NAME
changes the group name associated with a given timer.
Example:
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"); }
(C++ Only)
Arguments:
Profiler timer;
string newname;
TAU_PROFILE_TIMER_SET_NAME
macro changes the name associated with a timer to the newname argument.
Example:
void foo() { TAU_PROFILE_TIMER(timer1, "foo:loop1", " ", TAU_USER); ... TAU_PROFILE_TIMER_SET_NAME(timer1, "foo:lines 21-34"); }
(C++ Only)
Arguments:
Profiler t;
string newtype;
This macro changes the type string associated with the timer. Similar to TAU_PROFILE_TIMER_SET_NAME
.
(C++ Only)
Arguments:
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++ Only)
void foo() { TAU_PROFILE("foo()", "void ()", TAU_USER); TAU_PROFILE_SET_GROUP_NAME("Particle"); /* gives a more meaningful group name */ }
Arguments:
int argc;
char **argv;
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.
Example:
int main(int argc, char **argv){ TAU_PROFILE("main()", "int (int, char **)", TAU_DEFAULT); TAU_PROFILE_INIT(argc, argv); ... }
Argument:
None
TAU_PROFILE_INIT
routine must be called
before any other TAU instrumentation routines. It is called once, in the
top level routine (program). It initializes the TAU library.
Example:
Example: PROGRAM SUM_OF_CUBES integer profiler(2) save profiler call TAU_PROFILE_INIT()
Arguments:
string 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.
Example:
#define PARTICLES TAU_GET_GROUP("PARTICLES") void foo() { TAU_PROFILE("foo()", " ", PARTICLES); } void bar() { TAU_PROFILE("bar()", " ", PARTICLES); }
Arguments:
string groupname;
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.
Arguments:
string groupname;
Similar to TAU_ENABLE_GROUP_NAME
, this macro turns off the instrumentation in all routines associated with the dynamic group created using TAU_GET_PROFILE_GROUP.
Example:
#define PARTICLES TAU_GET_PROFILE_GROUP("PARTICLES"); void foo() { TAU_DISABLE_GROUP_NAME("PARTICLES"); /* after some work */ TAU_ENABLE_GROUP_NAME("PARTICLES"); }
This macro turns off instrumentation in all groups.
Examples:
void foo() { TAU_DISABLE_ALL_GROUPS(); TAU_ENABLE_GROUP_NAME("PARTICLES"); }
Arguments:
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.
Arguments:
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.
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.
Examples:
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();
Arguments:
<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.
Arguments:
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.
Example:
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)"
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.
Arguments:
char *prefix;
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.
This macro writes the names of active functions to a file named dump_functionnames_<node>.<context>.
Arguments:
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.
Arguments:
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_dump__Thu-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).
Arguments:
statement;
TAU_PROFILE_STMT
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.
Example:
TAU_PROFILE_STMT(T obj;); // T is a template parameter) TAU_TYPE_STRING(str, "void () " + CT(obj) );
Arguments:
int tag;
int source;
int length;
TAU_TRACE_RECVMSG
traces a receive operation where tag represents the type of the message received from the source process.
Example:
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); }
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.
Arguments:
int tag;
int destination;
int length;
TAU_TRACE_SENDMSG
traces an inter-process message communication when a tagged message is sent to a destination process.