sct_reporter.c 56.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * \file sct_reporter.c
 * all functions used to report the measurements
 */
#include "sct_reporter.h"

#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#error missing string.h header
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#else
#error missing strings.h header
#endif

20
21
22
23
#ifdef HAVE_LIBHDF5
#include "hdf5.h"
#endif

24
25
26
27
28
29
30
31
32
#include "sct_collector.h"
#include "sct_reduce.h"

#define NESTEDINDENT 2
#define EVENTINDENT  3
// minimum header length
#define MHL 223

static void report_reduction(sct_reduction_type *red, int timer_choice);
33
static void report_hdf5(int timer_choice);
34
35
36
static void time_sec_str(const double t, char *s, const int sn);

static FILE *outstream = NULL;
37
static char outfilename[256];
38

39
#ifdef HAVE_LIBHDF5
40
static hid_t   file_id;
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
41
42
static hsize_t timer_dims[3]; // timer matrix per context, nprocs * nthreads * ntimer
static hsize_t timername_dims[2]; // timername matrix per context, nprocs * ntimer
43
44
#endif

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
// implementation:
#ifdef NESTED_TIMER
static void print_report_hierarchical(const sct_reduction_type *red, const int it,
                                      const int tid, const int iproc, const int nd,
                                      const int mode, const sct_stats_type *x,
                                      const int timer_offset) {

  const int simple_mode = 0;
  const int callstats_mode = 1;
#ifndef HAVE_LIBPAPI
  const int mnl = sct_internal_get_max_name_length();
#else
  const int mnl = (sct_get_eventcounters() == 2) ? sct_internal_get_max_name_length()+7 : sct_internal_get_max_name_length();
#endif
  const double delta = 1.e-6; // used as save margin in plausibility tests

  int rthread_num = red->r_thread_num;

#ifdef HAVE_MPI
  char *cname = sct_get_global_timer_cname(red, iproc, it);
#else
  char *cname = sct_get_timer_cname(it);
#endif

  char sum_str[32];
#ifdef HAVE_LIBPAPI
  char ename[mnl];
  double val;
#endif

  if (mode == callstats_mode) {
    char min_str[32];
    char avg_str[32];
    char max_str[32];
    double a = x->tsum/x->cnum;

    if (x->tmax*(1.0+delta)+delta < a) sct_abort("internal error", __FILE__, __LINE__);
    time_sec_str(x->tmin, min_str, sizeof(min_str));
    time_sec_str(x->tmax, max_str, sizeof(max_str));
    time_sec_str(x->tsum, sum_str, sizeof(sum_str));
    time_sec_str(a, avg_str, sizeof(avg_str));

    // print timer on actual level
    if (nd == 0) {
#ifdef HAVE_MPI
#ifdef _OPENMP
      if ( red->sp_merging == SCT_SP_SELECT_ALL && tid == rthread_num-1)
        fprintf(outstream," %-*s | %8d   serial |%7d %s%s%s%s\n", mnl, cname, iproc,
                x->cnum, min_str, avg_str, max_str, sum_str);
      else
        fprintf(outstream," %-*s | %8d %8d |%7d %s%s%s%s\n", mnl, cname, iproc, tid,
                x->cnum, min_str, avg_str, max_str, sum_str);
#else
      fprintf(outstream," %-*s | %8d |%7d %s%s%s%s\n", mnl, cname, iproc, x->cnum,
              min_str, avg_str, max_str, sum_str);
#endif
#else
#ifdef _OPENMP
      if ( red->sp_merging == SCT_SP_SELECT_ALL && tid == rthread_num-1)
        fprintf(outstream," %-*s |   serial |%7d %s%s%s%s\n", mnl, cname, x->cnum,
                min_str, avg_str, max_str, sum_str);
      else
        fprintf(outstream," %-*s | %8d |%7d %s%s%s%s\n", mnl, cname, tid, x->cnum,
                min_str, avg_str, max_str, sum_str);
#else
      fprintf(outstream," %-*s |%7d %s%s%s%s\n", mnl, cname, x->cnum, min_str, avg_str,
              max_str, sum_str);
#endif
#endif

#ifdef HAVE_LIBPAPI
      for (int ie=0; ie<sct_get_event_num(); ie++) {
        strcpy(ename,sct_get_event_cname(ie));
        if (sct_get_eventcounters() == 1) {
          val = x->esum[ie]/x->cnum;
#ifdef HAVE_MPI
#ifdef _OPENMP
          fprintf(outstream," %*s%-*s |                   |        %10.2e%10.2e%10.2e%10.2e\n",
                  nd+EVENTINDENT, ".", mnl-nd-EVENTINDENT, ename,
                  (double)x->emin[ie], val, (double)x->emax[ie], (double)x->esum[ie]);
#else
          fprintf(outstream," %*s%-*s |          |        %10.2e%10.2e%10.2e%10.2e\n",
                  nd+EVENTINDENT, ".", mnl-nd-EVENTINDENT, ename,
                  (double)x->emin[ie], val, (double)x->emax[ie], (double)x->esum[ie]);
#endif
#else
#ifdef _OPENMP
            fprintf(outstream," %*s%-*s |          |        %10.2e%10.2e%10.2e%10.2e\n",
                    nd+EVENTINDENT, ".", mnl-nd-EVENTINDENT, ename, (double)x->emin[ie],
                    val, (double)x->emax[ie], (double)x->esum[ie]);
#else
          fprintf(outstream," %*s%-*s |        %10.2e%10.2e%10.2e%10.2e\n",
                  nd+EVENTINDENT, ".", mnl-nd-EVENTINDENT, ename, (double)x->emin[ie],
                  val, (double)x->emax[ie], (double)x->esum[ie]);
#endif
#endif
	} else {
          strcat(ename," (rate)");
          val = x->esum[ie]/x->tsum;
#ifdef HAVE_MPI
#ifdef _OPENMP
          fprintf(outstream," %*s%-*s |                   |        %10.2e%10.2e%10.2e\n",
                  nd+EVENTINDENT, ".", mnl-nd-EVENTINDENT, ename, x->rmin[ie], val, x->rmax[ie]);
#else
          fprintf(outstream," %*s%-*s |          |        %10.2e%10.2e%10.2e\n", nd+EVENTINDENT,
                  ".", mnl-nd-EVENTINDENT, ename, x->rmin[ie], val, x->rmax[ie]);
#endif
#else
#ifdef _OPENMP
	  fprintf(outstream," %*s%-*s |          |        %10.2e%10.2e%10.2e\n", nd+EVENTINDENT,
                  ".", mnl-nd-EVENTINDENT, ename, x->rmin[ie], val, x->rmax[ie]);
#else
          fprintf(outstream," %*s%-*s |        %10.2e%10.2e%10.2e\n", nd+EVENTINDENT, ".",
                  mnl-nd-EVENTINDENT, ename, x->rmin[ie], val, x->rmax[ie]);
#endif
#endif
	}
      }
#endif

    } else { // if (nd != 0)
#ifdef HAVE_MPI
#ifdef _OPENMP
      if ( red->sp_merging == SCT_SP_SELECT_ALL && tid == rthread_num-1)
        fprintf(outstream," %*s%-*s | %8d   serial |%7d %s%s%s%s\n", nd+NESTEDINDENT,
                "L ", mnl-nd-NESTEDINDENT, cname, iproc, x->cnum, min_str, avg_str,
                max_str, sum_str);
      else
        fprintf(outstream," %*s%-*s | %8d %8d |%7d %s%s%s%s\n", nd+NESTEDINDENT, "L ",
                mnl-nd-NESTEDINDENT, cname, iproc, tid, x->cnum, min_str, avg_str, max_str,
                sum_str);
#else
      fprintf(outstream," %*s%-*s | %8d |%7d %s%s%s%s\n", nd+NESTEDINDENT, "L ",
              mnl-nd-NESTEDINDENT, cname, iproc, x->cnum, min_str, avg_str, max_str,
              sum_str);
#endif
#else
#ifdef _OPENMP
      if ( red->sp_merging == SCT_SP_SELECT_ALL && tid == rthread_num-1)
        fprintf(outstream," %*s%-*s |   serial |%7d %s%s%s%s\n", nd+NESTEDINDENT, "L ",
                mnl-nd-NESTEDINDENT, cname, x->cnum, min_str, avg_str, max_str, sum_str);
      else
        fprintf(outstream," %*s%-*s | %8d |%7d %s%s%s%s\n", nd+NESTEDINDENT, "L ",
                mnl-nd-NESTEDINDENT, cname, tid, x->cnum, min_str, avg_str, max_str,
                sum_str);
#else
      fprintf(outstream," %*s%-*s |%7d %s%s%s%s\n", nd+NESTEDINDENT, "L ",
              mnl-nd-NESTEDINDENT, cname, x->cnum, min_str, avg_str, max_str, sum_str);
#endif
#endif

#ifdef HAVE_LIBPAPI
      for (int ie=0; ie<sct_get_event_num(); ie++) {
        strcpy(ename,sct_get_event_cname(ie));
        if (sct_get_eventcounters() == 1) {
          val = (double)x->esum[ie]/x->cnum;
#ifdef HAVE_MPI
#ifdef _OPENMP
          fprintf(outstream," %*s%-*s |                   |        %10.2e%10.2e%10.2e%10.2e\n",
                  nd+NESTEDINDENT+EVENTINDENT, ".", mnl-nd-NESTEDINDENT-EVENTINDENT, ename,
                  (double)x->emin[ie], val, (double)x->emax[ie], (double)x->esum[ie]);
#else
          fprintf(outstream," %*s%-*s |          |        %10.2e%10.2e%10.2e%10.2e\n",
                  nd+NESTEDINDENT+EVENTINDENT, ".", mnl-nd-NESTEDINDENT-EVENTINDENT, ename,
                  (double)x->emin[ie], val, (double)x->emax[ie], (double)x->esum[ie]);
#endif
#else
#ifdef _OPENMP
          fprintf(outstream," %*s%-*s |          |        %10.2e%10.2e%10.2e%10.2e\n",
                  nd+NESTEDINDENT+EVENTINDENT, ".", mnl-nd-NESTEDINDENT-EVENTINDENT, ename,
                  (double)x->emin[ie], val, (double)x->emax[ie], (double)x->esum[ie]);
#else
          fprintf(outstream," %*s%-*s |        %10.2e%10.2e%10.2e%10.2e\n",
                  nd+NESTEDINDENT+EVENTINDENT, ".", mnl-nd-NESTEDINDENT-EVENTINDENT, ename,
                  (double)x->emin[ie], val, (double)x->emax[ie], (double)x->esum[ie]);
#endif
#endif
	}
	else {
          strcat(ename," (rate)");
          val = (double)x->esum[ie]/x->tsum;
#ifdef HAVE_MPI
#ifdef _OPENMP
          fprintf(outstream," %*s%-*s |                   |        %10.2e%10.2e%10.2e\n",
                  nd+NESTEDINDENT+EVENTINDENT, ".", mnl-nd-NESTEDINDENT-EVENTINDENT, ename,
                  x->rmin[ie], val, x->rmax[ie]);
#else
          fprintf(outstream," %*s%-*s |          |        %10.2e%10.2e%10.2e\n",
                  nd+NESTEDINDENT+EVENTINDENT, ".", mnl-nd-NESTEDINDENT-EVENTINDENT, ename,
                  x->rmin[ie], val, x->rmax[ie]);
#endif
#else
#ifdef _OPENMP
          fprintf(outstream," %*s%-*s |          |        %10.2e%10.2e%10.2e\n",
                  nd+NESTEDINDENT+EVENTINDENT, ".", mnl-nd-NESTEDINDENT-EVENTINDENT, ename,
                  x->rmin[ie], val, x->rmax[ie]);
#else
          fprintf(outstream," %*s%-*s |        %10.2e%10.2e%10.2e\n",
                  nd+NESTEDINDENT+EVENTINDENT, ".", mnl-nd-NESTEDINDENT-EVENTINDENT, ename,
                  x->rmin[ie], val, x->rmax[ie]);
#endif
#endif
	}
      }
#endif
    } // endif (nd == 0)
  } // if (mode == callstats_mode)
  else if (mode == simple_mode) {
    time_sec_str(x->tsum, sum_str, sizeof(sum_str));
    // print timer on actual level
    if (nd == 0) {
#ifdef HAVE_MPI
#ifdef _OPENMP
      if ( red->sp_merging == SCT_SP_SELECT_ALL && tid == rthread_num-1)
        fprintf(outstream," %-*s | %8d   serial |%s\n", mnl, cname, iproc, sum_str);
      else
        fprintf(outstream," %-*s | %8d %8d |%s\n", mnl, cname, iproc, tid, sum_str);
#else
      fprintf(outstream," %-*s | %8d |%s\n", mnl, cname, iproc, sum_str);
#endif
#else
#ifdef _OPENMP
      if ( red->sp_merging == SCT_SP_SELECT_ALL && tid == rthread_num-1)
        fprintf(outstream," %-*s |   serial |%s\n", mnl, cname, sum_str);
      else
        fprintf(outstream," %-*s | %8d |%s\n", mnl, cname, tid, sum_str);
#else
      fprintf(outstream," %-*s | %s\n", mnl, cname, sum_str);
#endif
#endif

#ifdef HAVE_LIBPAPI
      for (int ie=0; ie<sct_get_event_num(); ie++) {
        strcpy(ename,sct_get_event_cname(ie));
        if (sct_get_eventcounters() == 1) val = (double)x->esum[ie];
	else{
          strcat(ename," (rate)");
	  val = (double)x->esum[ie]/x->tsum;
        }
#ifdef HAVE_MPI
#ifdef _OPENMP
        fprintf(outstream," %*s%-*s |                   | %10.2e\n", nd+EVENTINDENT, ".",
                mnl-nd-EVENTINDENT, ename, val);
#else
        fprintf(outstream," %*s%-*s |          | %10.2e\n", nd+EVENTINDENT, ".",
                mnl-nd-EVENTINDENT, ename, val);
#endif
#else
#ifdef _OPENMP
        fprintf(outstream," %*s%-*s |          | %10.2e\n", nd+EVENTINDENT, ".", mnl-nd-EVENTINDENT,
                ename, val);
#else
        fprintf(outstream," %*s%-*s | %10.2e\n", nd+EVENTINDENT, ".", mnl-nd-EVENTINDENT,
                ename, val);
#endif
#endif
      }
#endif
    } else { // if (nd != 0)
#ifdef HAVE_MPI
#ifdef _OPENMP
      if ( red->sp_merging == SCT_SP_SELECT_ALL && tid == rthread_num-1)
        fprintf(outstream," %*s%-*s | %8d   serial |%s\n", nd+NESTEDINDENT, "L ",
                mnl-nd-NESTEDINDENT, cname, iproc, sum_str);
      else
        fprintf(outstream," %*s%-*s | %8d %8d |%s\n", nd+NESTEDINDENT, "L ",
                mnl-nd-NESTEDINDENT, cname, iproc, tid, sum_str);
#else
      fprintf(outstream," %*s%-*s | %8d |%s\n", nd+NESTEDINDENT, "L ", mnl-nd-NESTEDINDENT,
              cname, iproc, sum_str);
#endif
#else
#ifdef _OPENMP
      if ( red->sp_merging == SCT_SP_SELECT_ALL && tid == rthread_num-1)
        fprintf(outstream," %*s%-*s |   serial |%s\n", nd+NESTEDINDENT, "L ",
                mnl-nd-NESTEDINDENT, cname, sum_str);
      else
        fprintf(outstream," %*s%-*s | %8d |%s\n", nd+NESTEDINDENT, "L ",
                mnl-nd-NESTEDINDENT, cname, tid, sum_str);
#else
      fprintf(outstream," %*s%-*s | %s\n", nd+NESTEDINDENT, "L ", mnl-nd-NESTEDINDENT,
              cname, sum_str);
#endif
#endif

#ifdef HAVE_LIBPAPI
      for (int ie=0; ie<sct_get_event_num(); ie++) {
        strcpy(ename,sct_get_event_cname(ie));
        if (sct_get_eventcounters() == 1) val = (double)x->esum[ie];
	else{
          strcat(ename," (rate)");
	  val = (double)x->esum[ie]/x->tsum;
        }
#ifdef HAVE_MPI
#ifdef _OPENMP
        fprintf(outstream," %*s%-*s |                   | %10.2e\n", nd+NESTEDINDENT+EVENTINDENT, ".",
                mnl-nd-NESTEDINDENT-EVENTINDENT, ename, val);
#else
        fprintf(outstream," %*s%-*s |          | %10.2e\n", nd+NESTEDINDENT+EVENTINDENT, ".",
                mnl-nd-NESTEDINDENT-EVENTINDENT, ename, val);
#endif
#else
#ifdef _OPENMP
        fprintf(outstream," %*s%-*s |          | %10.2e\n", nd+NESTEDINDENT+EVENTINDENT, ".",
                mnl-nd-NESTEDINDENT-EVENTINDENT, ename, val);
#else
        fprintf(outstream," %*s%-*s | %10.2e\n", nd+NESTEDINDENT+EVENTINDENT, ".",
                mnl-nd-NESTEDINDENT-EVENTINDENT, ename, val);
#endif
#endif
      }
#endif
    } // endif (nd == 0)
  }

  // print all subtimer of actual one
  int offset = timer_offset;
  for (int i = 0; i<red->timer_num_per_rank[iproc]; i++) {
    sct_stats_type *y = &red->stats[offset];
    if ( y->active_under == it)
      print_report_hierarchical(red, i, tid, iproc, nd+1, mode, y, timer_offset);

    offset += rthread_num;
  }
}
#endif // ifdef NESTED_TIMER


