Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
Data Structures | Macros
hit_utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HitClock
 
struct  HitCounter
 

Macros

#define hit_clockSynchronize(lay)   MPI_Barrier((lay).topo.pTopology->comm)
 
#define hit_clockSynchronizeAll()   MPI_Barrier( MPI_COMM_WORLD );
 
#define HIT_CLOCK_RUNNING   0
 
#define HIT_CLOCK_STOPPED   1
 
#define hit_clockReset(c)
 
#define hit_clockStart(c)
 
#define hit_clockMaxReduce(topo, c)
 
#define hit_clockStop(c)
 
#define hit_clockContinue(c)
 
#define hit_clockIsRunning(c)   ( c.state == HIT_CLOCK_RUNNING )
 
#define hit_clockReduce(lay, c)
 
#define hit_clockWorldReduce(c)
 
#define hit_clockPrint(c)
 
#define hit_clockPrintMax(c)
 
#define hit_clockPrintMin(c)
 
#define hit_clockPrintAvg(c)
 
#define hit_clockGetSeconds(c)   (c.seconds)
 
#define hit_clockGetMaxSeconds(c)   (c.max)
 
#define hit_clockGetMinSeconds(c)   (c.min)
 
#define hit_clockGetAvgSeconds(c)   (c.avg)
 
#define hit_counterValue(c)   ((c).value)
 
#define hit_counterReset(c)   (c).value = 0
 
#define hit_counterAdd(c, value)   (c).value += (value)
 
#define hit_counterInc(c)   (c).value++
 
#define hit_counterDec(c)   (c).value--
 
#define hit_counterReduce(lay, c)
 
#define hit_counterWorldReduce(c)
 
#define hit_counterPrint(c)
 
#define hit_counterPrintMax(c)
 
#define hit_counterPrintMin(c)
 
#define hit_counterPrintSum(c)
 
#define hit_counterPrintAvg(c)
 
#define hit_counterMax(c)   (c.max)
 
#define hit_counterMin(c)   (c.min)
 
#define hit_counterSum(c)   (c.sum)
 
#define hit_counterAvg(c)   (c.avg)
 

Detailed Description

Functions to manipulate clocks and obtain times to measure codes.

Version
1.1
Author
Arturo Gonzalez-Escribano
Javier Fresno Bausela
Carlos de Blas Carton
Date
May 2012

Definition in file hit_utils.h.

Macro Definition Documentation

#define HIT_CLOCK_RUNNING   0

Clock state running.

Definition at line 70 of file hit_utils.h.

#define HIT_CLOCK_STOPPED   1

Clock state stopped.

Definition at line 72 of file hit_utils.h.

#define hit_clockContinue (   c)
Value:
{ \
c.seconds = MPI_Wtime() - c.seconds; \
c.state = HIT_CLOCK_RUNNING; \
}
#define HIT_CLOCK_RUNNING
Definition: hit_utils.h:70

The clock continues measuring time and the time is updated with the start time. The time between hit_clockStop and this function is not measured.

Parameters
cclock

Definition at line 121 of file hit_utils.h.

#define hit_clockGetAvgSeconds (   c)    (c.avg)

Definition at line 193 of file hit_utils.h.

#define hit_clockGetMaxSeconds (   c)    (c.max)

Definition at line 191 of file hit_utils.h.

#define hit_clockGetMinSeconds (   c)    (c.min)

Definition at line 192 of file hit_utils.h.

#define hit_clockGetSeconds (   c)    (c.seconds)

Gets the seconds of a clock

Parameters
cclock

Definition at line 190 of file hit_utils.h.

#define hit_clockIsRunning (   c)    ( c.state == HIT_CLOCK_RUNNING )

Returns true if the clock is running

Parameters
cclock

Definition at line 130 of file hit_utils.h.

#define hit_clockMaxReduce (   topo,
 
)
Value:
{ \
MPI_Reduce( &c.seconds, &c.buffer, 1, MPI_DOUBLE, \
MPI_MAX, 0, (topo).pTopology->comm ); \
c.seconds = c.buffer; \
}

All the processors from a topology make a reduction to get the maximun time of their respective clock. Processor number 0 gets the time inside its clock

Parameters
topotopology
cclock

Definition at line 98 of file hit_utils.h.

