Skip to content

Commit 722a2c1

Browse files
committed
SQUASH_ME: OMNIBUS commit 6
git ignore additions ABI library: don't include functions in 19.3.4/5 in the library as they are not part of the ABI. fixes to handle count/offset/aint in abi.h Signed-off-by: Howard Pritchard <howardp@lanl.gov>
1 parent ac5f8b3 commit 722a2c1

File tree

9 files changed

+176
-115
lines changed

9 files changed

+176
-115
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ docs/man
537537
ompi/mpi/c/*_generated*.c
538538
ompi/mpi/c/standard_*.c
539539
ompi/mpi/c/abi.h
540+
ompi/mpi/c/abi_get_info.c
540541
ompi/mpi/c/standard_abi
541542

542543
# Generated Fortran Bindings

ompi/mpi/bindings/c_header.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,28 @@ def output_constant(const, use_enum: bool, mangle_name: bool):
220220
output.append(f"{binding[0]} P{' '.join(binding[1:])};\n")
221221

222222
# ================================ Final Output ================================
223-
output.append("#endif /* _ABI_INTERNAL_ */")
223+
output.append("#if defined(__cplusplus)\n")
224+
output.append("}\n")
225+
output.append("#endif\n")
226+
output.append("#endif /* MPI_H_ABI */")
227+
# === some compilers are finicky about not having empy line at end of include file =====
228+
output.append("\n")
229+
230+
#replacements = {'MPI_COUNT':'MPI_Count_ABI_INTERNAL',
231+
# 'MPI_AINT':'MPI_Aint_ABI_INTERNAL',
232+
# 'MPI_OFFSET':'MPI_Offset_ABI_INTERNAL'}
233+
replacements = {'MPI_COUNT':'MPI_Count',
234+
'MPI_AINT':'MPI_Aint',
235+
'MPI_OFFSET':'MPI_Offset'}
224236

225237
for i, line in enumerate(output):
226238
line = line.replace(r"\ldots", "...")
239+
for key, value in replacements.items():
240+
if MANGLE_NAMES:
241+
value = value+'_ABI_INTERNAL'
242+
line = line.replace(f'@{key}@', value)
227243
if MANGLE_NAMES:
244+
228245
# Replace datatypes with their internal ABI counterparts
229246
for datatype in INTERNAL_DATATYPES:
230247
# Need to include the extra space here or else we'll edit functions

