SURFEX v8.1
General documentation of Surfex
mpl_nproc_mod.F90
Go to the documentation of this file.
2 !**** MPL_NPROC - return Number of processes
3 
4 ! Input optional arguments :
5 ! -------------------------
6 ! KCOMM - Communicator number if different from MPI_COMM_WORLD
7 
8 ! Author.
9 ! -------
10 ! D.Dent, M.Hamrud ECMWF
11 
12 ! Modifications.
13 ! --------------
14 ! Original: 2000-09-01
15 
16 ! ------------------------------------------------------------------
17 
18 USE parkind1 ,ONLY : jpim ,jprb
21 
22 IMPLICIT NONE
23 PRIVATE
24 PUBLIC mpl_nproc
25 
26 CONTAINS
27 FUNCTION mpl_nproc(KCOMM)
28 
29 #ifdef USE_8_BYTE_WORDS
30  USE mpi4to8, ONLY : &
31  mpi_comm_size => mpi_comm_size8
32 #endif
33 
34 INTEGER(KIND=JPIM),INTENT(IN),OPTIONAL :: KCOMM
35 INTEGER(KIND=JPIM) :: MPL_NPROC
36 
37 INTEGER(KIND=JPIM) :: IERROR,IPROC
38 LOGICAL :: LLABORT=.true.
39 
40 IF(mpl_numproc < 1) CALL mpl_message( &
41  & cdmessage='MPL_MYRANK: MPL NOT INITIALISED ',ldabort=llabort)
42 IF(PRESENT(kcomm)) THEN
43  CALL mpi_comm_size(kcomm,iproc,ierror)
44  mpl_nproc = iproc
45 ELSE
46  mpl_nproc = mpl_numproc
47 ENDIF
48 
49 
50 END FUNCTION mpl_nproc
51 END MODULE mpl_nproc_mod
52 
subroutine, public mpl_message(KERROR, CDMESSAGE, CDSTRING, LDABORT)
integer, parameter jpim
Definition: parkind1.F90:13
integer(kind=jpim) mpl_numproc
integer, parameter jprb
Definition: parkind1.F90:32
integer(kind=jpim) function, public mpl_nproc(KCOMM)