File: helloworld.f90

package info (click to toggle)
mpi4py 1.3%2Bhg20120611-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,020 kB
  • sloc: python: 9,503; ansic: 6,296; makefile: 571; f90: 158; sh: 146; cpp: 103
file content (31 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
!
! $ f2py --f90exec=mpif90 -m helloworld -c helloworld.f90
!

subroutine sayhello(comm)
  use mpi
  implicit none
  integer :: comm
  integer :: rank, size, nlen, ierr
  character (len=MPI_MAX_PROCESSOR_NAME) :: pname
  if (comm == MPI_COMM_NULL) then
     print *, 'You passed MPI_COMM_NULL !!!'
     return
  end if
  call MPI_Comm_rank(comm, rank, ierr)
  call MPI_Comm_size(comm, size, ierr)
  call MPI_Get_processor_name(pname, nlen, ierr)
  print *, 'Hello, World!', &
       ' I am process ', rank, &
       ' of ', size, &
       ' on ', pname(1:nlen), '.'
end subroutine sayhello

! program main
!   use mpi
!   implicit none
!   integer ierr
!   call MPI_Init(ierr)
!   call sayhello(MPI_COMM_WORLD)
!   call MPI_Finalize(ierr)
! end program main