SURFEX v8.1
General documentation of Surfex
mpl_close_mod.F90
Go to the documentation of this file.
2 !
3 ! Purpose. close an MPIIO file
4 ! --------
5 !
6 !
7 ! Interface.
8 ! ----------
9 ! call mpl_close(...)
10 !
11 ! Explicit arguments :
12 ! --------------------
13 !
14 ! input arguments:
15 ! kfptr - handle for file pointer
16 ! output arguments:
17 ! kerror - error code
18 !
19 ! Implicit arguments :
20 ! --------------------
21 !
22 ! Method.
23 ! -------
24 ! MPL supports 4 styles of MPIIO
25 !
26 ! kop = 1 - Blocking, non collective, shared file pointer
27 ! using MPI_FILE_WRITE_SHARED,
28 ! MPI_FILE_READ_SHARED
29 ! kop = 2 - Blocking, collective, ordered, shared file pointer
30 ! using MPI_FILE_WRITE_ORDERED,
31 ! MPI_FILE_READ_ORDERED
32 ! kop = 3 - Non Blocking, non collective, shared file pointer
33 ! using MPI_FILE_IWRITE_SHARED,
34 ! MPI_FILE_IREAD_SHARED
35 ! and MPI_WAIT
36 ! kop = 4 - Non Blocking, collective, ordered, shared file pointer
37 ! using MPI_FILE_WRITE_ORDERED_BEGIN/END,
38 ! MPI_FILE_READ_ORDERED_BEGIN/END
39 !
40 ! Externals.
41 ! ----------
42 !
43 ! Reference.
44 ! ----------
45 ! none yet
46 !
47 ! Author.
48 ! -------
49 ! G.Mozdzynski
50 !
51 ! Modifications.
52 ! --------------
53 ! Original : 2000-12-08 (Based on MPE_CLOSE)
54 ! R. EL Khatib 24-May-2011 Change ifdef MPI2 into ifndef MPI1
55 ! -----------------------------------------------------------------
56 !
57 USE parkind1 ,ONLY : jpim ,jprb
58 
62 
63 IMPLICIT NONE
64 
65 PRIVATE
66 PUBLIC mpl_close
67 
68 CONTAINS
69 
70 SUBROUTINE mpl_close(KFPTR,KERROR)
71 
72 
73 #ifdef USE_8_BYTE_WORDS
74  USE mpi4to8, ONLY : &
75  mpi_file_close => mpi_file_close8
76 #endif
77 
78 INTEGER(KIND=JPIM),INTENT(IN) :: KFPTR
79 INTEGER(KIND=JPIM),INTENT(OUT) :: KERROR
80 !
81 #ifndef MPI1
82 
83 ! -----------------------------------------------------------------
84 !
85 ! 1. Preamble
86 ! --------
87 IF( mpl_rank > mpl_numio ) THEN
88  kerror = -1
89  RETURN
90 ENDIF
91 !
92 ! -----------------------------------------------------------------
93 !
94 ! 1. Close the File
95 ! --------------
96 CALL mpi_file_close(kfptr,kerror)
97 !
98 ! -----------------------------------------------------------------
99 #else
100 
101 CALL abor1('MPI_CLOSE not built with MPI2')
102 
103 #endif
104 !
105 RETURN
106 END SUBROUTINE mpl_close
107 
108 END MODULE mpl_close_mod
subroutine, public mpl_close(KFPTR, KERROR)
integer, parameter jpim
Definition: parkind1.F90:13
subroutine abor1(CDTEXT)
Definition: abor1.F90:2
integer(kind=jpim), public mpl_numio
integer, parameter jprb
Definition: parkind1.F90:32
integer(kind=jpim) mpl_rank