Skip to content

Commit 61cdfe1

Browse files
committed
Clean up and add additional comments
Signed-off-by: Jake Tronge <jtronge@lanl.gov>
1 parent ae8adf3 commit 61cdfe1

File tree

13 files changed

+87
-66
lines changed

13 files changed

+87
-66
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-constants.h
230230
ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.h
231231
ompi/mpi/fortran/use-mpi-f08/sizeof_f08.f90
232232
ompi/mpi/fortran/use-mpi-f08/sizeof_f08.h
233-
ompi/mpi/fortran/use-mpi-f08/profile/psizeof_f08.f90
234-
ompi/mpi/fortran/use-mpi-f08/profile/*.F90
235233

236234
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-interfaces.h
237235
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h
@@ -549,7 +547,7 @@ docs/man
549547
ompi/mpi/bindings/ompi_bindings/compiler.py
550548

551549
# Generated C Bindings
552-
ompi/mpi/c/ompi_*.c
550+
ompi/mpi/c/generated_*.c
553551

554552
# Generated Fortran Bindings
555553
ompi/mpi/fortran/use-mpi-f08/*_generated.F90

ompi/Makefile.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ include_HEADERS =
157157
dist_ompidata_DATA =
158158
lib@OMPI_LIBMPI_NAME@_la_SOURCES += $(headers)
159159

160+
# Python binding files
161+
EXTRA_DIST = \
162+
mpi/bindings/bindings.py \
163+
mpi/bindings/ompi_bindings/consts.py \
164+
mpi/bindings/ompi_bindings/c.py \
165+
mpi/bindings/ompi_bindings/c_type.py \
166+
mpi/bindings/ompi_bindings/fortran.py \
167+
mpi/bindings/ompi_bindings/fortran_type.py \
168+
mpi/bindings/ompi_bindings/util.py
169+
160170
# Conditionally install the header files
161171

162172
if WANT_INSTALL_HEADERS

ompi/include/mpi.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,6 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub;
13891389
/*
13901390
* MPI API
13911391
*/
1392-
#ifndef OMPI_NO_MPI_PROTOTYPES
13931392
OMPI_DECLSPEC int MPI_Abort(MPI_Comm comm, int errorcode);
13941393
OMPI_DECLSPEC int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
13951394
int target_rank, MPI_Aint target_disp, int target_count,
@@ -3211,8 +3210,6 @@ OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub)
32113210
#define MPI_Type_ub(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_ub, MPI_Type_get_extent)
32123211
#endif
32133212

3214-
#endif /* OMPI_NO_MPI_PROTOTYPES */
3215-
32163213
#if defined(c_plusplus) || defined(__cplusplus)
32173214
}
32183215
#endif

ompi/mpi/bindings/bindings.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
# Additional copyrights may follow
77
#
88
# $HEADER$
9+
"""Main binding generation script.
10+
11+
This script is used for generating the bindings for both C and Fortran. See the
12+
scripts in 'ompi_bindings/' for the bulk of the code.
13+
"""
914
import argparse
1015
import os
1116
import sys
@@ -35,18 +40,18 @@ def main():
3540
parser_code.set_defaults(handler=lambda args, out: fortran.generate_code(args, out))
3641
# Handler for generating the Fortran interface files
3742
parser_interface = subparsers_fortran.add_parser('interface',
38-
help='generate Fortran interface specifcations')
43+
help='generate Fortran interface specifications')
3944
parser_interface.set_defaults(handler=lambda args, out: fortran.generate_interface(args, out))
4045