#define hit_clockPrint (   c)
Value:
{ \
if (hit_Rank==0) printf("HitClock_%s: %14.6lf\n", #c, c.seconds); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Prints a clock

Parameters
cclock

Definition at line 172 of file hit_utils.h.

#define hit_clockPrintAvg (   c)
Value:
{ \
if (hit_Rank==0) printf("HitClock_%s Avg: %14.6lf\n", #c, c.avg); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Definition at line 181 of file hit_utils.h.

#define hit_clockPrintMax (   c)
Value:
{ \
if (hit_Rank==0) printf("HitClock_%s Max: %14.6lf\n", #c, c.max); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Definition at line 175 of file hit_utils.h.

#define hit_clockPrintMin (   c)
Value:
{ \
if (hit_Rank==0) printf("HitClock_%s Min: %14.6lf\n", #c, c.min); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Definition at line 178 of file hit_utils.h.

#define hit_clockReduce (   lay,
 
)
Value:
{ \
MPI_Reduce( &c.seconds, &c.buffer, 1, MPI_DOUBLE, \
MPI_MAX, 0, (lay).pTopology[0]->comm ); \
c.max = c.buffer; \
MPI_Reduce( &c.seconds, &c.buffer, 1, MPI_DOUBLE, \
MPI_MIN, 0, (lay).pTopology[0]->comm ); \
c.min = c.buffer; \
MPI_Reduce( &c.seconds, &c.buffer, 1, MPI_DOUBLE, \
MPI_SUM, 0, (lay).pTopology[0]->comm ); \
c.avg = c.buffer / hit_layNumActives( lay ); \
}
int hit_layNumActives(HitLayout lay)
Definition: hit_layout.c:2213
HitLayout lay
Definition: heat.c:107

All the processors active in a layout make a reduction to get the maximun, minimum and average time of their respective clock. Processor number 0 gets the reduced times

Parameters
layHitLayout object
cclock

Definition at line 139 of file hit_utils.h.

#define hit_clockReset (   c)
Value:
{ \
c.seconds = 0.0; \
c.state = HIT_CLOCK_STOPPED; \
}
#define HIT_CLOCK_STOPPED
Definition: hit_utils.h:72

reset of a clock. The time is reset to 0.

Parameters
cclock

Definition at line 78 of file hit_utils.h.

#define hit_clockStart (   c)
Value:
{ \
c.seconds= MPI_Wtime(); \
c.state = HIT_CLOCK_RUNNING; \
}
#define HIT_CLOCK_RUNNING
Definition: hit_utils.h:70

The clock starts to measure time.

Parameters
cclock

Definition at line 87 of file hit_utils.h.

#define hit_clockStop (   c)
Value:
{ \
c.seconds= MPI_Wtime() - c.seconds; \
c.state = HIT_CLOCK_STOPPED; \
}
#define HIT_CLOCK_STOPPED
Definition: hit_utils.h:72

The clock stops to measure time. The seconds stored are the difference between the start of the clock and the call to this function.

Parameters
cclock

Definition at line 109 of file hit_utils.h.

#define hit_clockSynchronize (   lay)    MPI_Barrier((lay).topo.pTopology->comm)

hit_clockSynchronize: Synchronize the processors active in a layout.

Parameters
layoutHitLayout object.

Definition at line 51 of file hit_utils.h.

#define hit_clockSynchronizeAll ( )    MPI_Barrier( MPI_COMM_WORLD );

hit_clockSynchronize: Synchronize all the processors.

Definition at line 55 of file hit_utils.h.

#define hit_clockWorldReduce (   c)
Value:
{ \
MPI_Reduce( &c.seconds, &c.buffer, 1, MPI_DOUBLE, \
MPI_MAX, 0, MPI_COMM_WORLD ); \
c.max = c.buffer; \
MPI_Reduce( &c.seconds, &c.buffer, 1, MPI_DOUBLE, \
MPI_MIN, 0, MPI_COMM_WORLD ); \
c.min = c.buffer; \
MPI_Reduce( &c.seconds, &c.buffer, 1, MPI_DOUBLE, \
MPI_SUM, 0, MPI_COMM_WORLD ); \
c.avg = c.buffer / hit_NProcs; \
}
#define hit_NProcs
Definition: hit_com.h:142

Definition at line 156 of file hit_utils.h.

#define hit_counterAdd (   c,
  value 
)    (c).value += (value)

Add value to a counter.

Parameters
cCounter
valueValue

Definition at line 227 of file hit_utils.h.

#define hit_counterAvg (   c)    (c.avg)

Definition at line 307 of file hit_utils.h.

#define hit_counterDec (   c)    (c).value--

Decrement a counter

Parameters
cCounter

Definition at line 239 of file hit_utils.h.

#define hit_counterInc (   c)    (c).value++

Increment a counter

Parameters
cCounter

Definition at line 233 of file hit_utils.h.

#define hit_counterMax (   c)    (c.max)

Gets the reduced values of a counter

Parameters
ccounter

Definition at line 304 of file hit_utils.h.

#define hit_counterMin (   c)    (c.min)

Definition at line 305 of file hit_utils.h.

#define hit_counterPrint (   c)
Value:
{ \
if (hit_Rank==0) printf("HitCounter_%s: %010d\n", #c, c.value); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Prints a counter

Parameters
ccounter

Definition at line 283 of file hit_utils.h.

#define hit_counterPrintAvg (   c)
Value:
{ \
if (hit_Rank==0) printf("HitCounter_%s Avg: %010d\n", #c, c.avg); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Definition at line 295 of file hit_utils.h.

#define hit_counterPrintMax (   c)
Value:
{ \
if (hit_Rank==0) printf("HitCounter_%s Max: %010d\n", #c, c.max); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Definition at line 286 of file hit_utils.h.

#define hit_counterPrintMin (   c)
Value:
{ \
if (hit_Rank==0) printf("HitCounter_%s Min: %010d\n", #c, c.min); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Definition at line 289 of file hit_utils.h.

#define hit_counterPrintSum (   c)
Value:
{ \
if (hit_Rank==0) printf("HitCounter_%s Sum: %010d\n", #c, c.sum); \
}
#define hit_Rank
Definition: hit_com.h:140
#define s

Definition at line 292 of file hit_utils.h.

#define hit_counterReduce (   lay,
 
)
Value:
{ \
MPI_Reduce( &c.value, &c.buffer, 1, MPI_INT, \
MPI_MAX, 0, (lay).pTopology[0]->comm ); \
c.max = c.buffer; \
MPI_Reduce( &c.value, &c.buffer, 1, MPI_INT, \
MPI_MIN, 0, (lay).pTopology[0]->comm ); \
c.min = c.buffer; \
MPI_Reduce( &c.value, &c.buffer, 1, MPI_INT, \
MPI_SUM, 0, (lay).pTopology[0]->comm ); \
c.sum = c.buffer; \
c.avg = c.buffer / hit_layNumActives( lay ); \
}
int hit_layNumActives(HitLayout lay)
Definition: hit_layout.c:2213
HitLayout lay
Definition: heat.c:107

All the processors active in a layout make a reduction to get the maximun, minimum and average time of their respective counter. Processor number 0 gets the reduced values

Parameters
layHitLayout object
cCounter

Definition at line 248 of file hit_utils.h.

#define hit_counterReset (   c)    (c).value = 0

Reset of a counter to 0.

Parameters
cCounter

Definition at line 220 of file hit_utils.h.

#define hit_counterSum (   c)    (c.sum)

Definition at line 306 of file hit_utils.h.

#define hit_counterValue (   c)    ((c).value)

Access counter value

Parameters
cCounter

Definition at line 214 of file hit_utils.h.

#define hit_counterWorldReduce (   c)
Value:
{ \
MPI_Reduce( &c.value, &c.buffer, 1, MPI_INT, \
MPI_MAX, 0, MPI_COMM_WORLD ); \
c.max = c.buffer; \
MPI_Reduce( &c.value, &c.buffer, 1, MPI_INT, \
MPI_MIN, 0, MPI_COMM_WORLD ); \
c.min = c.buffer; \
MPI_Reduce( &c.value, &c.buffer, 1, MPI_INT, \
MPI_SUM, 0, MPI_COMM_WORLD ); \
c.sum = c.buffer; \
c.avg = c.buffer / hit_NProcs; \
}
#define hit_NProcs
Definition: hit_com.h:142

Definition at line 266 of file hit_utils.h.