@@ -95,8 +95,51 @@ const REQUEST_NULL = Request(MPI_REQUEST_NULL, nothing)
95
95
96
96
mutable struct Info
97
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
98
135
end
99
- const INFO_NULL = Info (MPI_INFO_NULL)
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)
100
143
101
144
mutable struct Status
102
145
val:: Array{Cint,1}
@@ -176,14 +219,16 @@ end
176
219
177
220
function Comm_split (comm:: Comm ,color:: Integer ,key:: Integer )
178
221
newcomm = Ref {Cint} ()
179
- ccall (MPI_COMM_SPLIT, Void, (Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
222
+ ccall (MPI_COMM_SPLIT, Void,
223
+ (Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
180
224
& comm. val, & color, & key, newcomm, & 0 )
181
225
MPI. Comm (newcomm[])
182
226
end
183
227
184
228
function Comm_split_type (comm:: Comm ,split_type:: Integer ,key:: Integer ;info:: Info = INFO_NULL)
185
229
newcomm = Ref {Cint} ()
186
- ccall (MPI_COMM_SPLIT_TYPE, Void, (Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
230
+ ccall (MPI_COMM_SPLIT_TYPE, Void,
231
+ (Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}),
187
232
& comm. val, & split_type, & key, & info. val, newcomm, & 0 )
188
233
MPI. Comm (newcomm[])
189
234
end
0 commit comments