Tutorial

Instrumenting the sources for Selective Profiling

Functions can be grouped to form a profiling group. Profiling groups can be enabled at runtime to selectively profile functions. While instrumenting the source code, each function is uniquely associated with a profiling group.

Adding Instrumentation

Applications are profiled using the Profiling API.
TAU_PROFILE(char *func_name, char *type_info, uint profile_group);
TAU_TYPE_STRING(string_varname, cstring& str);
TAU_PROFILE_TIMER(var, name, type, group);
TAU_PROFILE_START(var);
TAU_PROFILE_STOP(var);
TAU_PROFILE_STMT(stmt);
TAU_PROFILE_INIT(argc, argv);
TAU_PROFILE_SET_NODE(myNode);
TAU_PROFILE_EXIT(const char *message);

Each profile group has a string associated with it to allow us to identify the profile group at runtime.
Note; The top level function (main) in each thread has to be associated with the profile group TAU_DEFAULT . This ensures that it is always profiled.
The profile_group argument can be one of the values given below.

ProfileGroup Description Runtime Identifier Example
TAU_DEFAULT All profiling groups enabled --profile
TAU_MESSAGE Message Class includes MPI, PVM, ACLMPL 'm' --profile M
TAU_PETE PETE 'p' --profile pete+message
TAU_VIZ ACLVIZ 'v' --profile Pete+viz
TAU_ASSIGN Assign Expression 'a' --profile a+m
TAU_IO IO functions 'i' --profile io
TAU_FIELD Field functions 'f' --profile field+viz+assign
TAU_LAYOUT Field Layout 'l' --profile layout
TAU_SPARSE Sparse Index 's' --profile sparse+assign
TAU_DOMAINMAP Domain Map 'd' --profile i+d+viz
TAU_UTILITY Utility 'ut' --profile utils+io
TAU_REGION Region 'r' --profile r+ut+a+m
TAU_SUBFIELD SubField 'su' --profile r+subfield
TAU_MESHES Meshes 'mesh' --profile sub+Message+meshes
TAU_PARTICLE Particle 'pa' --profile sub+particle
TAU_FFT FFT 'ff' --profile sub+fft
TAU_USER User 'u' --profile user+region
TAU_USER1 User1 '1' --profile 1+d
TAU_USER2 User2 '2' --profile 2+d
TAU_USER3 User3 '3' --profile 3+d
TAU_USER4 User4 '4' --profile 4+d

Running the Profiled Application

As shown in the examples column in the above table enable one or more options.
% mpirun -np 4 volley --commlib mpi --profile message+A+Utility