National Technical University of Athens (NTUA), GreeceInstitute of Structural Analysis & Seismic Research (ISASR) Λογισμικό MPI Program MPIHelloWorld Implicit None Include fmpi.h Integer :: iRank, iNoOfProcs, iErr, iSource, iDest, iTag=50 Character, Len=50 :: cMessage Type (MPI_Status) :: status Call MPI_Init(iErr) Call MPI_Comm_rank(MPI_COMM_WORLD, iRank, iErr) Call MPI_Comm_size(MPI_COMM_WORLD, iNoOfProcs, iErr) if (iRank.GT.0) then iDest = 0 Write(cMessage, *) Greetings from process: , iRank Call MPI_Send(cMessage, 50, MPI_CHARACTER, iDest, iTag, & MPI_COMM_WORLD, iErr) else Do iSource=1, iNoOfProcs – 1 Call MPI_Recv(cMessage, 50, MPI_CHARACTER, iSource, & iTag, MPI_COMM_WORLD, status, iErr) Write(*, *) cMessage End Do end if Call MPI_Finalize(iErr) End Program Πρόγραμμα Hello world
{}