4146
# C set up code
4247
parser_c = subparsers.add_parser('c', help='subcommand for generating C code')
4348
subparsers_c = parser_c.add_subparsers()
44-
parser_header = subparsers_c.add_parser('header')
49+
parser_header = subparsers_c.add_parser('header', help='generate header file from template files')
4550
parser_header.add_argument('file', nargs='+', help='list of template source files')
4651
parser_header.add_argument('--external', action='store_true', help='generate external mpi.h header file')
4752
parser_header.add_argument('--srcdir', help='source directory')
4853
parser_header.set_defaults(handler=lambda args, out: c.generate_header(args, out))
49-
parser_gen = subparsers_c.add_parser('source')
54+
parser_gen = subparsers_c.add_parser('source', help='generate source file from template file')
5055
# parser = argparse.ArgumentParser(description='C ABI binding generation code')
5156
parser_gen.add_argument('type', choices=('ompi', 'standard'),
5257
help='generate the OMPI ABI functions or the standard ABI functions')

ompi/mpi/bindings/ompi_bindings/c.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
# $HEADERS$
99
#
1010
#
11-
"""MPI Standard ABI Generation.
11+
"""MPI C Binding Code.
12+
13+
This file is used for generating C bindings, as well as bigcount interfaces,
14+
from individual *.c.in template files. This also currently includes unused ABI
15+
code, in preparation for the standard ABI.
1216
1317
TEMPLATE SOURCE FILE ASSUMPTIONS:
1418
* Only one function per file

ompi/mpi/bindings/ompi_bindings/compiler.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Additional copyrights may follow
77
#
88
# $HEADER$
9+
"""Compiler constants/capabilities discovered by configure."""
910

1011
# Check if we have support for TS 29113 (templated at configure time)
1112
HAVE_TS = '@OMPI_FORTRAN_HAVE_TS@' == '1'

ompi/mpi/bindings/ompi_bindings/consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#
88
# $HEADER$
99
#
10+
"""Constants used for generating bindings."""
1011
import re
1112

1213
FORTRAN_ERROR_NAME = 'ierror'

ompi/mpi/bindings/ompi_bindings/fortran_type.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
#
88
# $HEADER$
99
#
10-
"""Fortran type base class."""
10+
"""Fortran types and corresponding template code.
11+
12+
All types used in the Fortran bindings are defined here as classes that derive
13+
from the FortranType base class. These are used for generating both Fortran and
14+
supporting C code for the mpi_f08 bindings.
15+
"""
1116
from abc import ABC, abstractmethod
1217
from ompi_bindings import compiler, consts, util
1318

ompi/mpi/c/Makefile.am

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ endif
4141

4242
headers = bindings.h
4343

44+
#
45+
# Template/prototype source files used for generating MPI functions
46+
#
4447
prototype_sources = \
4548
abort.c.in \
4649
alltoallv.c.in \
@@ -88,10 +91,11 @@ ompi_HEADERS = $(headers)
8891
endif
8992