ompi/mpi/c/Makefile.am

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ prototype_sources = \
9494
close_port.c.in \
9595
comm_accept.c.in \
9696
comm_attach_buffer.c.in \
97-
comm_c2f.c.in \
9897
comm_call_errhandler.c.in \
9998
comm_compare.c.in \
10099
comm_connect.c.in \
@@ -108,7 +107,6 @@ prototype_sources = \
108107
comm_disconnect.c.in \
109108
comm_dup.c.in \
110109
comm_dup_with_info.c.in \
111-
comm_f2c.c.in \
112110
comm_flush_buffer.c.in \
113111
comm_free.c.in \
114112
comm_free_keyval.c.in \
@@ -141,20 +139,16 @@ prototype_sources = \
141139
dist_graph_create.c.in \
142140
dist_graph_neighbors.c.in \
143141
dist_graph_neighbors_count.c.in \
144-
errhandler_c2f.c.in \
145-
errhandler_f2c.c.in \
146142
errhandler_free.c.in \
147143
error_class.c.in \
148144
error_string.c.in \
149145
exscan.c.in \
150146
exscan_init.c.in \
151147
fetch_and_op.c.in \
152-
file_c2f.c.in \
153148
file_call_errhandler.c.in \
154149
file_close.c.in \
155150
file_create_errhandler.c.in \
156151
file_delete.c.in \
157-
file_f2c.c.in \
158152
file_get_amode.c.in \
159153
file_get_atomicity.c.in \
160154
file_get_byte_offset.c.in \
@@ -235,11 +229,9 @@ prototype_sources = \
235229
graph_neighbors_count.c.in \
236230
grequest_complete.c.in \
237231
grequest_start.c.in \
238-
group_c2f.c.in \
239232
group_compare.c.in \
240233
group_difference.c.in \
241234
group_excl.c.in \
242-
group_f2c.c.in \
243235
group_free.c.in \
244236
group_from_session_pset.c.in \
245237
group_incl.c.in \
@@ -268,12 +260,10 @@ prototype_sources = \
268260
ineighbor_alltoall.c.in \
269261
ineighbor_alltoallv.c.in \
270262
ineighbor_alltoallw.c.in \
271-
info_c2f.c.in \
272263
info_create.c.in \
273264
info_create_env.c.in \
274265
info_delete.c.in \
275266
info_dup.c.in \
276-
info_f2c.c.in \
277267
info_free.c.in \
278268
info_get.c.in \
279269
info_get_nkeys.c.in \
@@ -303,8 +293,6 @@ prototype_sources = \
303293
issend.c.in \
304294
is_thread_main.c.in \
305295
lookup_name.c.in \
306-
message_c2f.c.in \
307-
message_f2c.c.in \
308296
mprobe.c.in \
309297
mrecv.c.in \
310298
neighbor_allgather.c.in \
@@ -318,11 +306,9 @@ prototype_sources = \
318306
neighbor_alltoallw.c.in \
319307
neighbor_alltoallw_init.c.in \
320308
open_port.c.in \
321-
op_c2f.c.in \
322309
op_commutative.c.in \
323310
op_create.c.in \
324311
op_free.c.in \
325-
op_f2c.c.in \
326312
pack.c.in \
327313
pack_external.c.in \
328314
pack_external_size.c.in \
@@ -348,8 +334,6 @@ prototype_sources = \
348334
reduce_scatter.c.in \
349335
reduce_scatter_init.c.in \
350336
register_datarep.c.in \
351-
request_c2f.c.in \
352-
request_f2c.c.in \
353337
remove_error_class.c.in \
354338
remove_error_code.c.in \
355339
remove_error_string.c.in \
@@ -374,11 +358,11 @@ prototype_sources = \
374358
sendrecv.c.in \
375359
sendrecv_replace.c.in \
376360
session_attach_buffer.c.in \
377-
session_c2f.c.in \
378361
session_call_errhandler.c.in \
379362
session_create_errhandler.c.in \
380363
session_detach_buffer.c.in \
381-
session_f2c.c.in \
364+
session_call_errhandler.c.in \
365+
session_create_errhandler.c.in \
382366
session_finalize.c.in \
383367
session_flush_buffer.c.in \
384368
session_get_errhandler.c.in \
@@ -393,12 +377,6 @@ prototype_sources = \
393377
ssend_init.c.in \
394378
startall.c.in \
395379
start.c.in \
396-
status_c2f08.c.in \
397-
status_c2f.c.in \
398-
status_f082c.c.in \
399-
status_f082f.c.in \
400-
status_f2c.c.in \
401-
status_f2f08.c.in \
402380
status_get_error.c.in \
403381
status_get_source.c.in \
404382
status_get_tag.c.in \
@@ -414,7 +392,6 @@ prototype_sources = \
414392
test_cancelled.c.in \
415393
testsome.c.in \
416394
topo_test.c.in \
417-
type_c2f.c.in \
418395
type_commit.c.in \
419396
type_contiguous.c.in \
420397
type_create_darray.c.in \
@@ -431,7 +408,6 @@ prototype_sources = \
431408
type_create_subarray.c.in \
432409
type_delete_attr.c.in \
433410
type_dup.c.in \
434-
type_f2c.c.in \
435411
type_free.c.in \
436412
type_free_keyval.c.in \
437413
type_get_attr.c.in \
@@ -458,7 +434,6 @@ prototype_sources = \
458434
win_allocate.c.in \
459435
win_allocate_shared.c.in \
460436
win_attach.c.in \
461-
win_c2f.c.in \
462437
win_call_errhandler.c.in \
463438
win_complete.c.in \
464439
win_create.c.in \
@@ -474,7 +449,6 @@ prototype_sources = \
474449
win_flush_local.c.in \
475450
win_free.c.in \
476451
win_free_keyval.c.in \
477-
win_f2c.c.in \
478452
win_get_attr.c.in \
479453
win_get_errhandler.c.in \
480454
win_get_group.c.in \
@@ -496,18 +470,49 @@ prototype_sources = \
496470
win_wait.c.in \
497471
wtime.c.in
498472