static void set_outstream(){
  char *s = getenv("SCT_OUT");
  if (s) {
    if (!strcasecmp(s,"stdout") ) {
377
      outstream = stdout;
378
    } else if (!strcasecmp(s,"stderr") ) {
379
      outstream = stderr;
380
    } else {
381
382
383
      if (getenv("SCT_FILENAME"))
        strcpy(outfilename, getenv("SCT_FILENAME"));
      else
384
#ifdef HAVE_LIBHDF5
385
	strcpy(outfilename, "sct-timings.h5");
386
#else
387
	strcpy(outfilename, "sct-timings.txt");
388
#endif
389

390
391
#ifdef HAVE_LIBHDF5
      if (!strcasecmp(s,"hdf5") ) {
392
	outstream = NULL;
393
394
395
      }
      else {
#endif
396
397
398
	if (!(outstream=fopen(outfilename, "a"))) {
	  fprintf(stderr,"# SCT-Warning: Cannot open %s. Fallback to stdout output.\n", outfilename);
	  outstream = stdout;
399
400
401
402
	}
#ifdef HAVE_LIBHDF5
      }
#endif
403
404
    }
  } else {
405
    outstream = stdout;
406
407
408
409
410
411
412
413
414
415
416
417
  }
}


static void unset_outstream(){
  if ( (outstream == stdin) || (outstream == stdout) ) {
    // nothing to do;
  } else {
    if (outstream) {
      fclose(outstream);
    }
  }
418
  outstream = NULL;
419
  strcpy(outfilename, "");
420
421
422
423
424
}


