Esempio n. 1
0
/*
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_TIME_ID];

    int i,i_gr;
    int li_len;
    int out_format;

    const int DO_OUT    = (c_info->w_rank  == 0)   ? 1 : 0;
    const int GROUP_OUT = (c_info->group_mode > 0) ? 1 : 0;

    ierr = 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;
        const int n_groups = GROUP_OUT ? c_info->n_groups : 1;

        if ( Bmark->RUN_MODES[0].NONBLOCKING && type != Sync) 
        {
            out_format = OUT_OVERLAP;
        } 
        else if ( (type == SingleTransfer && c_info->group_mode != 0) || 
                   type == MultPassiveTransfer || 
                   type == SingleElementTransfer ) 
        {
            out_format = OUT_TIME_AND_BW;
        } 
        else if ( type == ParallelTransfer || type == SingleTransfer ) 
        {
            out_format = OUT_TIME_RANGE_AND_BW;
        } 
        else if ( type == ParallelTransferMsgRate ) 
        {
            out_format = OUT_BW_AND_MSG_RATE;
        }
        else if (type == Collective ) 
        {
#ifdef MPIIO
            out_format = OUT_TIME_RANGE_AND_BW;
#else
            out_format = OUT_TIME_RANGE;
#endif
        } 
        else 
        {
            out_format = OUT_SYNC;
        }

        if (header)
        {
            IMB_print_header (out_format, Bmark, c_info, BMODE);
        } 

        if( GROUP_OUT )
        {
            fprintf(unit,"\n");
        }

        for(i_gr = 0; i_gr < n_groups; i_gr++)
        {
            IMB_display_times(Bmark, all_times, c_info, i_gr, ITERATIONS->n_sample, size, out_format);
        } 
    } /*if( DO_OUT )*/
}
Esempio n. 2
0
/*
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 )*/