499-
EXTRA_DIST = $(prototype_sources)
473+
# See MPI-5 standard Chapter 20 section 4
474+
prototype_sources_not_in_abi = \
475+
comm_c2f.c.in \
476+
errhandler_c2f.c.in \
477+
file_c2f.c.in \
478+
group_c2f.c.in \
479+
info_c2f.c.in \
480+
message_c2f.c.in \
481+
op_c2f.c.in \
482+
request_c2f.c.in \
483+
session_c2f.c.in \
484+
status_c2f08.c.in \
485+
status_c2f.c.in \
486+
status_f082c.c.in \
487+
status_f082f.c.in \
488+
status_f2f08.c.in \
489+
type_c2f.c.in \
490+
win_c2f.c.in \
491+
comm_f2c.c.in \
492+
errhandler_f2c.c.in \
493+
file_f2c.c.in \
494+
group_f2c.c.in \
495+
info_f2c.c.in \
496+
message_f2c.c.in \
497+
op_f2c.c.in \
498+
request_f2c.c.in \
499+
session_f2c.c.in \
500+
status_f2c.c.in \
501+
type_f2c.c.in \
502+
win_f2c.c.in
503+
504+
EXTRA_DIST = $(prototype_sources) \
505+
$(prototype_sources_not_in_abi) \
506+
abi_converters.h \
507+
abi_get_info.c.in
500508

501509
# attr_fn.c contains attribute manipulation functions which do not
502510
# profiling implications, and so are always built.
503511
libmpi_c_la_SOURCES = \
504512
attr_fn.c
505513

506-
# The MPI_Abi_* functions do not require profiling implementations.
514+
# functions that do not require profiling implementations.
507515
libmpi_c_la_SOURCES += \
508-
abi_details.c \
509-
abi_supported.c \
510-
abi_version.c \
511516
ompi_isendrecv.c \
512517
ompi_sendrecv.c
513518

@@ -523,7 +528,8 @@ nobase_include_HEADERS = abi.h standard_abi/mpi.h
523528
# generated from prototype_sources above).
524529
#
525530
#
526-
interface_profile_sources = $(prototype_sources:.c.in=_ompi_generated.c)
531+
interface_profile_sources = $(prototype_sources:.c.in=_ompi_generated.c) \
532+
$(prototype_sources_not_in_abi:.c.in=_ompi_generated.c)
527533

528534

529535
# Conditionally install the header files
@@ -607,7 +613,7 @@ abi.h: $(top_srcdir)/docs/mpi-standard-apis.json $(top_srcdir)/ompi/mpi/bindings
607613
$<
608614
endif
609615

610-
MAINTAINERCLEANFILES = *_generated.c $(nobase_include_HEADERS)
616+
MAINTAINERCLEANFILES = *_generated.c abi_get_info.c abi_get_version.c $(nobase_include_HEADERS)
611617
if OMPI_STANDARD_ABI
612618
include Makefile_abi.include
613619
endif

ompi/mpi/c/Makefile_abi.include

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,20 @@ BUILT_SOURCES = abi.h standard_abi/mpi.h
4040

4141
libmpi_c_abi_la_SOURCES = \
4242
attr_fn.c \
43-
abi_details.c \
44-
abi_supported.c \
45-
abi_version.c
43+
abi_get_info.c \
44+
abi_get_version.c
4645

47-
libmpi_c_abi_la_CPPFLAGS = -DOMPI_NO_MPI_PROTOTYPES
46+
abi_get_info.c: abi_get_info.c.in
47+
$(OMPI_V_GEN) $(PYTHON) $(top_srcdir)/ompi/mpi/bindings/bindings.py \
48+
--builddir $(abs_top_builddir) \
49+
--srcdir $(abs_top_srcdir) \
50+
--output $@ \
51+
c \
52+
source \
53+
standard \
54+
$<
55+
56+
libmpi_c_abi_la_CPPFLAGS = -DOMPI_NO_MPI_PROTOTYPES -DOMPI_BUILD_MPI_PROFILING=0 -DOMPI_BUILD_STANDARD_ABI
4857
libmpi_c_abi_la_LIBADD = libmpi_c_abi_profile.la
4958
if BUILD_MPI_BINDINGS_LAYER
5059
libmpi_c_abi_la_LIBADD += libmpi_c_abi_noprofile.la

