OpenCMISS-Iron Internal API Documentation
Advanced TAU

Additional Implementation

Using the TAU API, it is very simple to profile a block of code. This involves placing a pair of calls around the code you want to profile. An example is given below.

CALL TAU_STATIC_PHASE_START('CMISSGenericFunction')
CALL CMISSGenericFunction()
CALL TAU_STATIC_PHASE_STOP('CMISSGenericFunction')

In the case of OpenCMISS, pairs of #ifdef TAUPROF and #endif directives need to be added around every TAU call or group of TAU calls, so that the compiler knows to remove these if TAUPROF isnt set. An example of this is given below. An example of a profile start call in OpenCMISS can be found in CMISSInitialiseObj. Likewise, the corresponding profile stop call can be found in CMISSFinalise.

#ifdef TAUPROF
CALL TAU_STATIC_PHASE_START('CMISSGenericFunction')
#endif
CALL CMISSGenericFunction()
#ifdef TAUPROF
CALL TAU_STATIC_PHASE_STOP('CMISSGenericFunction')
#endif

When calls are nested, a hierarchical structure forms and profile data can be view by viewing each phase as the sum of its child phases. However, be careful not to overlap these calls as this will cause errors within TAU. An example of this is given below.

CALL TAU_STATIC_PHASE_START('CMISSGenericFunction')
CALL TAU_STATIC_PHASE_START('Next Phase')
CALL CMISSGenericFunction()
CALL TAU_STATIC_PHASE_STOP('CMISSGenericFunction')
CALL TAU_STATIC_PHASE_STOP('Next Phase')

About 150 calls of this format are currently present in OpenCMISS, but all scenarios have not been captured. If you encounter unallocated time (time allocated to the parent phase), this will likely be because functions you have used which have not been implemented with TAU and you will need to implement these types of TAU calls in these functions yourself (usually in opencmiss.f90).

Dynamic Phases

Dynamic phases allow the user to embed loop counters in the phase name. This is useful if you want to compare time spent in each loop or time spent in a routine across each iteration. An example of this is given below. An example of this can be found in OpenCMISS in LaplaceEquation_FiniteElementCalculate.

CHARACTER(13) :: CVAR
INTEGER :: LOOP_PHASE(2) = (/ 0, 0 /)
SAVE LOOP_PHASE
DO n=1,Total_Iterations
WRITE (CVAR,'(a11,i2)') 'Iteration ',n
CALL TAU_PHASE_CREATE_DYNAMIC(LOOP_PHASE,CVAR)
CALL TAU_PHASE_START(LOOP_PHASE)
CALL CMISSGenericFunction()
CALL TAU_PHASE_START(LOOP_PHASE)
ENDDO

Memory Tracking

TAU allows you to sample memory use at points within your code. Unfortunately, you can not label calls. This means that you can not view how your memory usage changes through your code. You can do this roughly however by just calling the memory tracking function once.

CALL TAU_TRACK_MEMORY_HERE()

The memory information is found at the end of the pprof output. Run pprof in the same location you would run paraprof as described in the Visualisation section.

pprof