eplf/mpi.irp.f

36 lines
603 B
Fortran

BEGIN_PROVIDER [ integer, mpi_rank ]
&BEGIN_PROVIDER [ integer, mpi_size ]
&BEGIN_PROVIDER [ logical, mpi_master ]
implicit none
IRP_IF MPI
include 'mpif.h'
IRP_ENDIF
BEGIN_DOC
! mpi_rank : ID of the current processor
!
! mpi_size : Total number of processors
!
! mpi_master : True if the current processor is the master
END_DOC
mpi_size = 1
mpi_rank = 0
IRP_IF MPI
integer :: ierr
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, mpi_rank, ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD, mpi_size, ierr)
IRP_ENDIF
mpi_master = (mpi_rank == 0)
END_PROVIDER