Nature Language: scatterKernel:Implement the scatter benchmark. Root process first scatters send buffer to other processes. Each thread under a MPI process then reads its portion of scatterRecvBuf.
  
CPP: int scatterKernel(int totalReps, int dataSize){\\n\n    int repIter, i;\\n\n    int totalSendBufElems, sendCount, recvCount;\\n\n    totalSendBufElems = numMPIprocs * numThreads * dataSize;\\n\n    sendCount = dataSize * numThreads;\\n\n    recvCount = sendCount;\\n\n    for (repIter=0; repIter<totalReps; repIter++){\\n\n        if (myMPIRank == SCATTERROOT){\\n\n            for (i=0; i<totalSendBufElems; i++){\\n\n                scatterSendBuf[i] = SCATTERSTARTVAL + i;\\n\n            }\\n\n        }\\n\n        MPI_Scatter(scatterSendBuf, sendCount, MPI_INT, \\n\n            scatterRecvBuf, recvCount, MPI_INT, \\n\n            SCATTERROOT, comm);\\n\n        #pragma omp parallel for default(none)\t\t\t\\\\\\n\n            private(i)\t\t\t\t\t\t\\\\\\n\n            shared(dataSize,recvCount,finalBuf,scatterRecvBuf)\t\\\\\\n\n            schedule(static,dataSize)\\n\n        for (i=0; i<recvCount; i++){\\n\n            /* loop over all data in recv buffer */\\n\n            finalBuf[i] = scatterRecvBuf[i];\\n\n        }\\n\n    } /* End of loop over reps */\\n\n    return 0;\\n\n}",
  
Fortran: SUBROUTINE scatterKernel(totalReps, dataSize)\ninteger, intent(in) :: totalReps, dataSize\ninteger :: repIter, i\ninteger :: totalSendBufElems, sendCount, recvCount\n\n!Calculate totalSendBufElems\ntotalSendBufElems = numMPIprocs * numThreads * dataSize\n!Calculate sendCount\nsendCount = dataSize * numThreads\nrecvCount = sendCount\n\nDO repIter = 1, totalReps\n\n!Master process writes to scatterSendBuf\nIF (myMPIRank == SCATTERROOT) THEN\nDO i = 1, totalSendBufElems\nscatterSendBuf(i) = SCATTERSTARTVAL + i\nEND DO\nEND IF\n\n!Scatter the data to other processes\nCALL MPI_Scatter(scatterSendBuf, sendCount, MPI_INTEGER, &\nscatterRecvBuf, recvCount, MPI_INTEGER, &\nSCATTERROOT, comm, ierr)\n\n!Each thread now reads its portion of scatterRecvBuf\n!$OMP PARALLEL DO DEFAULT(NONE),&\n!$OMP PRIVATE(i),&\n!$OMP SHARED(dataSize,recvCount,finalBuf,scatterRecvBuf),&\n!$OMP SCHEDULE(STATIC,dataSize)\n\nDO i = 1, recvCount !looping over all data in recv buffer\nfinalBuf(i) = scatterRecvBuf(i)\nEND DO\n\n!$OMP END PARALLEL DO\n\nEND DO !End repetitions loop\n\nEND SUBROUTINE scatterKernel
  