45 (post_action)( conf, arg );
53 uint32_t chld_count = 0;
62 next_conf[chld_count].
offset = *((
long long int *)arg);
68 if( 64 < chld_count) {
69 printf(
"WARNING NOT ENOUGH CONF CELL PLEASE AUGMENT IN FILE %s @ %d\n", __FILE__, __LINE__);
79 (per_child_act)(&next_conf[chld_count - 1], arg);
82 }
while( chld_count );
88 (post_action)( conf, arg );
136 uint64_t T0 = 0, T1 = 0, Tr = 0;
137 long long int DTr = 1;
140 long long int sum = 0 , count = 0;
143 long long int round_trip = 0;
153 for( i = 0 ; i <
MAX_AVG ; i++ ) {
162 round_trip += T1 - T0;
163 sum += ((T0 + T1) / 2) - Tr;
168 round_trip = round_trip / count;
184 if(
abs_diff( ((T0 + T1)/2) , Tr ) < (round_trip / 500) ) {
208 long long int DTr = 0;
210 long long int sync_offset = 0;
220 Tr = Timer_tsc() + sync_offset;
233 long long int *
offset = (
long long int *)poffset;
234 *offset = sync_offset;
260 long long int *
offset = (
long long int *)poffset;
static uint32_t nearest_pow(uint32_t num)
Computes the nearest.
void perchild_host(struct sync_tree_conf *c, void *arg)
What to be done on each node's child.
int target_node
the target node
int current_pow
the current nearest power of two
uint64_t Process_time_origin
The origin of the timer.
void sync_mpi()
Entry point to be used to perform time sync of every MPI Processes.
long long int Process_Sync_Offset
The offset of the timer.
void bootstrap_sync_tree(void(*action)(struct sync_tree_conf *next_conf, void *arg), void(*per_child_act)(struct sync_tree_conf *conf, void *arg), void(*post_action)(struct sync_tree_conf *next_conf, void *arg), void *arg)
This is a bootstrapping function for calling compute_sync_tree();.
void action_set_off(struct sync_tree_conf *c, void *poffset)
Copies offset of c to current process timer offset (poffset)
static uint64_t abs_diff(uint64_t a, uint64_t b)
Computes an absolute difference.
void Timer_set_origin()
Initializes the timer (save current processor timer counter)
This structure describes a tree node for time synchronization.
int source_node
the source node
void sync_client(int parent, void *poffset)
The client function for synchronizing time (computes offset between server and client) ...
long long int offset
the time offset
void post_client(struct sync_tree_conf *c, void *arg)
What to be done on the client side.
#define SYNC_TAG
The tag for time sync communications.
void sync_server(int dest_rank)
Server function for synchronizing time.
static MPI_Comm Trace_Comm_get()
Getter on the sync communicator.
#define MAX_AVG
the number of offset computations to perform to get an average offset
void action_val(struct sync_tree_conf *c, void *arg)
For debugging only.
int comm_size
the total number of ranks
void compute_sync_tree(struct sync_tree_conf *conf, void(*action)(struct sync_tree_conf *next_conf, void *arg), void(*per_child_act)(struct sync_tree_conf *conf, void *arg), void(*post_action)(struct sync_tree_conf *next_conf, void *arg), void *arg)
This function does the actual work prepared by bootstrap_sync_tree().
#define MAX_LOOP_TRY
the maximum number computations tries