Nature Language: testPingpong:Verifies that the Ping Pong benchmark worked correctly.
CPP: int testPingpong(int sizeofBuffer,int dataSize){\n\tint i, testFlag;\n\tint *testBuf;\n\t/* PingRank process checks if pingpong worked ok. */\n\tif (myMPIRank == pingRank){\n\t\t/* initialise testFlag to true (test passed) */\n\t\ttestFlag = TRUE;\n\t\t/* allocate space for the testBuf */\n\t\ttestBuf = (int *)malloc(sizeofBuffer * sizeof(int));\n\t\t/* construct testBuf array with correct values.\n\t\t * These are the values that should be in finalRecvBuf.\n\t\t */\n#pragma omp parallel for default(none) \\\n\t\tprivate(i) \\\n\t\tshared(testBuf,dataSize,sizeofBuffer,globalIDarray) \\\n\t\tschedule(static,dataSize)\n\t\tfor (i=0; i<sizeofBuffer; i++){\n\t\t\ttestBuf[i] = globalIDarray[myThreadID];\n\t\t}\n\t\t/* compare each element of testBuf and finalRecvBuf */\n\t\tfor (i=0; i<sizeofBuffer; i++){\n\t\t\tif (testBuf[i] != finalRecvBuf[i]){\n\t\t\t\ttestFlag = FALSE;\n\t\t\t}\n\t\t}\n\t\t/* free space for testBuf */\n\t\tfree(testBuf);\n\t}\n\t/* pingRank broadcasts testFlag to the other processes */\n    MPI_Bcast(&testFlag, 1, MPI_INT, pingRank, comm);\n    /* Master process sets the testOutcome using testFlag. */\n    if (myMPIRank == 0){\n    \tsetTestOutcome(testFlag);\n    }\n    return 0;\n}
Fortran: SUBROUTINE testPingPong(sizeofBuffer, dataSize)\n integer, intent(in) :: sizeofBuffer, dataSize\n integer :: i\n logical :: testFlag\n\n !PingRank process checks if pingpong worked ok\n IF (myMPIRank == pingRank) THEN\n !initialise testFlag to true (test passed)\n testFlag = .true.\n\n !allocate space for the testBuf\n allocate(testBuf(sizeofBuffer))\n \n !Construct testBuf array with correct values.\n !These are the values that should be in finalRecvBuf.\n!$OMP PARALLEL DO DEFAULT(NONE), &\n!$OMP PRIVATE(i), &\n!$OMP SHARED(testBuf,dataSize,sizeofBuffer,globalIDarray), &\n!$OMP SCHEDULE(STATIC,dataSize) \n\n DO i = 1,sizeofBuffer\n testBuf(i) = globalIDarray(myThreadID)\n END DO\n\n!$OMP END PARALLEL DO\n \n !Compare each element of testBuf and finalRecvBuf\n DO i = 1, sizeofBuffer\n IF (testBuf(i) /= finalRecvBuf(i)) THEN\n testFlag = .false.\n END IF\n END DO\n\n !free space for testBuf\n deallocate(testBuf)\n \n END IF\n\n !pingRank broadcasts testFlag to the other processes\n CALL MPI_Bcast(testFlag, 1, MPI_LOGICAL, pingRank, comm, ierr)\n\n !Master process receives sets the testOutcome using testFlag.\n IF (myMPIRank == 0) THEN\n CALL setTestOutcome(testFlag)\n END IF\n \n END SUBROUTINE testPingPong