void printResponseCb(Rx64IoSampleResponse& rx, uintptr_t data) { Print *p = (Print*)data; p->println("Rx64IoSampleResponse received:"); printField(p, F(" From: 0x"), rx.getRemoteAddress64()); printField(p, F(" Rssi: 0x"), rx.getRssi()); printField(p, F(" Receive options: 0x"), rx.getOption()); printField(p, F(" Number of samples: 0x"), rx.getSampleSize()); printSamples(p, rx); }
void doTest(int messSize, int reportRank, int compIters, int innerIters, int testIters) { int x, totalSamples, myRank, worldSize; double *loopSamples, *opSamples; double totalLoopTime, totalOpTime; double loopMean, opMean; double *sendBuf, *recvBuf; double wtick; MPI_Comm_rank(MPI_COMM_WORLD, &myRank); MPI_Comm_size(MPI_COMM_WORLD, &worldSize); if ( (sendBuf = (double*)malloc(messSize*sizeof(double))) == NULL ) { printf("Failed to malloc sendBuf\n"); exit(-1); } if ( (recvBuf = (double*)malloc(messSize*sizeof(double))) == NULL ) { printf("Failed to malloc recvBuf\n"); exit(-1); } /* Collect Computation Loop Timing Data */ getLoopSamples(compIters, innerIters, testIters, &loopSamples, sendBuf, recvBuf, messSize); /* Collect Operation & Computation Loop Timing Data */ getOpSamples(compIters, innerIters, testIters, &opSamples, sendBuf, recvBuf, messSize); totalSamples = testIters; totalLoopTime = 0.0; totalOpTime = 0.0; wtick = MPI_Wtick(); listRankLocations(myRank, worldSize); if ( myRank == reportRank ) { for ( x = 0; x < totalSamples; x++ ) { totalLoopTime += loopSamples[x]; totalOpTime += opSamples[x]; } loopMean = totalLoopTime / totalSamples; opMean = totalOpTime / totalSamples; #ifdef PRINT_SAMPLES printSamples("Loop Base Samples", loopSamples, testIters); printSamples("Loop Op Samples", opSamples, testIters); #endif printf("\nMPI Allreduce test\n"); printf(" for %d MPI processes, message size %d bytes, \n", worldSize, messSize*sizeof(double)); printf(" %d operations per sample, %d samples\n\n", innerIters, totalSamples); printf(" Wtick resolution : %11.3f us\n", wtick*1000000); printf(" Time between Allreduce : %11.3f us\n\n", (getDoCompTime(compIters, sendBuf, recvBuf)*1000000)); printf(" Mean Compute Loop Time : %11.3f us\n", loopMean*1000000); printf(" Ticks per Compute Loop : %11.0f\n", loopMean/wtick); printf(" Mean Op Loop Time : %11.3f us\n", opMean*1000000); printf(" Ticks per Op Loop : %11.0f\n\n", opMean/wtick); printf(" Op mean : %11.3f us\n\n", ((totalOpTime - totalLoopTime)/(totalSamples*innerIters))*1000000); } free(loopSamples); free(opSamples); free(sendBuf); free(recvBuf); }