#include "bench7.h" /* ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c R7 is the output routine for Benchmark 7. c c This will need to be modified to contain the particular c configuration information requested. c c Parameters: c Provided by calling routine: c NBUFS = Number of buffers of the A-stream c where a buffer is 11264000 words = 720 896 000 bits c Default is 100 buffers = 72 089 600 000 bits c NZ = Number of zeros required C NN = The number of solutions found c START = An array of starting locations for each solution c LENGTH = An array of lengths for each solution c OK = Array =0 if solution(i) agrees w. check values, else 1 c IER = Error flag array c IER[0] = 0, or expected number of sol's if wrong no. found c IER[1] = Number of solutions that are incorrect c NPES = Number of PEs for this run (for parallel versions) c CSET = CPU time required to generate the data c WSET = Wallclock time required to generate the data c CRUN = CPU time required to do the benchmark c WRUN = Wallclock time required to do the benchmark c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc */ void r7 ( int nbufs, uint64 *start, int64 *length, int *ok, int64 nn, int *ier, #if defined(USE_MPI) || defined(USE_SHMEM) int npes, #endif double cset, double wset, double crun, double wrun ) { int64 abits, ebits; int i; char * date(); #if defined(USE_MPI) printf ( "\n\n\nBenchmark #7 - Bit Twiddle - MPI C version" ); #elif defined(USE_SHMEM) printf ( "\n\n\nBenchmark #7 - Bit Twiddle - Shmem C version" ); #else printf ( "\n\n\nBenchmark #7 - Bit Twiddle - C version" ); #endif #ifdef USE_MEM printf( " - no disk\n\n" ); #else printf( "\n\n" ); #endif printf ( "Date: %s\n\n", date() ); #if defined(USE_MPI) || defined(USE_SHMEM) printf ( "Number of processors: %d\n\n", npes ); #endif abits = (int64)nbufs * BUFSIZE * 64; ebits = (abits * 5) / 11; printf ( "Length of bit stream A = %d buffers\n", nbufs ); printf ( " = %ld bits\n\n", abits ); printf ( "Length of E stream = %ld bits\n\n", ebits ); printf ( "Length of zero sequence required = %d\n\n", NZ ); printf ( "Time for set up:\n" ); printf ( " CPU = %12.4f seconds\n", cset ); printf ( " Wall Clock = %12.4f seconds\n\n", wset ); printf ( "Time to run:\n" ); printf ( " CPU = %12.4f seconds\n", crun ); printf ( " Wall Clock = %12.4f seconds\n\n", wrun ); if ( ier[0] == 0 ) { printf ( "Correct number of solutions found: %d\n\n", nn ); } else { printf ( "Incorrect number of solutions found\n" ); printf ( " Expected %d\n Found %d\n\n", ier[0], nn ); } if ( ier[1] > 0 ) printf ( "%d of the %d solutions are incorrect\n\n", ier[1], nn ); /* If less than twenty solutions, print out all solutions */ if ( (nn <= 20 && nn > 0) || (ier[1] > 0) ) { printf ( "\nIndex Starting Position Number of Zeros Error\n" ); for ( i = 0; i < nn; i++ ) if (ok[i] == 0) printf ( " %3d %15ld %6ld\n", i, start[i], length[i] ); else printf ( " %3d %15ld %6ld ***\n", i, start[i], length[i] ); } else /* Otherwise, print out first 5, middle 10, and last 5 positions */ if ( nn > 0 ) { /* Check for too many solutions */ if ( nn > MAXANS ) { printf ( "\n\n***** WARNING: Too many solutions *****\n" ); printf ( "Number of zero stretches found: %d\n", nn ); printf ( "Only first %d were recorded\n", MAXANS ); printf ( "Only first %d were checked\n", MAXCKS ); printf ( "Those not checked are flagged as ???\n\n" ); nn = MAXANS; /* print below from all saved solutions */ } printf ( "\nFirst 5, Middle 10, and Last 5 Solutions\n" ); printf ( "\nIndex Starting Position Number of Zeros Error\n" ); for ( i = 0; i < 5; i++ ) if (ok[i] == 0) printf ( " %3d %15ld %6ld\n", i, start[i], length[i] ); else if (ok[i] == 1) printf ( " %3d %15ld %6ld ***\n", i, start[i], length[i] ); else printf ( " %3d %15ld %6ld ???\n", i, start[i], length[i] ); printf ( "\n" ); for ( i = nn/2 - 5; i < nn/2 + 5; i++ ) if (ok[i] == 0) printf ( " %3d %15ld %6ld\n", i, start[i], length[i] ); else if (ok[i] == 1) printf ( " %3d %15ld %6ld ***\n", i, start[i], length[i] ); else printf ( " %3d %15ld %6ld ???\n", i, start[i], length[i] ); printf ( "\n" ); for ( i = nn - 5; i < nn; i++ ) if (ok[i] == 0) printf ( " %3d %15ld %6ld\n", i, start[i], length[i] ); else if (ok[i] == 1) printf ( " %3d %15ld %6ld ***\n", i, start[i], length[i] ); else printf ( " %3d %15ld %6ld ???\n", i, start[i], length[i] ); } printf("\n\n"); return; }