void sct_single_report(int timer_choice, int proc_choice, int thread_choice, int sp_merging) {
  if (!outstream) set_outstream();
425

426
427
  if (timer_choice > sct_get_timer_num()) {
    sct_warn("output for requested timer exceeds number of registered timers - falling back to output of all timers", __FILE__, __LINE__);
428
429
430
431
432
433
434

#ifdef HAVE_LIBHDF5
    if (!outstream)
      report_hdf5(SCT_SELECT_ALL);
    else
#endif
      sct_stream_report(NULL, SCT_SELECT_ALL, proc_choice, thread_choice, sp_merging);
435
  }
436
437
438
439
440
441
442
443
444
  else {
#ifdef HAVE_LIBHDF5
    if (!outstream)
      report_hdf5(SCT_SELECT_ALL);
    else
#endif
      sct_stream_report(NULL, timer_choice, proc_choice, thread_choice, sp_merging);
  }

445
446
447
448
449
450
  if (outstream) unset_outstream();
}


void sct_report(int proc_choice, int thread_choice, int sp_merging) {
  if (!outstream) set_outstream();
451

452
#ifdef HAVE_LIBHDF5
453
  if (!outstream)
454
    report_hdf5(SCT_SELECT_ALL);
455
456
457
  else
#endif
    sct_stream_report(NULL, SCT_SELECT_ALL, proc_choice, thread_choice, sp_merging);
458

459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
  if (outstream) unset_outstream();
}


