From e2e673ae5c7ebbd1099a7f0786f534ff263216ca Mon Sep 17 00:00:00 2001 From: Hui Zhou Date: Tue, 2 Apr 2024 14:28:13 -0500 Subject: [PATCH] abi_fortran: build mpif_h --- maint/gen_binding_abi_fortran.py | 33 +++- maint/local_python/binding_f77.py | 38 ++-- src/binding/abi_fortran/configure.ac | 35 ++-- src/binding/abi_fortran/mpif_h/Makefile.mk | 1 - src/binding/abi_fortran/mpif_h/fdebug.c | 178 ------------------ src/binding/abi_fortran/mpif_h/mpi_fortimpl.h | 11 +- 6 files changed, 69 insertions(+), 227 deletions(-) delete mode 100644 src/binding/abi_fortran/mpif_h/fdebug.c diff --git a/maint/gen_binding_abi_fortran.py b/maint/gen_binding_abi_fortran.py index 66738794550..31e10b67965 100644 --- a/maint/gen_binding_abi_fortran.py +++ b/maint/gen_binding_abi_fortran.py @@ -7,6 +7,7 @@ from local_python.mpi_api import * from local_python.binding_common import * from local_python.binding_f77 import * +from local_python.binding_f08 import * from local_python import RE import os @@ -16,16 +17,13 @@ def main(): binding_dir = G.get_srcdir_path("src/binding") f77_dir = "src/binding/abi_fortran/mpif_h" + f08_dir = "src/binding/abi_fortran/use_mpi_f08" - func_list = load_C_func_list(binding_dir, True) # suppress noise - - func_list.extend(get_mpiio_func_list()) - func_list.extend(get_f77_dummy_func_list()) - func_list.append(G.FUNCS['mpi_f_sync_reg']) + func_list = load_C_func_list(binding_dir, True, custom_dir=None) # suppress noise # preprocess for func in func_list: - check_func_directives(func) + check_func_directives_abi(func) func_list = [f for f in func_list if '_skip_fortran' not in f] # fortran_binding.c @@ -39,9 +37,9 @@ def has_cptr(func): G.profile_out = [] for func in func_list: G.out.append("") - dump_f77_c_func(func) + dump_f77_c_func(func, is_abi=True) if has_cptr(func): - dump_f77_c_func(func, True) + dump_f77_c_func(func, True, is_abi=True) f = "%s/fortran_binding.c" % f77_dir dump_f77_c_file(f, G.out) @@ -75,6 +73,9 @@ def has_cptr(func): f = "%s/mpif.h" % f77_dir dump_mpif_h(f, autoconf_macros) + f = "%s/mpi_f08_compile_constants.f90" % f08_dir + dump_compile_constants_f90(f) + def load_mpi_abi_h(f): # load constants into G.mpih_defines with open(f, "r") as In: @@ -84,9 +85,9 @@ def load_mpi_abi_h(f): if RE.match(r'#define\s+(MPI_\w+)\s+(.+)', line): # direct macros (name, val) = RE.m.group(1, 2) - if RE.match(r'\(+MPI_\w+\)\(?0x([0-9a-fA-F]+)', val): + if RE.match(r'\(+(MPI_\w+)\)\(?0x([0-9a-fA-F]+)', val): # handle constants - val = int(RE.m.group(1), 16) + val = "%s(%d)" % (RE.m.group(1), int(RE.m.group(2), 16)) elif RE.match(r'\(+MPI_Offset\)(-?\d+)', val): # MPI_DISPLACEMENT_CURRENT val = RE.m.group(1) @@ -112,6 +113,18 @@ def load_mpi_abi_h(f): (name, val) = RE.m.group(1, 2) G.mpih_defines[name] = val +def check_func_directives_abi(func): + if RE.match(r'mpi_t_', func['name'], re.IGNORECASE): + func['_skip_fortran'] = 1 + elif RE.match(r'mpix_(grequest_|type_iov)', func['name'], re.IGNORECASE): + func['_skip_fortran'] = 1 + elif RE.match(r'mpi_\w+_(f|f08|c)2(f|f08|c)$', func['name'], re.IGNORECASE): + # implemented in mpi_f08_types.f90 + func['_skip_fortran'] = 1 + elif RE.match(r'mpi_.*_function$', func['name'], re.IGNORECASE): + # defined in mpi_f08_callbacks.f90 + func['_skip_fortran'] = 1 + # --------------------------------------------------------- if __name__ == "__main__": main() diff --git a/maint/local_python/binding_f77.py b/maint/local_python/binding_f77.py index 69b58624e0d..9e044b839bd 100644 --- a/maint/local_python/binding_f77.py +++ b/maint/local_python/binding_f77.py @@ -9,7 +9,7 @@ import re -def dump_f77_c_func(func, is_cptr=False): +def dump_f77_c_func(func, is_cptr=False, is_abi=False): func_name = get_function_name(func) f_mapping = get_kind_map('F90') c_mapping = get_kind_map('C') @@ -68,15 +68,23 @@ def dump_p(p): raise Exception("Unhandled: %s - %s, length=%s" % (func['name'], p['name'], p['length'])) else: c_param_list.append("MPI_Fint *" + p['name']) - c_arg_list_A.append("(%s) (*%s)" % (c_type, p['name'])) - c_arg_list_B.append("(%s) (*%s)" % (c_type, p['name'])) + if is_abi and c_type in G.handle_list: + arg = "%s_f2c(*%s)" % (c_type, p['name']) + else: + arg = "(%s) (*%s)" % (c_type, p['name']) + c_arg_list_A.append(arg) + c_arg_list_B.append(arg) def dump_scalar_out(v, f_type, c_type): c_param_list.append("%s *%s" % (f_type, v)) c_arg_list_A.append("&%s_i" % v) c_arg_list_B.append("&%s_i" % v) code_list_common.append("%s %s_i;" % (c_type, v)) - end_list_common.append("*%s = (%s) %s_i;" % (v, f_type, v)) + if is_abi and c_type in G.handle_list: + val = "%s_c2f(%s_i)" % (c_type, v) + else: + val = "(%s) %s_i" % (f_type, v) + end_list_common.append("*%s = %s;" % (v, val)) # void * def dump_buf(buf, check_in_place): @@ -498,7 +506,7 @@ def dump_attr_out(v, c_type, flag): end_list_common.append("if (*ierr || !%s) {" % flag) end_list_common.append(" *%s = 0;" % v) end_list_common.append("} else {") - end_list_common.append(" *%s = (MPI_Aint) %s_i;" % (v, v)) + end_list_common.append(" *%s = (%s) (intptr_t) (*(void **) %s_i);" % (v, c_type, v)) end_list_common.append("}") def dump_handle_create(v, c_type): @@ -845,19 +853,7 @@ def process_func_parameters(): process_func_parameters() c_func_name = func_name - if need_ATTR_AINT: - if RE.match(r'MPI_Attr_(get|put)', func['name'], re.IGNORECASE): - if RE.m.group(1) == 'put': - c_func_name = "MPII_Comm_set_attr" - else: - c_func_name = "MPII_Comm_get_attr" - c_arg_list_A.append("MPIR_ATTR_INT") - c_arg_list_B.append("MPIR_ATTR_INT") - else: - c_func_name = re.sub(r'MPI_', 'MPII_', func['name']) - c_arg_list_A.append("MPIR_ATTR_AINT") - c_arg_list_B.append("MPIR_ATTR_AINT") - elif re.match(r'MPI_(Init|Init_thread|Info_create_env)$', func['name'], re.IGNORECASE): + if re.match(r'MPI_(Init|Init_thread|Info_create_env)$', func['name'], re.IGNORECASE): # argc, argv c_arg_list_A.insert(0, "0, 0") c_arg_list_B.insert(0, "0, 0") @@ -961,6 +957,7 @@ def dump_mpif_h(f, autoconf_macros={}): # -- all integer constants for name in G.mpih_defines: + val = G.mpih_defines[name] T = "INTEGER" if re.match(r'MPI_[TF]_', name): continue @@ -975,8 +972,11 @@ def dump_mpif_h(f, autoconf_macros={}): T = autoconf_macros['FORTRAN_MPI_OFFSET'] else: T = '@FORTRAN_MPI_OFFSET@' + elif isinstance(val, str) and RE.match(r'(MPI_\w+)\((.+)\)', val): + # handles in F77 are just ITNEGERs + val = RE.m.group(2) print(" %s %s" % (T, name), file=Out) - print(" PARAMETER (%s=%s)" % (name, G.mpih_defines[name]), file=Out) + print(" PARAMETER (%s=%s)" % (name, val), file=Out) # -- Fortran08 capability for a in ['SUBARRAYS_SUPPORTED', 'ASYNC_PROTECTS_NONBLOCKING']: diff --git a/src/binding/abi_fortran/configure.ac b/src/binding/abi_fortran/configure.ac index 4a52ef236bd..53c22835b72 100644 --- a/src/binding/abi_fortran/configure.ac +++ b/src/binding/abi_fortran/configure.ac @@ -39,6 +39,9 @@ F77=$FC FFLAGS=$FCFLAGS AC_PROG_F77 +AC_DEFINE([MPI_ABI], 1, [Define to use MPI ABI header.]) +AC_DEFINE([MPI_ABI_FORT], 1, [Define to include MPI ABI Fortran header.]) + # MPI C ABI standard sizes MPI_STATUS_SIZE=8 AC_SUBST([MPI_STATUS_SIZE]) @@ -57,8 +60,8 @@ MPI_OFFSET=$pac_retval MPI_COUNT=$pac_retval enable_f77=yes -enable_f90=yes -enable_f08=yes +enable_f90=no +enable_f08=no PAC_FC_2008_SUPPORT([:],[enable_f08=no]) modincdir=$includedir @@ -168,7 +171,8 @@ if test "$enable_f77" = yes ; then # Check if $MPI_DEFAULT_FOPTS is valid with $F77 if test -n "$MPI_DEFAULT_FOPTS" ; then PAC_F77_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_FOPTS], [ - FFLAGS="$FFLAGS $MPI_DEFAULT_FOPTS" + FFLAGS="$FFLAGS $MPI_DEFAULT_FOPTS" + ]) fi fi @@ -291,11 +295,6 @@ information to configure with the FCFLAGS environment variable.]) fi if test "$enable_f77" = "yes" ; then - # determine shared library flags for F77 - f77_shlib_conf=src/env/f77_shlib.conf - PAC_COMPILER_SHLIB_FLAGS([F77],[$f77_shlib_conf]) - AC_SUBST_FILE([f77_shlib_conf]) - AC_LANG([Fortran 77]) PAC_PROG_F77_EXCLAIM_COMMENTS(has_exclaim="yes",has_exclaim="no") PAC_PROG_F77_HAS_INCDIR(src) @@ -342,7 +341,7 @@ fi if test "$enable_f90" = "yes" -o "$enable_f08" = "yes"; then # determine shared library flags for FC - fc_shlib_conf=src/env/fc_shlib.conf + fc_shlib_conf=confdb/fc_shlib.conf PAC_COMPILER_SHLIB_FLAGS([FC],[$fc_shlib_conf]) AC_SUBST_FILE([fc_shlib_conf]) @@ -828,11 +827,14 @@ AM_CONDITIONAL([BUILD_F77_BINDING],[test "$enable_f77" = "yes"]) AM_CONDITIONAL([BUILD_F90_BINDING],[test "$enable_f90" = "yes"]) AM_CONDITIONAL([BUILD_F08_BINDING],[test "$enable_f08" = "yes"]) +# Python 3 is needed to generate Fortran bindings +PAC_CHECK_PYTHON + if test "$enable_f90" = "yes" ; then PAC_FC_CHECK_IGNORE_TKR PAC_FC_ISO_C_BINDING if test -z "$PYTHON" ; then - if test -f src/binding/fortran/use_mpi/mpi_base.f90 ; then + if test -f use_mpi/mpi_base.f90 ; then AC_MSG_NOTICE([Use pre-generated Fortran mpi binding. To prevent issues, install Python 3 and re-run configure.]) else AC_MSG_ERROR([Python 3 is required to generate F90 bindings but not found!]) @@ -854,7 +856,7 @@ fi if test "$enable_f08" = "yes" ; then PAC_FC_CHECK_REAL128 if test -z "$PYTHON" ; then - if test -f src/binding/fortran/use_mpi_f08/mpi_f08.f90 ; then + if test -f use_mpi_f08/mpi_f08.f90 ; then AC_MSG_NOTICE([Using pre-generated Fortran mpi_f08 binding source. To prevent issues, install Python 3 and rerun configure.]) else AC_MSG_ERROR([Python 3 is required to generate F08 bindings but not found!]) @@ -877,12 +879,15 @@ AC_CONFIG_FILES([ ]) if test "$enable_f77" = "yes" ; then - AC_CONFIG_FILES([mpif_h/setbotf.f \ - mpif_h/setbot.c]) + AC_CONFIG_FILES([ + mpif_h/setbotf.f + mpif_h/setbot.c + ]) fi if test "$enable_f08" = "yes" ; then - AC_CONFIG_FILES([use_mpi_f08/mpi_f08_compile_constants.f90 \ - use_mpi_f08/mpi_c_interface_types.f90]) + AC_CONFIG_FILES([ + use_mpi_f08/mpi_c_interface_types.f90 + ]) fi AC_OUTPUT diff --git a/src/binding/abi_fortran/mpif_h/Makefile.mk b/src/binding/abi_fortran/mpif_h/Makefile.mk index 7dbd988505f..807aac3ffc4 100644 --- a/src/binding/abi_fortran/mpif_h/Makefile.mk +++ b/src/binding/abi_fortran/mpif_h/Makefile.mk @@ -14,7 +14,6 @@ mpifort_convenience_libs += libf77_mpi.la libf77_mpi_la_SOURCES = \ mpif_h/fortran_binding.c \ mpif_h/attr_proxy.c \ - mpif_h/fdebug.c \ mpif_h/setbot.c \ mpif_h/setbotf.f diff --git a/src/binding/abi_fortran/mpif_h/fdebug.c b/src/binding/abi_fortran/mpif_h/fdebug.c deleted file mode 100644 index 57078c39592..00000000000 --- a/src/binding/abi_fortran/mpif_h/fdebug.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) by Argonne National Laboratory - * See COPYRIGHT in top-level directory - */ - -/* style: allow:fprintf:21 sig:0 */ - -#include "mpi_fortimpl.h" - -#if defined(HAVE_PRAGMA_WEAK) && defined(HAVE_MULTIPLE_PRAGMA_WEAK) -void mpir_is_bottom_(void *a, int *ierr); -void mpir_is_in_place_(void *a, int *ierr); -/* FIXME probably MPI_WEIGHTS_EMPTY needs support somewhere in this file */ -void mpir_is_unweighted_(void *a, int *ierr); -void mpir_is_status_ignore_(void *a, int *ierr); -void mpir_is_statuses_ignore_(void *a, int *ierr); -void mpir_is_errcodes_ignore_(void *a, int *ierr); -void mpir_is_argvs_null_(void *a, int *ierr); - -extern void MPIR_IS_BOTTOM(void *a, int *ierr); -extern void mpir_is_bottom(void *a, int *ierr); -extern void mpir_is_bottom__(void *a, int *ierr); -extern void MPIR_IS_IN_PLACE(void *a, int *ierr); -extern void mpir_is_in_place(void *a, int *ierr); -extern void mpir_is_in_place__(void *a, int *ierr); -extern void MPIR_IS_UNWEIGHTED(void *a, int *ierr); -extern void mpir_is_unweighted(void *a, int *ierr); -extern void mpir_is_unweighted__(void *a, int *ierr); -extern void MPIR_IS_STATUS_IGNORE(void *a, int *ierr); -extern void mpir_is_status_ignore(void *a, int *ierr); -extern void mpir_is_status_ignore__(void *a, int *ierr); -extern void MPIR_IS_STATUSES_IGNORE(void *a, int *ierr); -extern void mpir_is_statuses_ignore(void *a, int *ierr); -extern void mpir_is_statuses_ignore__(void *a, int *ierr); -extern void MPIR_IS_ERRCODES_IGNORE(void *a, int *ierr); -extern void mpir_is_errcodes_ignore(void *a, int *ierr); -extern void mpir_is_errcodes_ignore__(void *a, int *ierr); -extern void MPIR_IS_ARGVS_NULL(void *a, int *ierr); -extern void mpir_is_argvs_null(void *a, int *ierr); -extern void mpir_is_argvs_null__(void *a, int *ierr); - -#pragma weak MPIR_IS_BOTTOM = mpir_is_bottom_ -#pragma weak mpir_is_bottom = mpir_is_bottom_ -#pragma weak mpir_is_bottom__ = mpir_is_bottom_ -#pragma weak MPIR_IS_IN_PLACE = mpir_is_in_place_ -#pragma weak mpir_is_in_place = mpir_is_in_place_ -#pragma weak mpir_is_in_place__ = mpir_is_in_place_ -#pragma weak MPIR_IS_UNWEIGHTED = mpir_is_unweighted_ -#pragma weak mpir_is_unweighted = mpir_is_unweighted_ -#pragma weak mpir_is_unweighted__ = mpir_is_unweighted_ -#pragma weak MPIR_IS_STATUS_IGNORE = mpir_is_status_ignore_ -#pragma weak mpir_is_status_ignore = mpir_is_status_ignore_ -#pragma weak mpir_is_status_ignore__ = mpir_is_status_ignore_ -#pragma weak MPIR_IS_STATUSES_IGNORE = mpir_is_statuses_ignore_ -#pragma weak mpir_is_statuses_ignore = mpir_is_statuses_ignore_ -#pragma weak mpir_is_statuses_ignore__ = mpir_is_statuses_ignore_ -#pragma weak MPIR_IS_ERRCODES_IGNORE = mpir_is_errcodes_ignore_ -#pragma weak mpir_is_errcodes_ignore = mpir_is_errcodes_ignore_ -#pragma weak mpir_is_errcodes_ignore__ = mpir_is_errcodes_ignore_ -#pragma weak MPIR_IS_ARGVS_NULL = mpir_is_argvs_null_ -#pragma weak mpir_is_argvs_null = mpir_is_argvs_null_ -#pragma weak mpir_is_argvs_null__ = mpir_is_argvs_null_ -#else -#if defined(F77_NAME_UPPER) -#define mpir_is_bottom_ MPIR_IS_BOTTOM -#define mpir_is_in_place_ MPIR_IS_IN_PLACE -#define mpir_is_unweighted_ MPIR_IS_UNWEIGHTED -#define mpir_is_status_ignore_ MPIR_IS_STATUS_IGNORE -#define mpir_is_statuses_ignore_ MPIR_IS_STATUSES_IGNORE -#define mpir_is_errcodes_ignore_ MPIR_IS_ERRCODES_IGNORE -#define mpir_is_argvs_null_ MPIR_IS_ARGVS_NULL -#elif defined(F77_NAME_LOWER_2USCORE) -#define mpir_is_bottom_ mpir_is_bottom__ -#define mpir_is_in_place_ mpir_is_in_place__ -#define mpir_is_unweighted_ mpir_is_unweighted__ -#define mpir_is_status_ignore_ mpir_is_status_ignore__ -#define mpir_is_statuses_ignore_ mpir_is_statuses_ignore__ -#define mpir_is_errcodes_ignore_ mpir_is_errcodes_ignore__ -#define mpir_is_argvs_null_ mpir_is_argvs_null__ -#elif defined(F77_NAME_LOWER) -#define mpir_is_bottom_ mpir_is_bottom -#define mpir_is_in_place_ mpir_is_in_place -#define mpir_is_unweighted_ mpir_is_unweighted -#define mpir_is_status_ignore_ mpir_is_status_ignore -#define mpir_is_statuses_ignore_ mpir_is_statuses_ignore -#define mpir_is_errcodes_ignore_ mpir_is_errcodes_ignore -#define mpir_is_argvs_null_ mpir_is_argvs_null -#endif - -void mpir_is_bottom_(void *a, int *ierr); -void mpir_is_in_place_(void *a, int *ierr); -void mpir_is_unweighted_(void *a, int *ierr); -void mpir_is_status_ignore_(void *a, int *ierr); -void mpir_is_statuses_ignore_(void *a, int *ierr); -void mpir_is_errcodes_ignore_(void *a, int *ierr); -void mpir_is_argvs_null_(void *a, int *ierr); - -#endif - -#include - -/* --BEGIN DEBUG-- */ -/* - Define Fortran functions MPIR_IS_() that are callable in Fortran - to check if the Fortran constants, MPI_, are recognized by the MPI - implementation (in C library). -*/ -void mpir_is_bottom_(void *a, int *ierr) -{ - *ierr = (a == MPIR_F_MPI_BOTTOM ? 1 : 0); - if (*ierr) - fprintf(stderr, "Matched : "); - else - fprintf(stderr, "Not matched : "); - fprintf(stderr, "MPIR_F_MPI_BOTTOM=%p, MPI_BOTTOM=%p\n", MPIR_F_MPI_BOTTOM, a); -} - -void mpir_is_in_place_(void *a, int *ierr) -{ - *ierr = (a == MPIR_F_MPI_IN_PLACE ? 1 : 0); - if (*ierr) - fprintf(stderr, "Matched : "); - else - fprintf(stderr, "Not matched : "); - fprintf(stderr, "MPIR_F_MPI_IN_PLACE=%p, MPI_IN_PLACE=%p\n", MPIR_F_MPI_IN_PLACE, a); -} - -void mpir_is_unweighted_(void *a, int *ierr) -{ - *ierr = (a == MPIR_F_MPI_UNWEIGHTED ? 1 : 0); - if (*ierr) - fprintf(stderr, "Matched : "); - else - fprintf(stderr, "Not matched : "); - fprintf(stderr, "MPIR_F_MPI_UNWEIGHTED=%p, MPI_UNWEIGHTED=%p\n", MPIR_F_MPI_UNWEIGHTED, a); -} - -void mpir_is_status_ignore_(void *a, int *ierr) -{ - *ierr = (a == MPI_F_STATUS_IGNORE ? 1 : 0); - if (*ierr) - fprintf(stderr, "Matched : "); - else - fprintf(stderr, "Not matched : "); - fprintf(stderr, "MPI_F_STATUS_IGNORE=%p, MPI_STATUS_IGNORE=%p\n", MPI_F_STATUS_IGNORE, a); -} - -void mpir_is_statuses_ignore_(void *a, int *ierr) -{ - *ierr = (a == MPI_F_STATUSES_IGNORE ? 1 : 0); - if (*ierr) - fprintf(stderr, "Matched : "); - else - fprintf(stderr, "Not matched : "); - fprintf(stderr, "MPI_F_STATUSES_IGNORE=%p, MPI_STATUSES_IGNORE=%p\n", MPI_F_STATUSES_IGNORE, a); -} - -void mpir_is_errcodes_ignore_(void *a, int *ierr) -{ - *ierr = (a == MPI_F_ERRCODES_IGNORE ? 1 : 0); - if (*ierr) - fprintf(stderr, "Matched : "); - else - fprintf(stderr, "Not matched : "); - fprintf(stderr, "MPI_F_ERRCODES_IGNORE=%p, MPI_ERRCODES_IGNORE=%p\n", MPI_F_ERRCODES_IGNORE, a); -} - -void mpir_is_argvs_null_(void *a, int *ierr) -{ - *ierr = (a == MPI_F_ARGVS_NULL ? 1 : 0); - if (*ierr) - fprintf(stderr, "Matched : "); - else - fprintf(stderr, "Not matched : "); - fprintf(stderr, "MPI_F_ARGVS_NULL=%p, MPI_ARGVS_NULL=%p\n", MPI_F_ARGVS_NULL, a); -} - -/* --END DEBUG-- */ diff --git a/src/binding/abi_fortran/mpif_h/mpi_fortimpl.h b/src/binding/abi_fortran/mpif_h/mpi_fortimpl.h index 1aef9bfea9d..0f6d8b48eb5 100644 --- a/src/binding/abi_fortran/mpif_h/mpi_fortimpl.h +++ b/src/binding/abi_fortran/mpif_h/mpi_fortimpl.h @@ -6,15 +6,15 @@ #ifndef MPI_FORTIMPL_H_INCLUDED #define MPI_FORTIMPL_H_INCLUDED -#include "mpichconf.h" +#include "config.h" #include "mpi.h" -#include "mpir_attr_generic.h" -#include "mpii_f77interface.h" #include /* for ssize_t */ #include #include #include +#define MPICH_API_PUBLIC + /* Handle different mechanisms for passing Fortran CHARACTER to routines. * * In the case where MPI_Fint is a different size from int, it appears that @@ -280,7 +280,10 @@ typedef MPI_Aint MPI_FAint; /* The definitions for the Fortran logical values are also needed by the reduction operations in mpi/coll/opland, oplor, and oplxor, so they are defined in src/include/mpii_fortlogical.h */ -#include "mpii_fortlogical.h" +#define MPII_F_TRUE 1 +#define MPII_F_FALSE 0 +#define MPII_TO_FLOG(a) ((a) ? MPII_F_TRUE : MPII_F_FALSE) +#define MPII_FROM_FLOG(a) ((a) == MPII_F_FALSE ? 0 : 1) /* MPIR_F_MPI_BOTTOM is the address of the Fortran MPI_BOTTOM value */