9093
#
91-
# List of all C files that have profile versions
94+
# List of all C files that have profile versions (generated_*.c files were
95+
# generated from prototype_sources above).
9296
#
9397
interface_profile_sources = \
94-
ompi_abort.c \
98+
generated_abort.c \
9599
add_error_class.c \
96100
add_error_code.c \
97101
add_error_string.c \
@@ -102,22 +106,22 @@ interface_profile_sources = \
102106
iallgatherv.c \
103107
allgatherv_init.c \
104108
alloc_mem.c \
105-
ompi_allreduce.c \
109+
generated_allreduce.c \
106110
iallreduce.c \
107111
allreduce_init.c \
108112
alltoall.c \
109113
ialltoall.c \
110114
alltoall_init.c \
111-
ompi_alltoallv.c \
115+
generated_alltoallv.c \
112116
ialltoallv.c \
113117
alltoallv_init.c \
114-
ompi_alltoallw.c \
118+
generated_alltoallw.c \
115119
ialltoallw.c \
116120
alltoallw_init.c \
117121
attr_delete.c \
118122
attr_get.c \
119123
attr_put.c \
120-
ompi_barrier.c \
124+
generated_barrier.c \
121125
ibarrier.c \
122126
barrier_init.c \
123127
bcast.c \
@@ -153,8 +157,8 @@ interface_profile_sources = \
153157
comm_dup_with_info.c \
154158
comm_idup.c \
155159
comm_idup_with_info.c \
156-
ompi_comm_f2c.c \
157-
ompi_comm_free.c \
160+
generated_comm_f2c.c \
161+
generated_comm_free.c \
158162
comm_free_keyval.c \
159163
comm_get_attr.c \
160164
comm_get_errhandler.c \
@@ -163,7 +167,7 @@ interface_profile_sources = \
163167
comm_get_parent.c \
164168
comm_group.c \
165169
comm_join.c \
166-
ompi_comm_rank.c \
170+
generated_comm_rank.c \
167171
comm_remote_group.c \
168172
comm_remote_size.c \
169173
comm_set_attr.c \
@@ -174,11 +178,11 @@ interface_profile_sources = \
174178
dist_graph_neighbors_count.c \
175179
comm_set_errhandler.c \
176180
comm_set_name.c \
177-
ompi_comm_size.c \
181+
generated_comm_size.c \
178182
comm_spawn.c \
179183
comm_spawn_multiple.c \
180-
ompi_comm_split.c \
181-
ompi_comm_split_type.c \
184+
generated_comm_split.c \
185+
generated_comm_split_type.c \
182186
comm_test_inter.c \
183187
compare_and_swap.c \
184188
dims_create.c \
@@ -218,7 +222,7 @@ interface_profile_sources = \
218222
file_iwrite.c \
219223
file_iwrite_all.c \
220224
file_iwrite_shared.c \
221-
ompi_file_open.c \
225+
generated_file_open.c \
222226
file_preallocate.c \
223227
file_read_all_begin.c \
224228
file_read_all.c \
@@ -252,8 +256,8 @@ interface_profile_sources = \
252256
file_write_ordered.c \
253257
file_write_ordered_end.c \
254258
file_write_shared.c \
255-
ompi_finalize.c \
256-
ompi_finalized.c \
259+
generated_finalize.c \
260+
generated_finalized.c \
257261
free_mem.c \
258262
gather.c \
259263
igather.c \
@@ -266,8 +270,8 @@ interface_profile_sources = \
266270
get_elements.c \
267271
get_elements_x.c \
268272
get_accumulate.c \
269-
ompi_get_library_version.c \
270-
ompi_get_processor_name.c \
273+
generated_get_library_version.c \
274+
generated_get_processor_name.c \
271275
get_version.c \
272276
graph_create.c \
273277
graph_get.c \
@@ -308,17 +312,17 @@ interface_profile_sources = \
308312
info_get_string.c \
309313
info_get_valuelen.c \
310314
info_set.c \
311-
ompi_init.c \
315+
generated_init.c \
312316
init_thread.c \
313-
ompi_initialized.c \
317+
generated_initialized.c \
314318
intercomm_create.c \
315319
intercomm_create_from_groups.c \
316320
intercomm_merge.c \
317321
iprobe.c \
318-
ompi_irecv.c \
322+
generated_irecv.c \
319323
irsend.c \
320324
is_thread_main.c \
321-
ompi_isend.c \
325+
generated_isend.c \
322326
isendrecv.c \
323327
isendrecv_replace.c \
324328
issend.c \
@@ -366,7 +370,7 @@ interface_profile_sources = \
366370
query_thread.c \
367371
raccumulate.c \
368372
recv_init.c \
369-
ompi_recv.c \
373+
generated_recv.c \
370374
reduce.c \
371375
ireduce.c \
372376
reduce_init.c \
@@ -470,12 +474,12 @@ interface_profile_sources = \
470474
unpack.c \
471475
unpublish_name.c \
472476
wait.c \
473-
ompi_waitall.c \
477+
generated_waitall.c \
474478
waitany.c \
475-
ompi_waitsome.c \
476-
ompi_wtime.c \
479+
generated_waitsome.c \
480+
generated_wtime.c \
477481
wtick.c \
478-
ompi_accumulate.c \
482+
generated_accumulate.c \
479483
get.c \
480484
put.c \
481485
win_allocate.c \
@@ -516,7 +520,7 @@ interface_profile_sources = \
516520
win_test.c \
517521
win_unlock.c \
518522
win_unlock_all.c \
519-
ompi_send.c \
523+
generated_send.c \
520524
win_wait.c
521525

