void IMB_print_header (int out_format, struct Bench* bmark, struct comm_info* c_info, MODES bench_mode) { int line_len = 0; char* help; char* token; fprintf(unit,"\n"); /* FOR GNUPLOT: CURVE SEPERATOR */ if( c_info->group_mode > 0 ) { /* several groups output*/ strcpy(aux_string,"&Group") ; line_len = 1; } else { strcpy(aux_string,""); line_len = 0; } switch (out_format) { case OUT_TIME_AND_BW: line_len += 4; strcat(aux_string,"&#bytes&#repetitions&t[usec]&Mbytes/sec&"); break; case OUT_BW_AND_MSG_RATE: line_len += 4; strcat(aux_string,"&#bytes&#repetitions&Mbytes/sec&Msg/sec&"); break; case OUT_TIME_RANGE_AND_BW: line_len += 6; strcat(aux_string, "&#bytes&#repetitions&t_min[usec]&t_max[usec]&t_avg[usec]&Mbytes/sec&"); break; case OUT_TIME_RANGE: line_len += 5; strcat(aux_string, "&#bytes&#repetitions&t_min[usec]&t_max[usec]&t_avg[usec]&"); break; case OUT_SYNC: if (bmark->RUN_MODES[0].NONBLOCKING && !strstr(bmark->name, "_pure")) { line_len += 5; strcat(aux_string, "&#repetitions&t_ovrl[usec]&t_pure[usec]&t_CPU[usec]& overlap[%]&"); } else { line_len += 4; strcat(aux_string, "&#repetitions&t_min[usec]&t_max[usec]&t_avg[usec]&"); } break; case OUT_OVERLAP: #ifdef RMA line_len += 4; strcat(aux_string, "&#bytes&#repetitions&t_pure[usec]&t_ovrl[usec]&"); #else line_len += 6; strcat(aux_string, "&#bytes&#repetitions&t_ovrl[usec]&t_pure[usec]&t_CPU[usec]& overlap[%]&"); #endif break; } #ifdef CHECK if( bmark->RUN_MODES[0].type != Sync && strcmp(bmark->name,"Window") ) { line_len+=1; strcat(aux_string, "&defects&"); } #endif IMB_make_line(line_len); if( c_info->n_groups > 1) { fprintf(unit, "# Benchmarking Multi-%s ", bmark->name); } else { fprintf(unit, "# Benchmarking %s ", bmark->name); } IMB_show_procids(c_info); IMB_make_line(line_len); switch(bench_mode->AGGREGATE) { case 1: fprintf(unit, "#\n# MODE: AGGREGATE \n#\n"); break; case 0: fprintf(unit, "#\n# MODE: NON-AGGREGATE \n#\n"); break; } help=aux_string; while (token = strtok(help, "&")) { sprintf(format, "%%%ds", ow_format); fprintf(unit, format, token); help = NULL; } fprintf(unit, "\n"); return; }
/* Introduce new ITERATIONS object */ void IMB_output(struct comm_info* c_info, struct Bench* Bmark, MODES BMODE, int header, int size, struct iter_schedule* ITERATIONS, double *time) /* >> IMB 3.1 */ /* Input variables: -c_info (type struct comm_info*) Collection of all base data for MPI; see [1] for more information -Bmark (type struct Bench*) (For explanation of struct Bench type: describes all aspects of modes of a benchmark; see [1] for more information) The actual benchmark -BMODE (type MODES) The actual benchmark mode (if relevant; only MPI-2 case, see [1]) -header (type int) 1/0 for do/don't print table headers -size (type int) Benchmark message size -ITERATIONS (type struct iter_schedule) Benchmark repetition descr. object -time (type double *) Benchmark timing outcome 3 numbers (min/max/average) */ { double scaled_time[MAX_TIMINGS]; int DO_OUT; int GROUP_OUT; int i,i_gr; int li_len; int edit_type; ierr = 0; DO_OUT = (c_info->w_rank == 0 ); GROUP_OUT = (c_info->group_mode > 0 ); if (DO_OUT) { /* Fix IMB_1.0.1: NULL all_times before allocation */ IMB_v_free((void**)&all_times); all_times = (double*)IMB_v_alloc(c_info->w_num_procs * Bmark->Ntimes * sizeof(double), "Output 1"); #ifdef CHECK if(!all_defect) { all_defect = (double*)IMB_v_alloc(c_info->w_num_procs * sizeof(double), "Output 1"); for(i=0; i<c_info->w_num_procs; i++) all_defect[i]=0.; } #endif } /*if (DO_OUT)*/ /* Scale the timings */ for(i=0; i<Bmark->Ntimes; i++) scaled_time[i] = time[i] * SCALE * Bmark->scale_time; /* collect all times */ ierr=MPI_Gather(scaled_time,Bmark->Ntimes,MPI_DOUBLE,all_times,Bmark->Ntimes,MPI_DOUBLE,0,MPI_COMM_WORLD); MPI_ERRHAND(ierr); #ifdef CHECK /* collect all defects */ ierr=MPI_Gather(&defect,1,MPI_DOUBLE,all_defect,1,MPI_DOUBLE,0,MPI_COMM_WORLD); MPI_ERRHAND(ierr); #endif if( DO_OUT ) { BTYPES type= Bmark->RUN_MODES[0].type; if ( Bmark->RUN_MODES[0].NONBLOCKING ) edit_type = 4; else if ( type == SingleTransfer && c_info->group_mode != 0 ) edit_type=0; else if ( type == ParallelTransfer || type == SingleTransfer ) edit_type=1; else if (type == Collective ) #ifdef MPIIO edit_type=1; #else edit_type=2; #endif else edit_type=3; if( header ) { fprintf(unit,"\n"); /* FOR GNUPLOT: CURVE SEPERATOR */ if( GROUP_OUT ) {strcpy(aux_string,"&Group") ; li_len=1;} else {strcpy(aux_string,""); li_len=0;} if ( edit_type == 0 ) { li_len+=4; strcat(aux_string,"&#bytes&#repetitions&t[usec]&Mbytes/sec&"); } else if ( edit_type == 1 ) { li_len+=6; strcat(aux_string, "&#bytes&#repetitions&t_min[usec]&t_max[usec]&t_avg[usec]&Mbytes/sec&"); } else if ( edit_type == 2 ) { li_len+=5; strcat(aux_string, "&#bytes&#repetitions&t_min[usec]&t_max[usec]&t_avg[usec]&"); } else if ( edit_type == 3 ) { li_len+=4; strcat(aux_string, "&#repetitions&t_min[usec]&t_max[usec]&t_avg[usec]&"); } else { li_len+=6; strcat(aux_string, "&#bytes&#repetitions&t_ovrl[usec]&t_pure[usec]&t_CPU[usec]& overlap[%]&"); } #ifdef CHECK if( Bmark->RUN_MODES[0].type != Sync && strcmp(Bmark->name,"Window") ) { li_len+=1; strcat(aux_string,"&defects&"); } #endif IMB_make_line(li_len); if( c_info->n_groups > 1) fprintf(unit,"# Benchmarking Multi-%s ",Bmark->name); else fprintf(unit,"# Benchmarking %s ",Bmark->name); IMB_show_procids(c_info); IMB_make_line(li_len); switch(BMODE->AGGREGATE) { case 1: fprintf(unit,"#\n# MODE: AGGREGATE \n#\n"); break; case 0: fprintf(unit,"#\n# MODE: NON-AGGREGATE \n#\n"); break; } IMB_print_headlines(aux_string); } /*if( header )*/ if( GROUP_OUT ) { /* IMB 3.1 << use ITERATIONS object */ for( i_gr=0; i_gr<c_info->n_groups; i_gr++ ) { if(i_gr == 0) fprintf(unit,"\n"); IMB_display_times(Bmark, all_times, c_info, i_gr, ITERATIONS->n_sample, size, edit_type); } /*for( i_gr=0; */ } else IMB_display_times(Bmark, all_times, c_info, 0, ITERATIONS->n_sample, size, edit_type); } /*if( DO_OUT )*/