static int get_selection_from_env(const char *key) {
  char *s = getenv(key);
  if (s) {
    if (!strcasecmp(s,"SCT_SELECT_ALL") ) return SCT_SELECT_ALL;
    if (!strcasecmp(s,"SCT_REDUCE_ALL") ) return SCT_REDUCE_ALL;
    int i = atoi(s);
    if (i<0) goto err;
    return i;
  }

 err:
  //fprintf(stderr,"# SCT-Warning: Use SCT_SELECT_ALL as fallback value for %s.\n", key);
  return SCT_SELECT_ALL;
}


static int get_sp_merging_from_env() {
  //fprintf(stdout,"# SCT-Info: get envVar SCT_SP_MERGING.\n");
  char *s = getenv ("SCT_SP_MERGING");
  if ( !s ) goto err;
  if ( !strcasecmp(s,"SCT_SP_MERGE_SIMPLE") ) return SCT_SP_MERGE_SIMPLE;
  if ( !strcasecmp(s,"SCT_SP_SERIAL_ONLY") ) return SCT_SP_SERIAL_ONLY;
  if ( !strcasecmp(s,"SCT_SP_PARALLEL_ONLY") ) return SCT_SP_PARALLEL_ONLY;
  if ( !strcasecmp(s,"SCT_SP_SELECT_ALL") ) return SCT_SP_SELECT_ALL;

 err:
  //fprintf(stderr,"# SCT-Warning: Use SCT_SP_MERGE_SIMPLE as fallback value for SCT_SP_MERGING.\n");
  return SCT_SP_SELECT_ALL;
}


