Skip to content

Commit b4394f5

Browse files
committed
Fix distribution build with scripts and TS 29113
Support for TS 29113 in the Fortran bindings should now work with distribution builds. Generated Fortran files are now using macros to determine the TKR syntax used by the specific compiler, and two backing C files are generated, one with and one without TS support. Signed-off-by: Jake Tronge <jtronge@lanl.gov>
1 parent 61cdfe1 commit b4394f5

File tree

10 files changed

+142
-109
lines changed

10 files changed

+142
-109
lines changed

ompi/Makefile.am

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,6 @@ 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-
170160
# Conditionally install the header files
171161

172162
if WANT_INSTALL_HEADERS

ompi/mpi/Makefile.am

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
#
2121

2222
EXTRA_DIST = \
23-
mpi/fortran/configure-fortran-output-bottom.h
23+
mpi/fortran/configure-fortran-output-bottom.h \
24+
mpi/bindings/bindings.py \
25+
mpi/bindings/ompi_bindings/consts.py \
26+
mpi/bindings/ompi_bindings/c.py \
27+
mpi/bindings/ompi_bindings/c_type.py \
28+
mpi/bindings/ompi_bindings/fortran.py \
29+
mpi/bindings/ompi_bindings/fortran_type.py \
30+
mpi/bindings/ompi_bindings/util.py
2431

2532
dist_ompidata_DATA += mpi/help-mpi-api.txt

ompi/mpi/bindings/bindings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def main():
3131

3232
# Fortran set up code
3333
parser_fortran = subparsers.add_parser('fortran', help='subcommand for generating Fortran code')
34+
parser_fortran.add_argument('--ts', action='store_true', help='generate bindings w/o TS 29113 support')
3435
parser_fortran.add_argument('--template', required=True, help='template file to use')
3536
subparsers_fortran = parser_fortran.add_subparsers()
3637
# Handler for generating actual code

ompi/mpi/bindings/ompi_bindings/fortran.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,19 @@ def load_prototypes(fname):
118118
class FortranBinding:
119119
"""Class for generating the binding for a single function."""
120120

121-
def __init__(self, prototype, out, bigcount=False):
121+
def __init__(self, prototype, out, bigcount=False, ts=False):
122+
# Generate bigcount interface version
122123
self.bigcount = bigcount
124+
# Generate files with support for TS 29113 or not
125+
self.ts = ts
123126
self.fn_name = prototype.fn_name
124127
self.out = out
125128
self.parameters = []
126129
param_map = {}
127130
dep_params = {}
128131
for param in prototype.parameters:
129132
type_ = FortranType.get(param.type_name)
130-
param_type = type_(param.name, self.fn_name, bigcount=bigcount)
133+
param_type = type_(param.name, self.fn_name, bigcount=bigcount, ts=ts)
131134
self.parameters.append(param_type)
132135
param_map[param.name] = param_type
133136
if param.dep_params is not None:
@@ -340,10 +343,10 @@ def print_profiling_rename_macros(prototypes, out):
340343
out.dump('#endif /* OMPI_BUILD_MPI_PROFILING */')
341344

342345

343-
def print_c_source_header(out):
346+
def print_c_source_header(out, ts=False):
344347
"""Print the header of the C source file."""
345348
out.dump(f'/* {consts.GENERATED_MESSAGE} */')
346-
if compiler.HAVE_TS:
349+
if ts:
347350
out.dump('#include <ISO_Fortran_binding.h>')
348351
out.dump('#include "ts.h"')
349352
out.dump('#include "ompi_config.h"')
@@ -356,9 +359,9 @@ def print_c_source_header(out):
356359
out.dump('#include "ompi/communicator/communicator.h"')
357360

358361

359-
def print_binding(prototype, lang, out, bigcount=False):
362+
def print_binding(prototype, lang, out, bigcount=False, ts=False):
360363
"""Print the binding with or without bigcount."""
361-
binding = FortranBinding(prototype, out=out, bigcount=bigcount)
364+
binding = FortranBinding(prototype, out=out, bigcount=bigcount, ts=ts)
362365
if lang == 'fortran':
363366
binding.print_f_source()
364367
else:
@@ -374,13 +377,13 @@ def generate_code(args, out):
374377
print_profiling_rename_macros(prototypes, out)
375378
out.dump()
376379
else:
377-
print_c_source_header(out)
380+
print_c_source_header(out, ts=args.ts)
378381
for prototype in prototypes:
379382
out.dump()
380-
print_binding(prototype, args.lang, out)
383+
print_binding(prototype, args.lang, out, ts=args.ts)
381384
if util.fortran_prototype_has_bigcount(prototype):
382385
out.dump()
383-
print_binding(prototype, args.lang, bigcount=True, out=out)
386+
print_binding(prototype, args.lang, bigcount=True, out=out, ts=args.ts)
384387

385388

386389
def generate_interface(args, out):
@@ -390,10 +393,10 @@ def generate_interface(args, out):
390393
for prototype in prototypes:
391394
ext_name = util.ext_api_func_name(prototype.fn_name)
392395
out.dump(f'interface {ext_name}')
393-
binding = FortranBinding(prototype, out=out)
396+
binding = FortranBinding(prototype, out=out, ts=args.ts)
394397
binding.print_interface()
395398
if util.fortran_prototype_has_bigcount(prototype):
396399
out.dump()
397-
binding_c = FortranBinding(prototype, out=out, bigcount=True)
400+
binding_c = FortranBinding(prototype, out=out, bigcount=True, ts=args.ts)
398401
binding_c.print_interface()
399402
out.dump(f'end interface {ext_name}')

0 commit comments

Comments
 (0)