program main c*********************************************************************72 c cc MAIN is the main program for HELLO. c c Licensing: c c This code is distributed under the GNU LGPL license. c include 'mpif.h' integer error integer id integer p_num c c Initialize MPI. c call MPI_Init ( error ) c c Get the number of processes. c call MPI_Comm_size ( MPI_COMM_WORLD, p_num, error ) c c Get the individual process ID. c call MPI_Comm_rank ( MPI_COMM_WORLD, id, error ) c c Only the master process prints this message. c if ( id .eq. 0 ) then write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'HELLO - Master process:' write ( *, '(a)' ) ' FORTRAN77 version' write ( *, '(a)' ) ' A simple MPI program.' write ( *, '(a)' ) ' ' write ( *, '(a,i3)' ) ' The number of processes is ', p_num write ( *, '(a)' ) ' ' end if c c Every process prints this message. c write ( *, '(a)' ) ' ' write ( *, '(a,i3)' ) ' Hello from process ', id c c Shut down MPI. c call MPI_Finalize ( error ) stop end