SURFEX v8.1
General documentation of Surfex
mpl_ioinit_mod.F90
Go to the documentation of this file.
2 
3 !
4 ! Purpose. initialise parallel IO environment
5 ! --------
6 !
7 !
8 ! Interface.
9 ! ----------
10 ! call mpl_ioinit(...)
11 !
12 ! Explicit arguments :
13 ! --------------------
14 !
15 ! input arguments:
16 ! kop - Style of parallel IO
17 ! kstrout - Number of output processors
18 ! output arguments:
19 ! kerror - error code
20 !
21 ! Implicit arguments :
22 ! --------------------
23 !
24 ! Method.
25 ! -------
26 ! MPL supports 4 styles of MPIIO
27 !
28 ! kop = 1 - Blocking, non collective, shared file pointer
29 ! using MPI_FILE_WRITE_SHARED,
30 ! MPI_FILE_READ_SHARED
31 ! kop = 2 - Blocking, collective, ordered, shared file pointer
32 ! using MPI_FILE_WRITE_ORDERED,
33 ! MPI_FILE_READ_ORDERED
34 ! kop = 3 - Non Blocking, non collective, shared file pointer
35 ! using MPI_FILE_IWRITE_SHARED,
36 ! MPI_FILE_IREAD_SHARED
37 ! and MPI_WAIT
38 ! kop = 4 - Non Blocking, collective, ordered, shared file pointer
39 ! using MPI_FILE_WRITE_ORDERED_BEGIN/END,
40 ! MPI_FILE_READ_ORDERED_BEGIN/END
41 !
42 ! Externals.
43 ! ----------
44 !
45 ! Reference.
46 ! ----------
47 ! none yet
48 !
49 ! Author.
50 ! -------
51 ! G.Mozdzynski
52 !
53 ! Modifications.
54 ! --------------
55 ! Original : 2000-12-08 (Based on MPE_IOINIT)
56 !
57 ! -----------------------------------------------------------------
58 !
59 
60 USE parkind1 ,ONLY : jpim ,jprb
61 
62 USE mpl_mpif
65 
66 IMPLICIT NONE
67 
68 
69 INTEGER(KIND=JPIM) :: mpl_numio
70 INTEGER(KIND=JPIM) :: mpl_iop
71 INTEGER(KIND=JPIM) :: mpl_comm_io
72 
73 PRIVATE
75 
76 CONTAINS
77 
78 SUBROUTINE mpl_ioinit(KOP,KSTROUT,KERROR)
79 
80 
81 #ifdef USE_8_BYTE_WORDS
82  USE mpi4to8, ONLY : &
83  mpi_comm_split => mpi_comm_split8
84 #endif
85 
86 INTEGER(KIND=JPIM),INTENT(IN) :: KOP,KSTROUT
87 INTEGER(KIND=JPIM),INTENT(OUT) :: KERROR
88 INTEGER(KIND=JPIM) :: COLOR,KEY
89 
90 !
91 ! -----------------------------------------------------------------
92 !
93 ! 1. Preamble
94 ! --------
95 
96 IF(kop < 1 .OR. kop > 4) THEN
97 
98  kerror = -1
99  RETURN
100 
101 ENDIF
102 
103 !
104 ! -----------------------------------------------------------------
105 !
106 ! 2. Check Style of Operation and take appropriate action
107 ! -------------------------------------------------------
108 
109 mpl_numio = kstrout
110 
111 mpl_iop = kop
112 
113 IF(mpl_rank <= kstrout) THEN
114  color = 1
115 ELSE
116  color = mpi_undefined
117 ENDIF
118 
119 key = 0
120 
121 CALL mpi_comm_split(mpl_comm,color,key,mpl_comm_io,kerror)
122 
123 !
124 !
125 ! -----------------------------------------------------------------
126 RETURN
127 END SUBROUTINE mpl_ioinit
128 
129 END MODULE mpl_ioinit_mod
integer, parameter jpim
Definition: parkind1.F90:13
integer(kind=jpim), public mpl_iop
integer(kind=jpim), public mpl_numio
subroutine, public mpl_ioinit(KOP, KSTROUT, KERROR)
integer, parameter jprb
Definition: parkind1.F90:32
integer(kind=jpim) mpl_comm
integer(kind=jpim), public mpl_comm_io
integer(kind=jpim) mpl_rank