!******************************************************************** ! program : mpi_samp1.f90 ! programmer : makoto nakajima ! description: hello, world! ! date : april 25, 2006 !******************************************************************** program main implicit none !prohibit implicit declaration of variables include 'mpif.h' !include mpi library !******* variables related mpi ******* integer:: ierror !return error message from mpi subroutines integer:: id !identification number of each processor integer:: nproc !total number of processors !******* initialization ******* !initialization of mpi environment call mpi_init(ierror) !obtain id for each node call mpi_comm_rank(mpi_comm_world, id, ierror) !returns the number of nodes call mpi_comm_size(mpi_comm_world, nproc, ierror) !******* main part of program ******* !each node prints out. !notice that each node prints out once, with different value of id. print *, 'hello, world! i am node ',id !******* finalize mpi environment ******* call mpi_finalize(ierror) end program main