522526
# The following functions were removed from the MPI standard, but are
@@ -543,7 +547,7 @@ libmpi_c_noprofile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=0
543547

544548
# ABI generation rules
545549
if OMPI_GENERATE_BINDINGS
546-
ompi_%.c: %.c.in
550+
generated_%.c: %.c.in
547551
$(PYTHON) $(top_srcdir)/ompi/mpi/bindings/bindings.py \
548552
--builddir $(abs_top_builddir) \
549553
--srcdir $(abs_top_srcdir) \
@@ -553,6 +557,6 @@ ompi_%.c: %.c.in
553557
ompi \
554558
$<
555559

556-
distclean-local:
557-
-rm -rf ompi_*.c
560+
# Delete generated files on maintainer-clean
561+
MAINTAINERCLEANFILES = generated_*.c
558562
endif

ompi/mpi/fortran/use-mpi-f08/Makefile.am

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -500,18 +500,10 @@ mpi_api_files = \
500500
win_wait_f08.F90 \
501501
api_f08_generated.F90
502502

503-
# JMS Somehow this variable substitution isn't quite working, and I
504-
# don't have time to figure it out. So just wholesale copy the file
505-
# list. :-(
506-
#pmpi_api_files = $(mpi_api_files:%=p%)
507-
508503
lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = \
509504
$(mpi_api_files) \
510505
mpi-f08.F90
511506

512-
# These are generated; do not ship them
513-
# nodist_lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES =
514-
515507
if BUILD_FORTRAN_SIZEOF
516508
SIZEOF_H = sizeof_f08.h
517509
lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES += \
@@ -539,9 +531,10 @@ lib@OMPI_LIBMPI_NAME@_usempif08_la_LIBADD = \
539531
$(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \
540532
mod/libusempif08_internal_modules.la \
541533
base/libusempif08_ccode.la
534+
542535
#
543-
# I'm not sure why, but the profile library is not getting built before this
544-
# library even when listed in LIBADD, so adding it here as a dependency.
536+
# Make sure to build the profile library before this library, since adding it
537+
# to LIBADD doesn't enforce any ordering
545538
#
546539
lib@OMPI_LIBMPI_NAME@_usempif08_la_DEPENDENCIES = \
547540
$(module_sentinel_files) \
@@ -574,17 +567,13 @@ lib@OMPI_LIBMPI_NAME@_usempif08_profile_la_FCFLAGS = \
574567

575568
# Include script and template files for ABI generation from a distribution
576569
# tarball
577-
EXTRA_DIST = \
578-
generate_bindings.py \
579-
interface.in
570+
EXTRA_DIST = interface.in
580571

581572
#
582573
# Generate the Fortran bindings and C wrapper functions for bindings with a
583574
# *.in template.
584575
#
585576

586-
DISTCLEANFILES = api_f08_generated.F90
587-
588577
if OMPI_GENERATE_BINDINGS
589578
api_f08_generated.F90: interface.in
590579
$(PYTHON) $(top_srcdir)/ompi/mpi/bindings/bindings.py \
@@ -595,6 +584,9 @@ api_f08_generated.F90: interface.in
595584
--template $(abs_srcdir)/$< \
596585
code \
597586
fortran
587+
588+
# Delete generated file on maintainer-clean
589+
MAINTAINERCLEANFILES = api_f08_generated.F90
598590
endif
599591

600592
###########################################################################

0 commit comments

Comments
 (0)