Skip to content

Commit 6508aea

Browse files
committed
binding framework: fixes for MPI T stuff
Add various MPI_T related structs to the manglizer. Also more workarounds for pympistandard not knowing about MPI 5.1 chapter sections 19.3.4 and 19.3.5 not being part of the ABI standard. Signed-off-by: Howard Pritchard <[email protected]>
1 parent 626b7de commit 6508aea

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

ompi/mpi/bindings/c_header.py

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444
"MPI_Type_delete_attr_function",
4545
"MPI_Win_delete_attr_function",
4646
"MPI_Win_copy_attr_function",
47+
"MPI_T_enum",
48+
"MPI_T_cvar_handle",
49+
"MPI_T_pvar_handle",
50+
"MPI_T_pvar_session",
51+
"MPI_T_event_instance",
52+
"MPI_T_event_registration",
53+
"MPI_T_cb_safety",
4754
# TODO: these two are deprecated, get rid of them
4855
"MPI_Copy_function",
4956
"MPI_Delete_function",
@@ -169,6 +176,7 @@ def output_constant(const, use_enum: bool, mangle_name: bool):
169176
# that commented-out lines are NOT included.
170177
category_pattern = re.compile(r"^[\s]*\$CATEGORY:([A-Z_0-9]+)\$$")
171178
output = []
179+
c_type = str()
172180

173181
for line in lines:
174182
category = category_pattern.search(line)
@@ -181,14 +189,33 @@ def output_constant(const, use_enum: bool, mangle_name: bool):
181189
if category in ENUM_CATEGORIES:
182190
use_enum = True
183191
if use_enum:
184-
output.append("enum {\n")
192+
for constant in categories_dict[category]:
193+
c_type = constant["handle_types"]["c"]["type"]
194+
if c_type == "int":
195+
output.append("enum {\n")
196+
else:
197+
if MANGLE_NAMES:
198+
line = f'typedef enum {c_type}{ABI_INTERNAL}'
199+
else:
200+
line = f'typedef enum {c_type}'
201+
line = line + " {\n"
202+
output.append(line)
203+
break
185204
# Print out each `#define` / assignment for the constants
186205
for constant in categories_dict[category]:
187206
line = output_constant(constant, use_enum, MANGLE_NAMES)
188207
if line is not None:
189208
output.append(line)
190209
if use_enum:
191-
output.append("};\n")
210+
if c_type == "int":
211+
output.append("};\n")
212+
else:
213+
if MANGLE_NAMES:
214+
line = f'{c_type}{ABI_INTERNAL};'
215+
else:
216+
line = f'{c_type};'
217+
line = "} " + line + "\n"
218+
output.append(line)
192219
else:
193220
output.append(line)
194221

@@ -248,10 +275,13 @@ def output_constant(const, use_enum: bool, mangle_name: bool):
248275
# like "MPI_Group_difference"
249276
datatype_pattern = r"([\( ]?)(" + datatype + r")([; \*\)]{1})"
250277
line = re.sub(datatype_pattern, f"\\g<1>\\g<2>{ABI_INTERNAL}\\g<3>", line)
251-
if "MPI_Fint" in line:
252-
# Comment out a line if it has references to MPI_Fint, we don't need
253-
# that for the ABI
254-
line = f"/* {line} */"
278+
# TODO: need to enhance pympistandard to have field in json to indicate a
279+
# function is not in the ABI standard (things in MPI 5.1 chapter 19 sections 19.3.4 and 19.3.5
280+
if "MPI_Fint" in line or "MPI_F08_status" in line:
281+
# Comment out a line if it has references to MPI_Fint or MPI_F08_status, since
282+
# functions with these argument types are not in the ABI
283+
line = line[:-1]
284+
line = f"/* {line} */" + "\n"
255285
# TODO: pympistandard creates `MPI_Info_create_env` with its `argv`
256286
# parameter being of type `char *` instead of `char **` --- as defined in
257287
# the standard.

0 commit comments

Comments
 (0)