Nature Language: exchangeWorldRanks:Finds the MPI_COMM_WORLD ranks of the processes participating in the multi-pingpong and multi-pingping benchmarks.
  
CPP: int exchangeWorldRanks(int nodeA, int nodeB, int *otherWorldRank) {\n\\n    int destRank;\n\\n    if (crossCommRank == nodeA) {\n\\n        destRank = nodeB;\n\\n    } else if (crossCommRank == nodeB) {\n\\n        destRank = nodeA;\n\\n    }\n\\n    if (crossCommRank == nodeA || crossCommRank == nodeB) {\n\\n        MPI_Isend(&myMPIRank, 1, MPI_INT, destRank, TAG, crossComm, &requestID);\n\\n        MPI_Recv(otherWorldRank, 1, MPI_INT, destRank, TAG, crossComm, &status);\n\\n        MPI_Wait(&requestID, &status);\n\\n    }\n\\n    return 0;\n\\n}",
  
Fortran: SUBROUTINE exchangeWorldRanks(nodeA, nodeB, otherWorldRank)\ninteger, intent(in) :: nodeA, nodeB\ninteger, intent(out) :: otherWorldRank\ninteger :: destRank\n\nIF (crossCommRank == nodeA) THEN\ndestRank = nodeB\nELSE IF (crossCommRank == nodeB) THEN\ndestRank = nodeA\nEND IF\n\nIF (crossCommRank == nodeA .or. crossCommRank == nodeB) THEN\nCALL MPI_Isend(myMPIRank, 1, MPI_INTEGER, destRank, &\ntag, crossComm, requestID, ierr)\nCALL MPI_Recv(otherWorldRank, 1, MPI_INTEGER, destRank, &\ntag, crossComm, status, ierr)\nCALL MPI_Wait(requestID, status, ierr)\nEND IF\n\nEND SUBROUTINE exchangeWorldRanks
  