Nature Language: pingPing:Driver subroutine for the pingping benchmark.
  
CPP: int pingPing(int benchmarkType){\n    int dataSizeIter;\n    int sameNode;\n    pingRankA = PPRanks[0];\n    pingRankB = PPRanks[1];\n\n    sameNode = compareProcNames(pingRankA, pingRankB);\n\n    if (myMPIRank == 0){\n        printNodeReport(sameNode,pingRankA,pingRankB);\n        printBenchHeader();\n    }\n\n    repsToDo = defaultReps;\n    dataSizeIter = minDataSize; /* initialise dataSizeIter to minDataSize */\n\n    while (dataSizeIter <= maxDataSize){\n        sizeofBuffer = dataSizeIter * numThreads;\n        allocatePingpingData(sizeofBuffer);\n\n        if (benchmarkType == MASTERONLY){\n            masteronlyPingping(warmUpIters, dataSizeIter);\n        } else if (benchmarkType == FUNNELLED){\n            funnelledPingping(warmUpIters, dataSizeIter);\n        } else if (benchmarkType == MULTIPLE){\n            multiplePingping(warmUpIters, dataSizeIter);\n        }\n\n        testPingping(sizeofBuffer, dataSizeIter);\n        benchComplete = FALSE;\n\n        while (benchComplete != TRUE){\n            MPI_Barrier(comm);\n            startTime = MPI_Wtime();\n\n            if (benchmarkType == MASTERONLY){\n                masteronlyPingping(repsToDo, dataSizeIter);\n            } else if (benchmarkType == FUNNELLED){\n                funnelledPingping(repsToDo, dataSizeIter);\n            } else if (benchmarkType == MULTIPLE){\n                multiplePingping(repsToDo, dataSizeIter);\n            }\n\n            MPI_Barrier(comm);\n            finishTime = MPI_Wtime();\n            totalTime = finishTime - startTime;\n\n            if (myMPIRank==0){\n                benchComplete = repTimeCheck(totalTime, repsToDo);\n            }\n\n            MPI_Bcast(&benchComplete, 1, MPI_INT, 0, comm);\n            MPI_Bcast(&repsToDo, 1, MPI_INT, 0, comm);\n        }\n\n        if (myMPIRank == 0){\n            setReportParams(dataSizeIter, repsToDo, totalTime);\n            printReport();\n        }\n\n        freePingpingData();\n        dataSizeIter = dataSizeIter * 2; /* double data size */\n    }\n\n    return 0;\n}",
  
Fortran: SUBROUTINE pingPing(benchmarkType)\n integer, intent(in) :: benchmarkType\n integer :: dataSizeIter\n logical :: sameNode\n\n pingRankA = PPRanks(1)\n pingRankB = PPRanks(2)\n\n !Check if pingRankA and pingRankB are on the same node\n sameNode = compareProcNames(pingRankA, pingRankB)\n \n IF (myMPIRank == 0) THEN\n !print message saying if benchmark is inter or intra node\n CALL printNodeReport(sameNode,pingRankA,pingRankB)\n !..then print benchmark report column headings.\n CALL printBenchHeader()\n END IF\n\n !initialise repsToDo to defaultReps\n repsToDo = defaultReps\n\n !Start loop over data sizes\n dataSizeIter = minDataSize !initialise dataSizeIter\n DO WHILE (dataSizeIter <= maxDataSize)\n \n !set size of buffer\n sizeofBuffer = dataSizeIter * numThreads\n\n !Allocate space for main data arrays\n CALL allocateData(sizeofBuffer)\n\n !warm-up for benchmarkType\n IF (benchmarkType == MASTERONLY) THEN\n !Masteronly warmup sweep\n CALL masteronlyPingping(warmUpIters, dataSizeIter)\n ELSE IF (benchmarkType == FUNNELLED) THEN\n !funnelled warmup\n CALL funnelledPingping(warmUpIters, dataSizeIter)\n ELSE IF (benchmarkType == MULTIPLE) THEN\n !perform multiple pinping warmup\n CALL multiplePingping(warmUpIters, dataSizeIter)\n END IF\n\n !Perform verification test for pingping\n !this is only done by pingRankA and pingRankB\n CALL testPingping(sizeofBuffer, dataSizeIter)\n \n !Initialise the benchmark\n benchComplete = .false.\n !Execute benchmark until target time is reached\n DO WHILE (benchComplete .NEQV. .true.)\n !Start timer.\n CALL MPI_Barrier(comm, ierr)\n startTime = MPI_Wtime()\n \n !Execute benchmarkType for repsToDo repetitions\n IF (benchmarkType == MASTERONLY) THEN\n CALL masteronlyPingping(repsToDo, dataSizeIter)\n ELSE IF (benchmarkType == FUNNELLED) THEN\n CALL funnelledPingping(repsToDo, dataSizeIter)\n ELSE IF (benchmarkType == MULTIPLE) THEN\n CALL multiplePingping(repsToDo, dataSizeIter)\n END IF\n \n !Stop timer.\n CALL MPI_Barrier(comm, ierr)\n finishTime = MPI_Wtime()\n totalTime = finishTime - startTime\n\n !Test if target time was reached with number of\n !repetitions.\n if (myMPIRank==0) then \n benchComplete = repTimeCheck(totalTime, repsToDo)\n end if\n !Ensure all procs have the same value of benchComplete\n !and repsToDo\n call MPI_Bcast(benchComplete, 1, MPI_INTEGER, 0, comm, ierr)\n call MPI_Bcast(repsToDo, 1, MPI_INTEGER, 0, comm, ierr)\n \n END DO !End of benchComplete loop\n\n !Master process sets benchmark results\n IF (myMPIRank == 0) THEN\n CALL setReportParams(dataSizeIter,repsToDo,totalTime)\n CALL printReport()\n END IF\n\n !Free allocated data\n CALL freeData()\n\n !Double dataSize and loop again\n dataSizeIter = dataSizeIter * 2\n\n END DO !End loop over data sizes\n\n END SUBROUTINE pingPing
  