ompi/mpi/c/abi.h.in

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
/*
2-
* $COPYRIGHT$
3-
*
4-
* Additional copyrights may follow
5-
*
6-
* $HEADER$
7-
*/
1+
#ifndef MPI_H_ABI
2+
#define MPI_H_ABI
83

9-
#ifndef _ABI_INTERNAL_
10-
#define _ABI_INTERNAL_
4+
#include <stddef.h>
5+
#include <stdint.h>
116

12-
/* TODO: figure out which includes we need, change to <> instead of "" */
13-
#include "stddef.h"
14-
#include "stdint.h"
15-
16-
/* #include <stdint.h> */
7+
#if defined(__cplusplus)
8+
extern "C" {
9+
#endif
1710

11+
#undef MPI_VERSION
1812
#define MPI_VERSION 5
13+
#undef MPI_SUBVERSION
1914
#define MPI_SUBVERSION 0
2015

2116
#define MPI_ABI_VERSION 1
@@ -34,29 +29,29 @@ typedef struct MPI_ABI_Request * MPI_Request;
3429
typedef struct MPI_ABI_Session * MPI_Session;
3530
typedef struct MPI_ABI_Win * MPI_Win;
3631

37-
/* /\* MPI_Aint is defined to be intptr_t (or equivalent to it, if compiler support is absent). */
38-
/* * The only acceptable alternative to intptr_t is the C89 type equivalent to it. *\/ */
39-
/* #if !defined(MPI_ABI_Aint) */
40-
/* #define MPI_ABI_Aint intptr_t */
41-
/* #endif */
42-
/* typedef MPI_ABI_Aint MPI_Aint; */
43-
/* #undef MPI_ABI_Aint */
44-
45-
/* /\* MPI_Offset will be 64b on all relevant systems. */
46-
/* * We allow for MPI implementations supporting for 128b filesystems. *\/ */
47-
/* #if !defined(MPI_ABI_Offset) */
48-
/* #define MPI_ABI_Offset int64_t */
49-
/* #endif */
50-
/* typedef MPI_ABI_Offset MPI_Offset; */
51-
/* #undef MPI_ABI_Offset */
52-
53-
/* /\* MPI_Count must be large enough to hold the larger of MPI_Aint and MPI_Offset. */
54-
/* * Platforms where MPI_Aint is larger than MPI_Offset are extremely rare. *\/ */
55-
/* #if !defined(MPI_ABI_Count) */
56-
/* #define MPI_ABI_Count MPI_Offset */
57-
/* #endif */
58-
/* typedef MPI_ABI_Count MPI_Count; */
59-
/* #undef MPI_ABI_Count */
32+
/* MPI_Aint is defined to be intptr_t (or equivalent to it, if compiler support is absent).
33+
* The only acceptable alternative to intptr_t is the C89 type equivalent to it. */
34+
#if !defined(MPI_ABI_Aint)
35+
#define MPI_ABI_Aint intptr_t
36+
#endif
37+
typedef MPI_ABI_Aint @MPI_AINT@;
38+
#undef MPI_ABI_Aint
39+
40+
/* MPI_Offset will be 64b on all relevant systems.
41+
* We allow for MPI implementations supporting for 128b filesystems. */
42+
#if !defined(MPI_ABI_Offset)
43+
#define MPI_ABI_Offset int64_t
44+
#endif
45+
typedef MPI_ABI_Offset @MPI_OFFSET@;
46+
#undef MPI_ABI_Offset
47+
48+
/* MPI_Count must be large enough to hold the larger of MPI_Aint and MPI_Offset.
49+
* Platforms where MPI_Aint is larger than MPI_Offset are extremely rare. */
50+
#if !defined(MPI_ABI_Count)
51+
#define MPI_ABI_Count MPI_Offset
52+
#endif
53+
typedef MPI_ABI_Count @MPI_COUNT@;
54+
#undef MPI_ABI_Count
6055

6156
typedef struct {
6257
int MPI_SOURCE;
@@ -211,3 +206,4 @@ $CATEGORY:TOOL_INFO_IFACE_SOURCE_ORDERINGS$
211206
* Callback safety requirement levels used in the MPI tool information interface
212207
*/
213208
$CATEGORY:TOOL_INFO_IFACE_CB_SAFETY_REQ_LEVELS$
209+

0 commit comments

Comments
 (0)