494
static void report_hdf5(int timer_choice){
495
496
497
498
499
  if (timer_choice > sct_get_timer_num())
    sct_abort("output for requested timer exceeds number of registered timers", __FILE__, __LINE__);

#ifdef HAVE_LIBHDF5
  herr_t  status;
500
  int i, num_timer, num_events;
501
502
  const int root_pid = 0;
  int root = 0;
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
503
  int my_debug = 0;
504
505
506
507
508
509
510
511
512
513

  // stop timers if not done already
  if (timer_choice < 0)
    sct_stop_all();
  else
    sct_try_stop(timer_choice);

  // ... for the time being just write out everything ...
  int proc_choice = SCT_SELECT_ALL;
  int thread_choice = SCT_SELECT_ALL;
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
514
  int callstatsmode = sct_get_callstats();
515

516
  // loop over all contexts and write to file
517
518
519
520
521
522
523
524
525
  sct_context_type *con;
  int jcon = 0;
  for (int icon = 0; icon<sct_get_context_num(); icon++) {
    if ( !(con=sct_get_context(icon)) ) continue; // skip deleted contexts
    if (con->pid == root_pid)
      root = 1;
    else
      root = 0;

526
527
528
529
530
531
532
533
#ifdef HAVE_MPI
    sct_create_global_timer_map(con);
#endif
    sct_reduction_type *red = sct_reduction_new(icon,              // int context_choice
                                                proc_choice,       // int proc_choice,
                                                thread_choice,     // int thread_choice
                                                SCT_SP_SELECT_ALL  // int sp_choice
                                                );
534

535
536
537
538
    if (con->pid == root_pid) {
      if (red) {
	hid_t attr_type = H5Tcopy(H5T_C_S1);
	hsize_t proc_num = red->proc_num;
539

540
541
	if (jcon == 0) {
	  /* open HDF5 file and set generic info */
542
543
	  if ( (file_id = H5Fcreate(outfilename, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
	    /* file already present, modify outfilename and retry */
544
	    fprintf(stderr, "# SCT-Warning: HDF5 file named '%s' already present\n",
545
		    outfilename);
546
547
548
	    strcat(outfilename, "_");
	    strcat(outfilename, strrchr(tmpnam(NULL),'/')+1);
	    fprintf(stderr, "               using '%s' instead\n", outfilename);
549
550
551
552
	    if ( (file_id = H5Fcreate(outfilename, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
	      sct_abort("not able to create HDF5 output", __FILE__, __LINE__);	      
	    }
	  }
553
554
555
556
557
	  
	  timer_dims[0] = proc_num;
	  timername_dims[0] = proc_num;
	  int threadnum = sct_get_pr_thread_count();
	  timer_dims[1] = 1;
558
#ifdef _OPENMP
559
	  timer_dims[1] += threadnum; // one for each thread plus one for pure seq part
560
#endif
561
562
563
564
565
	  // number of timers might vary between tasks !!!
	  num_timer = 0;
	  for (int iproc = 0; iproc < proc_num; iproc++)
            num_timer = (red->timer_num_per_rank[iproc] > num_timer) ? red->timer_num_per_rank[iproc]:num_timer;
	  timername_dims[1] = num_timer;
566
	  timer_dims[2] = num_timer;
567
#ifdef HAVE_LIBPAPI
568
	  num_events = sct_get_event_num();
569
#else
570
	  num_events = 0;
571
#endif
572
	  
573
#if (defined(HAVE_MPI) && defined(_OPENMP))
574
	  char prog_mode[] = "hybrid MPI-OpenMP";
575
#elif defined(HAVE_MPI)
576
	  char prog_mode[] = "MPI";
577
#elif defined(_OPENMP)
578
	  char prog_mode[] = "OpenMP";
579
#else
580
	  char prog_mode[] = "serial";
581
#endif
582
	  hid_t attr_id = H5Screate(H5S_SCALAR);
583

584
585
586
587
	  /* separate sct internal attributes into group */
	  hid_t group_id = H5Gcreate(file_id, "sct_internal_attributes", H5P_DEFAULT,
	                           H5P_DEFAULT, H5P_DEFAULT);

588
589
	  status = H5Tset_size(attr_type, strlen(prog_mode)+1);
	  status = H5Tset_strpad(attr_type, H5T_STR_NULLTERM);
590
	  hid_t attr = H5Acreate(group_id, "sct program mode", attr_type, attr_id,
591
592
593
				 H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Awrite(attr, attr_type, prog_mode);
	  status = H5Aclose(attr);
594
595
	  status = H5Tset_size(attr_type, strlen(print_prg_start_time())+1);
	  status = H5Tset_strpad(attr_type, H5T_STR_NULLTERM);
596
	  attr = H5Acreate(group_id, "sct start time", attr_type, attr_id,
597
598
599
			   H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Awrite(attr, attr_type, print_prg_start_time());
	  status = H5Aclose(attr);
600

601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
          char prg_stop_time_string[40];
#if (HAVE_TIME_H || HAVE_SYS_TIME_H)
          struct timeval prg_stop_time;
          struct tm * ptm;
          gettimeofday(&prg_stop_time, NULL);
          ptm = localtime(&prg_stop_time.tv_sec);
          strftime(prg_stop_time_string, sizeof(prg_stop_time_string), "%Y-%m-%d %H:%M:%S", ptm);
#else
          strcpy(prg_stop_time_string,"not available");
#endif
	  status = H5Tset_size(attr_type, strlen(prg_stop_time_string)+1);
	  status = H5Tset_strpad(attr_type, H5T_STR_NULLTERM);
	  attr = H5Acreate(group_id, "sct stop time", attr_type, attr_id,
			   H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Awrite(attr, attr_type, prg_stop_time_string);
	  status = H5Aclose(attr);
          
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
	  status = H5Gclose(group_id);

	  /* add various attributes if attribute_table is not NULL */
	  const sct_attribute_table *attr_table = sct_internal_get_attribute_table();
	  if ( attr_table != NULL ) {

	    group_id = H5Gcreate(file_id, "report_attributes", H5P_DEFAULT,
				 H5P_DEFAULT, H5P_DEFAULT);

	    sct_attribute_type *a;
	    for (a = attr_table->first; a != NULL; a = a->next) {
	      switch (a->type) {
	      case SCT_INT:
		attr = H5Acreate(group_id, a->key, H5T_NATIVE_INT, attr_id,
				 H5P_DEFAULT, H5P_DEFAULT);
		status = H5Awrite(attr, H5T_NATIVE_INT, a->value);
		break;
	      case SCT_LONG:
		attr = H5Acreate(group_id, a->key, H5T_NATIVE_LONG, attr_id,
				 H5P_DEFAULT, H5P_DEFAULT);
		status = H5Awrite(attr, H5T_NATIVE_LONG, a->value);
		break;
	      case SCT_FLOAT:
		attr = H5Acreate(group_id, a->key, H5T_NATIVE_FLOAT, attr_id,
				 H5P_DEFAULT, H5P_DEFAULT);
		status = H5Awrite(attr, H5T_NATIVE_FLOAT, a->value);
		break;
	      case SCT_DOUBLE:
		attr = H5Acreate(group_id, a->key, H5T_NATIVE_DOUBLE, attr_id,
				 H5P_DEFAULT, H5P_DEFAULT);
		status = H5Awrite(attr, H5T_NATIVE_DOUBLE, a->value);
		break;
	      case SCT_STRING:
		status = H5Tset_size(attr_type, strlen(a->value)+1);
		status = H5Tset_strpad(attr_type, H5T_STR_NULLTERM);
		attr = H5Acreate(group_id, a->key, attr_type, attr_id,
				 H5P_DEFAULT, H5P_DEFAULT);
		status = H5Awrite(attr, attr_type, a->value);
	      	break;
	      default:
		sct_abort("internal error", __FILE__, __LINE__);
	      }
	      status = H5Aclose(attr);
	    }

	    status = H5Gclose(group_id);
	  }
665
	  
666
#ifdef HAVE_MPI
667
668
669
670
	  attr = H5Acreate(file_id, "number of MPI tasks", H5T_NATIVE_INT, attr_id,
			   H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Awrite(attr, H5T_NATIVE_INT, &timer_dims[0]);
	  status = H5Aclose(attr);
671
672
#endif
#ifdef _OPENMP
673
674
675
676
677
678
679
	  attr = H5Acreate(file_id, "number of OpenMP threads", H5T_NATIVE_INT, attr_id,
			   H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Awrite(attr, H5T_NATIVE_INT, &threadnum);
	  status = H5Aclose(attr);
#endif
	  status = H5Sclose(attr_id);

680
681
682
#ifdef HAVE_MPI
	  int max_pname_mem = red->max_proc_name_len + 1;
	  char (*gpname)[max_pname_mem] = (char (*)[max_pname_mem]) red->proc_names;
683
684
685
686
687
688

	  attr_id = H5Screate_simple(1, &proc_num, NULL);
	  status = H5Tset_size(attr_type, max_pname_mem);
	  status = H5Tset_strpad(attr_type, H5T_STR_NULLTERM);
	  attr = H5Acreate(file_id, "hosts", attr_type, attr_id, H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Awrite(attr, attr_type, gpname);
689
	  status = H5Aclose(attr);
690
	  status = H5Sclose(attr_id);
691
#endif
692
	}
693
694
695

	int r_proc_num = red->red_proc_num;
	int r_thread_num = red->r_thread_num;
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
696
697
698
699
700
701
702
703
704
705
        double timer_tmin[r_proc_num][r_thread_num][num_timer];
        double timer_tmax[r_proc_num][r_thread_num][num_timer];
        double timer_tsum[r_proc_num][r_thread_num][num_timer];
        int timer_cnum[r_proc_num][r_thread_num][num_timer];
	char timer_names[r_proc_num][num_timer][sct_internal_get_max_name_length()];
	memset(timer_tmin, 0, r_proc_num*r_thread_num*num_timer*sizeof(double));
	memset(timer_tmax, 0, r_proc_num*r_thread_num*num_timer*sizeof(double));
	memset(timer_tsum, 0, r_proc_num*r_thread_num*num_timer*sizeof(double));
	memset(timer_cnum, 0, r_proc_num*r_thread_num*num_timer*sizeof(int));
	memset(timer_names, 0, r_proc_num*num_timer*sct_internal_get_max_name_length()*sizeof(char));
706

707
708
#ifdef HAVE_LIBPAPI
	char counter_name[sct_internal_get_max_name_length()];
709
710
711
        double counter_val[num_events][r_proc_num][r_thread_num][num_timer];
        double counter_min[num_events][r_proc_num][r_thread_num][num_timer];
        double counter_max[num_events][r_proc_num][r_thread_num][num_timer];
712
713
714
715
716
717
	memset(counter_name, 0, sct_internal_get_max_name_length()*sizeof(char));
	memset(counter_val, 0, r_proc_num*r_thread_num*num_timer*num_events*sizeof(double));
	memset(counter_min, 0, r_proc_num*r_thread_num*num_timer*num_events*sizeof(double));
	memset(counter_max, 0, r_proc_num*r_thread_num*num_timer*num_events*sizeof(double));
#endif

718
719
720
	int timer_offset = 0;

	for (int iproc = 0; iproc < r_proc_num; iproc++) {
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
721
722
723
724
	  for (int it = 0; it<red->timer_num_per_rank[iproc]; it++) {
	    if (timer_choice>=0 && timer_choice!=it) {
	      timer_offset += r_thread_num; continue;
	    }
725
726
727
728
729
#ifdef HAVE_MPI
	    char *cname = sct_get_global_timer_cname(red, iproc, it);
#else
	    char *cname = sct_get_timer_cname(it);
#endif
730
731
	    strcpy(timer_names[iproc][it], cname);

732
	    for (int tid = 0; tid < r_thread_num; tid++) {
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
733

734
	      sct_stats_type *x = &red->stats[timer_offset];
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
735
	      
736
	      // check whether timer was called at all
737
738
739
740
	      if (x->cnum < 1) {
		timer_offset++;

		if (my_debug) {
741
		  fprintf(stderr,"[report_hdf5] at %d %d %d is timer %s not used\n",
742
743
744
745
746
747
			  iproc, tid, it, cname);
		  fflush(stderr);
		}

		continue;
	      }
748

Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
749
750
751
752
	      if (callstatsmode) {
		timer_tmin[iproc][tid][it] = x->tmin;
		timer_tmax[iproc][tid][it] = x->tmax;
	      }	
753
	      timer_tsum[iproc][tid][it] = x->tsum;
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
754
	      timer_cnum[iproc][tid][it] = x->cnum;
755

756
	      if (my_debug) {
757
	        fprintf(stderr,"[report_hdf5] at %d %d %d is timer %s with (%d,%f,%f,%f)\n",
758
759
760
761
			iproc, tid, it, cname, x->cnum, x->tmin, x->tmax, x->tsum);
		fflush(stderr);
	      }

762
	      // now report eventcounters ... TODO: counter_val should NOT have innermost loop over first index !!!! but actually needed to pass correct memory region to hdf5
763
#ifdef HAVE_LIBPAPI
764
	      for (int ie = 0; ie < num_events; ie++) {
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
765
		if (sct_get_eventcounters() == 1) {
766
		  // use sum of raw counters in this case
767
		  counter_val[ie][iproc][tid][it] = (double)x->esum[ie];
768
		  if (callstatsmode) {
769
770
		    counter_min[ie][iproc][tid][it] = (double)x->emin[ie];
		    counter_max[ie][iproc][tid][it] = (double)x->emax[ie];
771
		  }
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
772
		} else {
773
		  // use avg of counter rates in this case
774
		  counter_val[ie][iproc][tid][it] = (double)x->esum[ie]/x->tsum;
775
		  if (callstatsmode) {
776
777
		    counter_min[ie][iproc][tid][it] = x->rmin[ie];
		    counter_max[ie][iproc][tid][it] = x->rmax[ie];
778
		  }
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
779
780
		}
	      }
781
782
783
784
785
786
#endif
              timer_offset++;
	    }
          }
        }

787
        /* group for the context which is accessible via "red->context_name.cs" */
788
	hid_t group_id = H5Gcreate(file_id, red->context_name.cs, H5P_DEFAULT,
789
				   H5P_DEFAULT, H5P_DEFAULT);
790

791
	/* timer names are valid for all following groups */
792
        hid_t dataspace_id = H5Screate_simple(2, timername_dims, NULL);
793
794
795

	status = H5Tset_size(attr_type, sct_internal_get_max_name_length());
	status = H5Tset_strpad(attr_type, H5T_STR_NULLTERM);
796
797
        hid_t dataset_id = H5Dcreate(group_id, "timer_names", attr_type, dataspace_id,
				     H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
798
799
800
801
802
803
804
805
806
807
        status = H5Dwrite(dataset_id, attr_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
			  timer_names);
        status = H5Dclose(dataset_id);

        status = H5Sclose(dataspace_id);

	/* subgroup for timer values */
	hid_t timergroup_id = H5Gcreate(group_id, "time", H5P_DEFAULT,
					H5P_DEFAULT, H5P_DEFAULT);

Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
808
809
810
        dataspace_id = H5Screate_simple(3, timer_dims, NULL);

	if (callstatsmode) {
811
	  dataset_id = H5Dcreate(timergroup_id, "timer_tmin", H5T_NATIVE_DOUBLE, dataspace_id,
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
812
813
814
815
816
				 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
			    timer_tmin);
	  status = H5Dclose(dataset_id);
	  
817
	  dataset_id = H5Dcreate(timergroup_id, "timer_tmax", H5T_NATIVE_DOUBLE, dataspace_id,
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
818
819
820
821
822
823
				 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
			    timer_tmax);
	  status = H5Dclose(dataset_id);
	}

824
        dataset_id = H5Dcreate(timergroup_id, "timer_tsum", H5T_NATIVE_DOUBLE, dataspace_id,
825
826
827
828
829
	                       H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
        status = H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
			  timer_tsum);
        status = H5Dclose(dataset_id);

830
        dataset_id = H5Dcreate(timergroup_id, "timer_cnum", H5T_NATIVE_INT, dataspace_id,
831
832
	                       H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
        status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT,
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
833
			  timer_cnum);
834
        status = H5Dclose(dataset_id);
835
	status = H5Gclose(timergroup_id);
836

837
838
839
840
841
842
843
844
845
846
847
848
849
850
	/* subgroup for eventcounter values */
#ifdef HAVE_LIBPAPI
	hid_t countergroup_id = H5Gcreate(group_id, "eventcounter", H5P_DEFAULT,
	                                  H5P_DEFAULT, H5P_DEFAULT);
	
	for (int ie = 0; ie < num_events; ie++) {
	  strcpy(counter_name, sct_get_event_cname(ie));
	  if (sct_get_eventcounters() != 1) {
	    strcat(counter_name," (rate)");
	  }

	  dataset_id = H5Dcreate(countergroup_id, counter_name, H5T_NATIVE_DOUBLE, dataspace_id,
	                         H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
	  status = H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
851
			    counter_val[ie]);
852
	  status = H5Dclose(dataset_id);
853

854
855
856
857
858
859
	  if (callstatsmode) {
	    strcpy(counter_name, sct_get_event_cname(ie));
	    if (sct_get_eventcounters() != 1) {
	      strcat(counter_name," (rate)");
	    }
	    strcat(counter_name," min");
860

861
862
863
	    dataset_id = H5Dcreate(countergroup_id, counter_name, H5T_NATIVE_DOUBLE, dataspace_id,
				   H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
	    status = H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
864
			      counter_min[ie]);
865
	    status = H5Dclose(dataset_id);
866

867
868
869
870
871
872
873
874
875
	    strcpy(counter_name, sct_get_event_cname(ie));
	    if (sct_get_eventcounters() != 1) {
	      strcat(counter_name," (rate)");
	    }
	    strcat(counter_name," max");

	    dataset_id = H5Dcreate(countergroup_id, counter_name, H5T_NATIVE_DOUBLE, dataspace_id,
				   H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
	    status = H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
876
			      counter_max[ie]);
877
878
879
	    status = H5Dclose(dataset_id);
	  }
	}
880
881

	status = H5Gclose(countergroup_id);
882
#endif
883
884
	status = H5Gclose(group_id);

885
        status = H5Sclose(dataspace_id);
886
887
      } /* if (red) */
      else
888
        fprintf(stderr, "# SCT-Warning: empty reduction returned.\n");
889
    } /* if (root) */
890
891
892
893

    sct_reduction_delete(red);
    jcon++;
  }
Hendryk Bockelmann's avatar
Hendryk Bockelmann committed
894

895
  if (root) H5Fclose(file_id);
896
897
898
899
#endif
}


900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
void sct_stream_report(FILE *outstream_arg,
                       int timer_choice   ,
                       int proc_choice    ,
                       int thread_choice  ,
                       int sp_merging     ) {

  if (outstream_arg) outstream = outstream_arg;
  if (!outstream) sct_abort("missing outstream", __FILE__, __LINE__);
  if (timer_choice > sct_get_timer_num())
    sct_abort("output for requested timer exceeds number of registered timers", __FILE__, __LINE__);

  // try to get a clean canvas:
  if ( (outstream == stdout) || (outstream == stderr) ) fflush(outstream);

  const int root_pid = 0;
  int root = 0;
  int my_debug = 0;

#ifdef HAVE_MPI
  if (proc_choice == SCT_GETENV) proc_choice = get_selection_from_env("SCT_PROC_CHOICE");
#else
  proc_choice = SCT_SELECT_ALL;
#endif

#ifdef _OPENMP
  if (thread_choice == SCT_GETENV) thread_choice = get_selection_from_env("SCT_THREAD_CHOICE");
  if (sp_merging == SCT_GETENV) sp_merging = get_sp_merging_from_env();
#else
  thread_choice = 0;
  sp_merging = SCT_SP_SELECT_ALL;
#endif

  if (my_debug) {
    fprintf(stderr,"[-] sct_stream_report with %d %d %d %d\n",
            timer_choice, proc_choice, thread_choice, sp_merging);
    fflush(stderr);
  }

  // stop timers if not done already
  if (timer_choice < 0)
    sct_stop_all();
  else
    sct_try_stop(timer_choice);

  sct_context_type *con;
  int jcon = 0;
  for (int icon = 0; icon<sct_get_context_num(); icon++) {
    if ( !(con=sct_get_context(icon)) ) continue; // skip deleted contexts
    if (con->pid == root_pid)
      root = 1;
    else
      root = 0;

    if (jcon == 0 && root) {
      if (timer_choice<0)
        fprintf(outstream, "\n --> sct_report for all timers:\n");
      else
        fprintf(outstream, "\n --> sct_report for timer \"%s\":\n",
                sct_get_timer_cname(timer_choice));
#if (defined(HAVE_MPI) && defined(_OPENMP))
      fprintf(outstream, "program_mode  = MPI-OpenMP\n");
#elif defined(HAVE_MPI)
      fprintf(outstream, "program_mode  = MPI\n");
#elif defined(_OPENMP)
      fprintf(outstream, "program_mode  = OpenMP\n");
#else
      fprintf(outstream, "program_mode  = serial\n");
#endif
968
      fprintf(outstream, "program start = %s\n", print_prg_start_time());
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995

#ifdef HAVE_MPI
      if (proc_choice >= 0) {
        fprintf(outstream, "proc_choice   = %d\n", proc_choice);
      } else {
        fprintf(outstream, "proc_choice   = %s\n", sct_internal_reduce_doc(proc_choice));
      }
#endif
#ifdef _OPENMP
      if (thread_choice >= 0) {
        fprintf(outstream, "thread_choice = %d\n", thread_choice);
      } else {
        fprintf(outstream, "thread_choice = %s\n", sct_internal_reduce_doc(thread_choice));
      }
      fprintf(outstream,   "sp_merging    = %s\n", sct_internal_sp_doc(sp_merging));
#endif
    }

    /// \todo in case of report for specific timer, reduction of all timers might be to much
#ifdef HAVE_MPI
    sct_create_global_timer_map(con); // \todo also needed in seq/openmp case ???
#endif
    sct_reduction_type *red = sct_reduction_new(icon,          // int context_choice
                                                proc_choice,   // int proc_choice,
                                                thread_choice, // int thread_choice
                                                sp_merging     // int sp_choice
                                                );
996
    if (root) {
997
998
999
1000
      if (red)
        report_reduction(red, timer_choice);
      else
        fprintf(outstream,   "# sct: empty report\n");
For faster browsing, not all history is shown. View entire blame