! hello_ex.f90 include "mpiSim.f90" program hello include "useSim.f90" !! basic MPI program skeleton with !! MPI_Init, MPI_Comm_Rank, MPI_Comm_Size !! MPI_Get_processor_name, MPI_Barrier, MPI_Wtime !! MPI_Finalize ! Author Unknown. implicit none ! include 'mpif.h' integer :: myrank, nprocs, n, islave, master integer :: status(MPI_STATUS_SIZE) integer :: ierr, resultlen, tag character (LEN=8) :: hostname Double Precision :: t1, t2 ! Initialize MPI Call MPI_Init(ierr) ! Get my rank id and number of MPI processes call MPI_Comm_Rank(MPI_COMM_WORLD, myrank, ierr) call MPI_Comm_Size(MPI_COMM_WORLD, nprocs, ierr) ! Get hostname call MPI_Get_processor_name(hostname, resultlen, ierr) ! Synchonization point call MPI_Barrier (MPI_COMM_WORLD, ierr) ! measure runtime t1 = MPI_Wtime() !----------------------------------------------------------- ! Do work here ... Write (*,*) "Hello! --- Rank ", myrank, " out of ", nprocs, & " processes running on ", hostname(1:index(hostname,".")-1) !----------------------------------------------------------- ! Synchronization point call MPI_Barrier (MPI_COMM_WORLD, ierr) ! measure runtime t2 = MPI_Wtime() write (*,*) "slave ", myrank, ": ", t2-t1, " seconds" ! Shut Down MPI call MPI_Finalize(ierr ) end program hello nalize(ierr ) end program hello