Nature Language: checkCrossCommBalance:Checks if there's a balance in the number of processes in crossComm nodes.
  
CPP: int crossCommBalance(int nodeA, int nodeB){\n    int localCommSize, otherLocalCommSize;\n    int crossCommBalance;\n\n    MPI_Comm_size(localComm, &localCommSize);\n\n    if ((crossCommRank == nodeB) && (localCommRank == 0)){\n        MPI_Send(&localCommSize, 1, MPI_INT, nodeA, TAG, crossComm);\n    }\n    else if ((crossCommRank == nodeA) && (localCommRank == 0)){\n        MPI_Recv(&otherLocalCommSize, 1, MPI_INT, nodeB, TAG, \\\n        crossComm, &status);\n\n        if (localCommSize == otherLocalCommSize){\n            crossCommBalance = TRUE;\n        }\n        else{\n            crossCommBalance = FALSE;\n        }\n\n        if (myMPIRank != 0){\n            MPI_Send(&crossCommBalance, 1, MPI_INT, 0, TAG, comm);\n        }\n    }\n\n    if (myMPIRank == 0){\n        if ((crossCommRank != nodeA) && (localCommRank != 0)){\n            MPI_Recv(&crossCommRank, 1, MPI_INT, MPI_ANY_SOURCE, \\\n            TAG, comm, &status);\n        }\n    }\n\n    MPI_Bcast(&crossCommBalance, 1, MPI_INT, 0, comm);\n\n    return crossCommBalance;\n}",
  
Fortran: FUNCTION crossCommBalance(nodeA, nodeB)\ninteger, intent(in) :: nodeA, nodeB\ninteger :: localCommSize, otherLocalCommSize\nlogical :: crossCommBalance\n\nCALL MPI_Comm_size(localComm, localCommSize, ierr)\n\nIF (crossCommRank == nodeB .and. localCommRank == 0) THEN\nCALL MPI_Send(localCommSize, 1, MPI_INTEGER, nodeA, &\ntag, crossComm, ierr)\nELSEIF (crossCommRank == nodeA .and. localCommRank == 0) THEN\nCALL MPI_Recv(otherLocalCommSize, 1, MPI_INTEGER, nodeB, &\ntag, crossComm, status, ierr)\nIF (localCommSize == otherLocalCommSize) THEN\ncrossCommBalance = .true.\nELSE \ncrossCommBalance = .false.\nEND IF\nIF (myMPIRank /= 0) THEN\nCALL MPI_Send(crossCommBalance, 1, MPI_LOGICAL, &\n0, tag, comm, ierr)\nEND IF\nEND IF\nIF (myMPIRank == 0) THEN\nIF (crossCommRank /= nodeA .and. localCommRank /= 0) THEN\nCALL MPI_Recv(crossCommBalance, 1, MPI_LOGICAL, &\nMPI_ANY_SOURCE, tag, comm, status, ierr)\nEND IF\nEND IF\nCALL MPI_Bcast(crossCommBalance, 1, MPI_LOGICAL, 0, comm, ierr)\n\nEND FUNCTION crossCommBalance
  