Changes between Initial Version and Version 1 of cypress/Programming/FortranExamples/MpiFortran


Ignore:
Timestamp:
May 15, 2015 10:03:30 AM (7 years ago)
Author:
cmaggio
Comment:

migrated content from ccs wiki

Legend:

Unmodified
Added
Removed
Modified
  • cypress/Programming/FortranExamples/MpiFortran

    v1 v1  
     1= MPI FORTRAN =
     2== Hello World ==
     3{{{#!fortran
     4!hello_mpi.f90: display a message on the screen
     5program helloworld
     6  include'mpif.h'
     7  !
     8  integer::myid, numproc, ierr
     9  ! Initialize 
     10  CALL MPI_INIT( ierr ) 
     11  !
     12  ! get myid and # of processors
     13  CALL MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
     14  CALL MPI_COMM_SIZE( MPI_COMM_WORLD, numproc, ierr )
     15 
     16  print *,"hello from ", myid
     17 
     18  ! wait until all processors come here
     19  CALL MPI_Barrier (MPI_COMM_WORLD,ierr);
     20 
     21  if (myid == 0) then
     22     ! only myid = 0 do this
     23     print *, numproc," processors said hello!"
     24  endif
     25 
     26  CALL  MPI_Finalize(ierr);
     27end program helloworld
     28}}}
     29
     30== Compile ==
     31{{{mpif90 hello_mpi.f90}}}
     32
     33== Example of Jobscript ==
     34[[https://wiki.hpc.tulane.edu/trac/wiki/cypress/Programming/Cexamples#ExamplesofJobscript| See Example]]