30 double * t =
ta_malloc(
"clocks",
double, 4 *
N);
32 double * max = t + 2 *
N;
33 double * sum = t + 3 *
N;
35 for(i = 0; i <
CT->
N; i ++) {
38 MPI_Reduce(t, min,
N, MPI_DOUBLE, MPI_MIN, root, comm);
39 MPI_Reduce(t, max,
N, MPI_DOUBLE, MPI_MAX, root, comm);
40 MPI_Reduce(t, sum,
N, MPI_DOUBLE, MPI_SUM, root, comm);
43 MPI_Comm_size(comm, &
NTask);
45 for(i = 0; i <
CT->
N; i ++) {
59 for(i = 0; i <
CT->
N; i ++) {
66 for(i = 0; i <
CT->
N; i ++) {
77 static int clockcmp(
const void * c1,
const void * c2) {
78 const struct Clock * p1 = (
const struct Clock *) c1;
79 const struct Clock * p2 = (
const struct Clock *) c2;
84 if(
name[0] !=
'/') abort();
85 if(strlen(
name) > 1) {
87 strncpy(tmp,
name, 79);
90 for(p = tmp + 1; *p; p ++) {
115 dummy.
name[
sizeof(dummy.
name)-1]=
'\0';
157 for(i = 0; i <
CT->
N; i ++) {
163 for(j = i + 1; j <
CT->
N; j++) {
196 char fullname[128] = {0};
197 const char * basename = file + strlen(file);
198 while(basename >= file && *basename !=
'/') basename --;
200 sprintf(fullname,
"%s@%s:%04d",
name, basename, line);
204 char fullname[128] = {0};
205 const char * basename = file + strlen(file);
206 while(basename >= file && *basename !=
'/') basename --;
208 sprintf(fullname,
"%s@%s:%04d",
name, basename, line);
222 MPI_Comm_rank(comm, &rank);
223 if(rank != root)
return;
225 for(i = 0; i <
CT->
N; i ++) {
238 fprintf(fp,
"%*s%-26s %10.2f %4.1f%% %10.2f %4.1f%% %10.2f %10.2f\n",
251 #define HELLO atom(&atomtable, "Hello")
252 #define WORLD atom(&atomtable, "WORLD")
255 printf(
"%d\n", HELLO, atom_name(&atomtable, HELLO));
256 printf(
"%d\n", HELLO, atom_name(&atomtable, HELLO));
257 printf(
"%d\n", WORLD, atom_name(&atomtable, WORLD));
258 printf(
"%d\n", HELLO, atom_name(&atomtable, HELLO));
#define ta_malloc(name, type, nele)
void walltime_init(struct ClockTable *ct)
static double WallTimeClock
static void walltime_update_parents(void)
static void walltime_clock_insert(const char *name)
int walltime_clock(const char *name)
void walltime_summary(int root, MPI_Comm comm)
double walltime_measure_internal(const char *name)
double walltime_add_full(const char *name, const double dt, const char *file, const int line)
static int clockcmp(const void *c1, const void *c2)
static double seconds(void)
double walltime_measure_full(const char *name, const char *file, const int line)
double walltime_get_time(const char *name)
double walltime_get(const char *name, enum clocktype type)
static double LastReportTime
double walltime_add_internal(const char *name, const double dt)
char walltime_get_symbol(const char *name)
void walltime_report(FILE *fp, int root, MPI_Comm comm)
static void walltime_summary_clocks(struct Clock *C, int N, int root, MPI_Comm comm)
static struct ClockTable * CT