#include #include #include #include #include #include #include static double get_time() { struct timespec tv; if(clock_gettime(CLOCK_MONOTONIC, &tv) != 0) { perror("clock_gettime failed"); exit(EXIT_FAILURE); } return (double)(tv.tv_sec) * 1.0e-9 + (double)tv.tv_nsec; } static int cmp_double(const void *pa, const void *pb) { double a, b; a = *(const double *) pa; b = *(const double *) pb; if(a < b) return -1; else if(a > b) return 1; else return 0; } /* Called by rank 0 */ static void get_offset(double *timetable, char (*hosttable)[HOST_NAME_MAX], int nproc, int nsamples) { int i, j; double median, mean, var, std; double *offset; double *delta; offset = malloc(nproc * sizeof(double)); delta = malloc(nsamples * sizeof(double)); if(!offset || !delta) { perror("malloc"); exit(EXIT_FAILURE); } /* We use as ref the clock in rank 0 */ printf("%-10s %-20s %-20s %-20s\n", "rank", "hostname", "offset_median", "offset_std"); for(i=0; i