@@ -93,6 +93,54 @@ mutable struct Request
9393end
9494const REQUEST_NULL = Request (MPI_REQUEST_NULL, nothing )
9595
96+ mutable struct Info
97+ val:: Cint
98+ # val::Cint
99+ function Info ()
100+ newinfo = Ref {Cint} ()
101+ ccall (MPI_INFO_CREATE, Void, (Ptr{Cint}, Ptr{Cint}), newinfo, & 0 )
102+ info= new (newinfo[])
103+ finalizer (info, info -> ( ccall (MPI_INFO_FREE, Void,
104+ (Ptr{Cint}, Ptr{Cint}), & info. val, & 0 );
105+ info. val = MPI_INFO_NULL ) )
106+ info
107+ end
108+ end
109+ const INFO_NULL = MPI_INFO_NULL
110+
111+ # the info functions assume that Fortran hidden arguments are placed at the end of the argument list
112+ function Info_set (info:: Info ,key:: AbstractString ,value:: AbstractString )
113+ @assert isascii (key) && isascii (value)
114+ ccall (MPI_INFO_SET, Void,
115+ (Ptr{Cint}, Ptr{UInt8}, Ptr{UInt8}, Ptr{Cint}, Csize_t, Csize_t),
116+ & info. val, key, value, & 0 , sizeof (key), sizeof (value))
117+ end
118+
119+ function Info_get (info:: Info ,key:: AbstractString )
120+ @assert isascii (key)
121+ keyexists= Ref {Bool} ()
122+ len= Ref {Cint} ()
123+ ccall (MPI_INFO_GET_VALUELEN, Void,
124+ (Ptr{Cint}, Ptr{UInt8}, Ptr{Cint}, Ptr{Bool}, Ptr{Cint}, Csize_t),
125+ & info. val, key, len, keyexists, & 0 , sizeof (key))
126+ if keyexists[]
127+ value= " " ^ (len[])
128+ ccall (MPI_INFO_GET, Void,
129+ (Ptr{Cint}, Ptr{UInt8}, Ptr{Cint}, Ptr{UInt8}, Ptr{Bool}, Ptr{Cint}, Csize_t, Csize_t),
130+ & info. val, key, len, value, keyexists, & 0 , sizeof (key), sizeof (value) )
131+ else
132+ value= " "
133+ end
134+ value
135+ end
136+
137+ function Info_delete (info:: Info ,key:: AbstractString )
138+ @assert isascii (key)
139+ ccall (MPI_INFO_DELETE, Void,
140+ (Ptr{Cint}, Ptr{UInt8}, Ptr{Cint}, Csize_t), & info. val, key ,& 0 , sizeof (key) )
141+ end
142+ Info_free (info:: Info ) = finalize (info)
143+
96144mutable struct Status
97145 val:: Array{Cint,1}
98146 Status () = new (Array {Cint} (MPI_STATUS_SIZE))
@@ -169,6 +217,30 @@ function Comm_size(comm::Comm)
169217 Int (size[])
170218end
171219
220+ function Comm_split (comm:: Comm ,color:: Integer ,key:: Integer )
221+ newcomm = Ref {Cint} ()
222+ ccall (MPI_COMM_SPLIT, Void,
223+ (Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
224+ & comm. val, & color, & key, newcomm, & 0 )
225+ MPI. Comm (newcomm[])
226+ end
227+
228+ function Comm_split_type (comm:: Comm ,split_type:: Integer ,key:: Integer ;info:: Info = INFO_NULL)
229+ newcomm = Ref {Cint} ()
230+ ccall (MPI_COMM_SPLIT_TYPE, Void,
231+ (Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
232+ & comm. val, & split_type, & key, & info. val, newcomm, & 0 )
233+ MPI. Comm (newcomm[])
234+ end
235+
236+ function Wtick ()
237+ ccall (MPI_WTICK, Cdouble, () )
238+ end
239+
240+ function Wtime ()
241+ ccall (MPI_WTIME, Cdouble, () )
242+ end
243+
172244function type_create (T:: DataType )
173245 if ! isbits (T)
174246 throw (ArgumentError (" Type must be isbits()" ))
0 commit comments