fortran: fix f08 bindings
only define the unique fortran symbol depending on - CAPS - PLAIN - SINGLE_UNDERSCORE - DOUBLE_UNDERSCORE and bind the f08 symbol to the uniquely defined C symbol. Use real data structures to make the code simpler. (perl script written by Jeff)
Этот коммит содержится в:
родитель
318a1a40a4
Коммит
9c77c6b66d
3
.gitignore
поставляемый
3
.gitignore
поставляемый
@ -140,9 +140,12 @@ ompi/debuggers/predefined_pad_test
|
||||
ompi/include/mpi.h
|
||||
ompi/include/mpif-config.h
|
||||
ompi/include/mpif.h
|
||||
ompi/include/mpif-c-constants-decl.h
|
||||
ompi/include/mpif-c-constants.h
|
||||
ompi/include/mpif-common.h
|
||||
ompi/include/mpi-ext.h
|
||||
ompi/include/mpif-ext.h
|
||||
ompi/include/mpif-f08-types.h
|
||||
ompi/include/mpif-handles.h
|
||||
ompi/include/mpif-io-constants.h
|
||||
ompi/include/mpif-constants.h
|
||||
|
@ -103,15 +103,23 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
|
||||
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_DOUBLE_UNDERSCORE],
|
||||
[$ompi_fortran_double_underscore],
|
||||
[Whether fortran symbols have a trailing double underscore or not])
|
||||
OMPI_FORTRAN_DOUBLE_UNDERSCORE=$ompi_fortran_double_underscore
|
||||
AC_SUBST(OMPI_FORTRAN_DOUBLE_UNDERSCORE)
|
||||
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_SINGLE_UNDERSCORE],
|
||||
[$ompi_fortran_single_underscore],
|
||||
[Whether fortran symbols have a trailing underscore or not])
|
||||
OMPI_FORTRAN_SINGLE_UNDERSCORE=$ompi_fortran_single_underscore
|
||||
AC_SUBST(OMPI_FORTRAN_SINGLE_UNDERSCORE)
|
||||
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_CAPS],
|
||||
[$ompi_fortran_caps],
|
||||
[Whether fortran symbols are all caps or not])
|
||||
OMPI_FORTRAN_CAPS=$ompi_fortran_caps
|
||||
AC_SUBST(OMPI_FORTRAN_CAPS)
|
||||
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_PLAIN],
|
||||
[$ompi_fortran_plain],
|
||||
[Whether fortran symbols have no trailing underscore or not])
|
||||
OMPI_FORTRAN_PLAIN=$ompi_fortran_plain
|
||||
AC_SUBST(OMPI_FORTRAN_PLAIN)
|
||||
|
||||
# Check to see if any of the MPI Fortran bindings were
|
||||
# specifically requested. If so, and we weren't able to setup the
|
||||
|
@ -53,7 +53,8 @@ nodist_include_HEADERS = \
|
||||
mpif.h \
|
||||
mpif-ext.h \
|
||||
mpif-sizeof.h \
|
||||
mpi_portable_platform.h
|
||||
mpif-c-constants-decl.h \
|
||||
mpi_portable_platform.h
|
||||
|
||||
if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS
|
||||
nodist_include_HEADERS += \
|
||||
@ -62,8 +63,8 @@ endif
|
||||
|
||||
include ompi/Makefile.am
|
||||
|
||||
# This is complicated, but mpif-values.pl generates
|
||||
# several mpif-*.h files in this directory (during autogen.pl).
|
||||
# This is complicated, but mpif-values.pl generates several
|
||||
# mpif-*.h files in this directory (during autogen.pl).
|
||||
# Hence, if any of those files change, it's safer to just force the
|
||||
# user to re-autogen.
|
||||
#mpif.h: mpif-constants.h mpif-handles.h mpif-io-constants.h mpif-io-handles.h
|
||||
@ -88,7 +89,22 @@ mpif-sizeof.h:
|
||||
--real16=$(OMPI_HAVE_FORTRAN_REAL16) \
|
||||
--complex32=$(OMPI_HAVE_FORTRAN_COMPLEX32)
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
#
|
||||
# mpif-c-constants-decl.h, among other files, is generated based on some
|
||||
# results from configure tests.
|
||||
#
|
||||
|
||||
mpif_mangling_pl=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-mangling.pl
|
||||
mpif-c-constants-decl.h: $(top_builddir)/config.status
|
||||
mpif-c-constants-decl.h: $(mpif_mangling_pl)
|
||||
mpif-c-constants-decl.h:
|
||||
$(OMPI_V_GEN) $(mpif_mangling_pl) \
|
||||
--caps $(OMPI_FORTRAN_CAPS) \
|
||||
--plain $(OMPI_FORTRAN_PLAIN) \
|
||||
--single $(OMPI_FORTRAN_SINGLE_UNDERSCORE) \
|
||||
--double $(OMPI_FORTRAN_DOUBLE_UNDERSCORE)
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
ompidir = $(ompiincludedir)
|
||||
nobase_dist_ompi_HEADERS = $(headers)
|
||||
nobase_nodist_ompi_HEADERS = $(nodist_headers)
|
||||
@ -103,7 +119,9 @@ CLEANFILES = mpif-sizeof.f90
|
||||
# Remove the auto-generated files (they are generated by configure)
|
||||
# Since there is no mpi-ext.h.in, autogen does not know to cleanup this file.
|
||||
distclean-local:
|
||||
rm -f mpi-ext.h mpif-ext.h mpi_portable_platform.h mpif-sizeof.h
|
||||
rm -f mpi-ext.h mpif-ext.h mpi_portable_platform.h \
|
||||
mpif-sizeof.h \
|
||||
mpif-c-constants-decl.h mpif-c-constants.h mpif-f08-types.h
|
||||
|
||||
mpi_portable_platform.h: $(top_srcdir)/opal/include/opal/opal_portable_platform.h
|
||||
-@rm -f mpi_portable_platform.h
|
||||
|
@ -9,7 +9,9 @@
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2015 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -22,7 +24,8 @@ noinst_LTLIBRARIES =
|
||||
EXTRA_DIST = \
|
||||
attr-fn-int-callback-interfaces.h \
|
||||
conversion-fn-null-int-interface.h \
|
||||
gen-mpi-sizeof.pl
|
||||
gen-mpi-sizeof.pl \
|
||||
gen-mpi-mangling.pl
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -9,9 +9,11 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011-2013 Inria. All rights reserved.
|
||||
* Copyright (c) 2011-2012 Universite Bordeaux 1
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -24,6 +26,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#if OMPI_BUILD_FORTRAN_BINDINGS
|
||||
/*
|
||||
* Several variables are used to link against MPI F77 constants which
|
||||
* correspond to addresses, e.g. MPI_BOTTOM, and are implemented via
|
||||
@ -85,168 +88,7 @@
|
||||
* file.
|
||||
*/
|
||||
|
||||
#define DECL(type, upper_case, lower_case, single_u, double_u) \
|
||||
OMPI_DECLSPEC extern type upper_case; \
|
||||
OMPI_DECLSPEC extern type lower_case; \
|
||||
OMPI_DECLSPEC extern type single_u; \
|
||||
OMPI_DECLSPEC extern type double_u
|
||||
|
||||
/* Note that the rationale for the types of each of these variables is
|
||||
discussed in ompi/include/mpif-common.h. Do not change the types
|
||||
without also changing ompi/runtime/ompi_mpi_init.c and
|
||||
ompi/include/mpif-common.h. */
|
||||
|
||||
DECL(int, MPI_FORTRAN_BOTTOM, mpi_fortran_bottom,
|
||||
mpi_fortran_bottom_, mpi_fortran_bottom__);
|
||||
DECL(int, MPI_FORTRAN_IN_PLACE, mpi_fortran_in_place,
|
||||
mpi_fortran_in_place_, mpi_fortran_in_place__);
|
||||
DECL(int, MPI_FORTRAN_UNWEIGHTED, mpi_fortran_unweighted,
|
||||
mpi_fortran_unweighted_, mpi_fortran_unweighted__);
|
||||
DECL(int, MPI_FORTRAN_WEIGHTS_EMPTY, mpi_fortran_weights_empty,
|
||||
mpi_fortran_weights_empty_, mpi_fortran_weights_empty__);
|
||||
DECL(char *, MPI_FORTRAN_ARGV_NULL, mpi_fortran_argv_null,
|
||||
mpi_fortran_argv_null_, mpi_fortran_argv_null__);
|
||||
DECL(char *, MPI_FORTRAN_ARGVS_NULL, mpi_fortran_argvs_null,
|
||||
mpi_fortran_argvs_null_, mpi_fortran_argvs_null__);
|
||||
DECL(int *, MPI_FORTRAN_ERRCODES_IGNORE, mpi_fortran_errcodes_ignore,
|
||||
mpi_fortran_errcodes_ignore_, mpi_fortran_errcodes_ignore__);
|
||||
DECL(int *, MPI_FORTRAN_STATUS_IGNORE, mpi_fortran_status_ignore,
|
||||
mpi_fortran_status_ignore_, mpi_fortran_status_ignore__);
|
||||
DECL(int *, MPI_FORTRAN_STATUSES_IGNORE, mpi_fortran_statuses_ignore,
|
||||
mpi_fortran_statuses_ignore_, mpi_fortran_statuses_ignore__);
|
||||
|
||||
/*
|
||||
* Create macros to do the checking. Only check for all 4 if we have
|
||||
* weak symbols. Otherwise, just check for the one relevant symbol.
|
||||
*/
|
||||
#if OPAL_HAVE_WEAK_SYMBOLS
|
||||
#define OMPI_IS_FORTRAN_BOTTOM(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_BOTTOM || \
|
||||
addr == (void*) &mpi_fortran_bottom || \
|
||||
addr == (void*) &mpi_fortran_bottom_ || \
|
||||
addr == (void*) &mpi_fortran_bottom__)
|
||||
#define OMPI_IS_FORTRAN_IN_PLACE(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_IN_PLACE || \
|
||||
addr == (void*) &mpi_fortran_in_place || \
|
||||
addr == (void*) &mpi_fortran_in_place_ || \
|
||||
addr == (void*) &mpi_fortran_in_place__)
|
||||
#define OMPI_IS_FORTRAN_UNWEIGHTED(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_UNWEIGHTED || \
|
||||
addr == (void*) &mpi_fortran_unweighted || \
|
||||
addr == (void*) &mpi_fortran_unweighted_ || \
|
||||
addr == (void*) &mpi_fortran_unweighted__)
|
||||
#define OMPI_IS_FORTRAN_WEIGHTS_EMPTY(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_WEIGHTS_EMPTY || \
|
||||
addr == (void*) &mpi_fortran_weights_empty || \
|
||||
addr == (void*) &mpi_fortran_weights_empty_ || \
|
||||
addr == (void*) &mpi_fortran_weights_empty__)
|
||||
#define OMPI_IS_FORTRAN_ARGV_NULL(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_ARGV_NULL || \
|
||||
addr == (void*) &mpi_fortran_argv_null || \
|
||||
addr == (void*) &mpi_fortran_argv_null_ || \
|
||||
addr == (void*) &mpi_fortran_argv_null__)
|
||||
#define OMPI_IS_FORTRAN_ARGVS_NULL(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_ARGVS_NULL || \
|
||||
addr == (void*) &mpi_fortran_argvs_null || \
|
||||
addr == (void*) &mpi_fortran_argvs_null_ || \
|
||||
addr == (void*) &mpi_fortran_argvs_null__)
|
||||
#define OMPI_IS_FORTRAN_ERRCODES_IGNORE(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_ERRCODES_IGNORE || \
|
||||
addr == (void*) &mpi_fortran_errcodes_ignore || \
|
||||
addr == (void*) &mpi_fortran_errcodes_ignore_ || \
|
||||
addr == (void*) &mpi_fortran_errcodes_ignore__)
|
||||
#define OMPI_IS_FORTRAN_STATUS_IGNORE(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_STATUS_IGNORE || \
|
||||
addr == (void*) &mpi_fortran_status_ignore || \
|
||||
addr == (void*) &mpi_fortran_status_ignore_ || \
|
||||
addr == (void*) &mpi_fortran_status_ignore__)
|
||||
#define OMPI_IS_FORTRAN_STATUSES_IGNORE(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_STATUSES_IGNORE || \
|
||||
addr == (void*) &mpi_fortran_statuses_ignore || \
|
||||
addr == (void*) &mpi_fortran_statuses_ignore_ || \
|
||||
addr == (void*) &mpi_fortran_statuses_ignore__)
|
||||
|
||||
#elif OMPI_FORTRAN_CAPS
|
||||
#define OMPI_IS_FORTRAN_BOTTOM(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_BOTTOM)
|
||||
#define OMPI_IS_FORTRAN_IN_PLACE(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_IN_PLACE)
|
||||
#define OMPI_IS_FORTRAN_UNWEIGHTED(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_UNWEIGHTED)
|
||||
#define OMPI_IS_FORTRAN_WEIGHTS_EMPTY(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_WEIGHTS_EMPTY)
|
||||
#define OMPI_IS_FORTRAN_ARGV_NULL(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_ARGV_NULL)
|
||||
#define OMPI_IS_FORTRAN_ARGVS_NULL(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_ARGVS_NULL)
|
||||
#define OMPI_IS_FORTRAN_ERRCODES_IGNORE(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_ERRCODES_IGNORE)
|
||||
#define OMPI_IS_FORTRAN_STATUS_IGNORE(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_STATUS_IGNORE)
|
||||
#define OMPI_IS_FORTRAN_STATUSES_IGNORE(addr) \
|
||||
(addr == (void*) &MPI_FORTRAN_STATUSES_IGNORE)
|
||||
|
||||
#elif OMPI_FORTRAN_PLAIN
|
||||
#define OMPI_IS_FORTRAN_BOTTOM(addr) \
|
||||
(addr == (void*) &mpi_fortran_bottom)
|
||||
#define OMPI_IS_FORTRAN_IN_PLACE(addr) \
|
||||
(addr == (void*) &mpi_fortran_in_place)
|
||||
#define OMPI_IS_FORTRAN_UNWEIGHTED(addr) \
|
||||
(addr == (void*) &mpi_fortran_unweighted)
|
||||
#define OMPI_IS_FORTRAN_WEIGHTS_EMPTY(addr) \
|
||||
(addr == (void*) &mpi_fortran_weights_empty)
|
||||
#define OMPI_IS_FORTRAN_ARGV_NULL(addr) \
|
||||
(addr == (void*) &mpi_fortran_argv_null)
|
||||
#define OMPI_IS_FORTRAN_ARGVS_NULL(addr) \
|
||||
(addr == (void*) &mpi_fortran_argvs_null)
|
||||
#define OMPI_IS_FORTRAN_ERRCODES_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_errcodes_ignore)
|
||||
#define OMPI_IS_FORTRAN_STATUS_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_status_ignore)
|
||||
#define OMPI_IS_FORTRAN_STATUSES_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_statuses_ignore)
|
||||
|
||||
#elif OMPI_FORTRAN_SINGLE_UNDERSCORE
|
||||
#define OMPI_IS_FORTRAN_BOTTOM(addr) \
|
||||
(addr == (void*) &mpi_fortran_bottom_)
|
||||
#define OMPI_IS_FORTRAN_IN_PLACE(addr) \
|
||||
(addr == (void*) &mpi_fortran_in_place_)
|
||||
#define OMPI_IS_FORTRAN_UNWEIGHTED(addr) \
|
||||
(addr == (void*) &mpi_fortran_unweighted_)
|
||||
#define OMPI_IS_FORTRAN_WEIGHTS_EMPTY(addr) \
|
||||
(addr == (void*) &mpi_fortran_weights_empty_)
|
||||
#define OMPI_IS_FORTRAN_ARGV_NULL(addr) \
|
||||
(addr == (void*) &mpi_fortran_argv_null_)
|
||||
#define OMPI_IS_FORTRAN_ARGVS_NULL(addr) \
|
||||
(addr == (void*) &mpi_fortran_argvs_null_)
|
||||
#define OMPI_IS_FORTRAN_ERRCODES_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_errcodes_ignore_)
|
||||
#define OMPI_IS_FORTRAN_STATUS_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_status_ignore_)
|
||||
#define OMPI_IS_FORTRAN_STATUSES_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_statuses_ignore_)
|
||||
|
||||
#else
|
||||
#define OMPI_IS_FORTRAN_BOTTOM(addr) \
|
||||
(addr == (void*) &mpi_fortran_bottom__)
|
||||
#define OMPI_IS_FORTRAN_IN_PLACE(addr) \
|
||||
(addr == (void*) &mpi_fortran_in_place__)
|
||||
#define OMPI_IS_FORTRAN_UNWEIGHTED(addr) \
|
||||
(addr == (void*) &mpi_fortran_unweighted__)
|
||||
#define OMPI_IS_FORTRAN_WEIGHTS_EMPTY(addr) \
|
||||
(addr == (void*) &mpi_fortran_weights_empty__)
|
||||
#define OMPI_IS_FORTRAN_ARGV_NULL(addr) \
|
||||
(addr == (void*) &mpi_fortran_argv_null__)
|
||||
#define OMPI_IS_FORTRAN_ARGVS_NULL(addr) \
|
||||
(addr == (void*) &mpi_fortran_argvs_null__)
|
||||
#define OMPI_IS_FORTRAN_ERRCODES_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_errcodes_ignore__)
|
||||
#define OMPI_IS_FORTRAN_STATUS_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_status_ignore__)
|
||||
#define OMPI_IS_FORTRAN_STATUSES_IGNORE(addr) \
|
||||
(addr == (void*) &mpi_fortran_statuses_ignore__)
|
||||
|
||||
#endif /* weak / specific symbol type */
|
||||
#include "mpif-c-constants-decl.h"
|
||||
|
||||
/* Convert between Fortran and C MPI_BOTTOM */
|
||||
#define OMPI_F2C_BOTTOM(addr) (OMPI_IS_FORTRAN_BOTTOM(addr) ? MPI_BOTTOM : (addr))
|
||||
@ -254,4 +96,6 @@ DECL(int *, MPI_FORTRAN_STATUSES_IGNORE, mpi_fortran_statuses_ignore,
|
||||
#define OMPI_F2C_UNWEIGHTED(addr) (OMPI_IS_FORTRAN_UNWEIGHTED(addr) ? MPI_UNWEIGHTED : (addr))
|
||||
#define OMPI_F2C_WEIGHTS_EMPTY(addr) (OMPI_IS_FORTRAN_WEIGHTS_EMPTY(addr) ? MPI_WEIGHTS_EMPTY : (addr))
|
||||
|
||||
#endif /* OMPI_BUILD_FORTRAN_BINDINGS */
|
||||
|
||||
#endif /* OMPI_FORTRAN_BASE_CONSTANTS_H */
|
||||
|
206
ompi/mpi/fortran/base/gen-mpi-mangling.pl
Исполняемый файл
206
ompi/mpi/fortran/base/gen-mpi-mangling.pl
Исполняемый файл
@ -0,0 +1,206 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright (c) 2015 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Subroutine to generate a bunch of Fortran declarations and symbols
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
my $caps_arg;
|
||||
my $plain_arg;
|
||||
my $single_underscore_arg;
|
||||
my $double_underscore_arg;
|
||||
my $help_arg = 0;
|
||||
|
||||
&Getopt::Long::Configure("bundling");
|
||||
my $ok = Getopt::Long::GetOptions("caps=i" => \$caps_arg,
|
||||
"plain=i" => \$plain_arg,
|
||||
"single=i" => \$single_underscore_arg,
|
||||
"double=i" => \$double_underscore_arg,
|
||||
"help|h" => \$help_arg);
|
||||
|
||||
if ($help_arg || !$ok) {
|
||||
print "Usage: $0 [--caps|--plain|--single|--double] [--help]\n";
|
||||
exit(1 - $ok);
|
||||
}
|
||||
|
||||
my $file_c_constants_decl = "mpif-c-constants-decl.h";
|
||||
my $file_c_constants = "mpif-c-constants.h";
|
||||
my $file_f08_types = "mpif-f08-types.h";
|
||||
|
||||
# If we are not building fortran, then just make empty files
|
||||
if ($caps_arg + $plain_arg + $single_underscore_arg +
|
||||
$double_underscore_arg == 0) {
|
||||
system("touch $file_c_constants_decl");
|
||||
system("touch $file_c_constants");
|
||||
system("touch $file_f08_types");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
###############################################################
|
||||
|
||||
# Declare a hash of all the Fortran sentinel values
|
||||
|
||||
my $fortran;
|
||||
|
||||
$fortran->{bottom} = {
|
||||
c_type => "int",
|
||||
c_name => "mpi_fortran_bottom",
|
||||
f_type => "integer",
|
||||
f_name => "MPI_BOTTOM",
|
||||
};
|
||||
$fortran->{in_place} = {
|
||||
c_type => "int",
|
||||
c_name => "mpi_fortran_in_place",
|
||||
f_type => "integer",
|
||||
f_name => "MPI_IN_PLACE",
|
||||
};
|
||||
$fortran->{unweighted} = {
|
||||
c_type => "int",
|
||||
c_name => "mpi_fortran_unweighted",
|
||||
f_type => "integer",
|
||||
f_name => "MPI_UNWEIGHTED",
|
||||
};
|
||||
$fortran->{weights_empty} = {
|
||||
c_type => "int",
|
||||
c_name => "mpi_fortran_weights_empty",
|
||||
f_type => "integer",
|
||||
f_name => "MPI_WEIGHTS_EMPTY",
|
||||
};
|
||||
|
||||
$fortran->{argv_null} = {
|
||||
c_type => "char *",
|
||||
c_name => "mpi_fortran_argv_null",
|
||||
f_type => "integer",
|
||||
f_name => "MPI_ARGV_NULL",
|
||||
};
|
||||
$fortran->{argvs_null} = {
|
||||
c_type => "char *",
|
||||
c_name => "mpi_fortran_argvs_null",
|
||||
f_type => "integer",
|
||||
f_name => "MPI_ARGVS_NULL",
|
||||
};
|
||||
|
||||
$fortran->{errcodes_ignore} = {
|
||||
c_type => "int *",
|
||||
c_name => "mpi_fortran_errcodes_ignore",
|
||||
f_type => "integer",
|
||||
f_name => "MPI_ERRCODES_IGNORE",
|
||||
};
|
||||
$fortran->{status_ignore} = {
|
||||
c_type => "int *",
|
||||
c_name => "mpi_fortran_status_ignore",
|
||||
f_type => "type(MPI_STATUS)",
|
||||
f_name => "MPI_STATUS_IGNORE",
|
||||
};
|
||||
$fortran->{statuses_ignore} = {
|
||||
c_type => "int *",
|
||||
c_name => "mpi_fortran_statuses_ignore",
|
||||
f_type => "type(MPI_STATUS)",
|
||||
f_name => "MPI_STATUSES_IGNORE(1)",
|
||||
};
|
||||
|
||||
###############################################################
|
||||
|
||||
sub mangle {
|
||||
my $name = shift;
|
||||
|
||||
if ($plain_arg) {
|
||||
return $name;
|
||||
} elsif ($caps_arg) {
|
||||
return uc($name);
|
||||
} elsif ($single_underscore_arg) {
|
||||
return $name . "_";
|
||||
} elsif ($double_underscore_arg) {
|
||||
return $name . "__";
|
||||
} else {
|
||||
die "Unknown name mangling type";
|
||||
}
|
||||
}
|
||||
|
||||
sub gen_c_constants_decl {
|
||||
open(OUT, ">$file_c_constants_decl") ||
|
||||
die "Can't write to $file_c_constants_decl";
|
||||
|
||||
print OUT "/* WARNING: This is a generated file! Edits will be lost! */
|
||||
/*
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* \$COPYRIGHT\$
|
||||
*
|
||||
* This file was generated by gen-mpi-mangling.pl
|
||||
*/
|
||||
|
||||
/* Note that the rationale for the types of each of these variables is
|
||||
discussed in ompi/include/mpif-common.h. Do not change the types
|
||||
without also changing ompi/runtime/ompi_mpi_init.c and
|
||||
ompi/include/mpif-common.h. */\n\n";
|
||||
|
||||
foreach my $key (sort(keys(%{$fortran}))) {
|
||||
my $f = $fortran->{$key};
|
||||
my $m = mangle($f->{c_name});
|
||||
print OUT "extern $f->{c_type} $m;
|
||||
#define OMPI_IS_FORTRAN_" . uc($key) . "(addr) \\
|
||||
(addr == (void*) &$m)\n\n";
|
||||
}
|
||||
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
sub gen_c_constants {
|
||||
open(OUT, ">$file_c_constants") ||
|
||||
die "Can't write to $file_c_constants";
|
||||
|
||||
print OUT "/* WARNING: This is a generated file! Edits will be lost! */
|
||||
/*
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* \$COPYRIGHT\$
|
||||
*
|
||||
* This file was generated by gen-mpi-mangling.pl
|
||||
*/\n\n";
|
||||
|
||||
foreach my $key (sort(keys(%{$fortran}))) {
|
||||
my $f = $fortran->{$key};
|
||||
my $m = mangle($f->{c_name});
|
||||
print OUT "$f->{c_type} $m;\n";
|
||||
}
|
||||
|
||||
close (OUT);
|
||||
}
|
||||
|
||||
sub gen_f08_types {
|
||||
open(OUT, ">$file_f08_types") ||
|
||||
die "Can't write to $file_f08_types";
|
||||
|
||||
print OUT "! WARNING: This is a generated file! Edits will be lost! */
|
||||
!
|
||||
! Copyright (c) 2015 Research Organization for Information Science
|
||||
! and Technology (RIST). All rights reserved.
|
||||
! Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
! \$COPYRIGHT\$
|
||||
!
|
||||
! This file was generated by gen-mpi-mangling.pl
|
||||
!\n\n";
|
||||
|
||||
foreach my $key (sort(keys(%{$fortran}))) {
|
||||
my $f = $fortran->{$key};
|
||||
print OUT "$f->{f_type}, bind(C, name=\"".mangle($f->{c_name})."\") :: $f->{f_name}\n";
|
||||
}
|
||||
|
||||
close (OUT);
|
||||
}
|
||||
|
||||
gen_c_constants_decl();
|
||||
gen_c_constants();
|
||||
gen_f08_types();
|
||||
|
||||
exit(0);
|
@ -3,6 +3,8 @@
|
||||
! Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
|
||||
! All rights reserved.
|
||||
! Copyright (c) 2015 Research Organization for Information Science
|
||||
! and Technology (RIST). All rights reserved.
|
||||
!
|
||||
! This file creates mappings between MPI C types (e.g., MPI_Comm) and
|
||||
! variables (e.g., MPI_COMM_WORLD) and corresponding Fortran names
|
||||
@ -151,7 +153,6 @@ module mpi_f08_types
|
||||
!
|
||||
! STATUS/STATUSES_IGNORE
|
||||
!
|
||||
type(MPI_STATUS), bind(C, name="mpi_fortran_status_ignore") :: MPI_STATUS_IGNORE
|
||||
type(MPI_STATUS), bind(C, name="mpi_fortran_statuses_ignore") :: MPI_STATUSES_IGNORE(1)
|
||||
#include "mpif-f08-types.h"
|
||||
|
||||
end module mpi_f08_types
|
||||
|
@ -3,6 +3,8 @@
|
||||
! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
|
||||
! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
|
||||
! All rights reserved.
|
||||
! Copyright (c) 2015 Research Organization for Information Science
|
||||
! and Technology (RIST). All rights reserved.
|
||||
! $COPYRIGHT$
|
||||
!
|
||||
! This file creates mappings between MPI C types (e.g., MPI_Comm) and
|
||||
@ -164,15 +166,7 @@ module mpi_f08_types
|
||||
|
||||
!... Special sentinel constants
|
||||
!------------------------------
|
||||
type(MPI_STATUS), bind(C, name="mpi_fortran_status_ignore") :: MPI_STATUS_IGNORE
|
||||
type(MPI_STATUS), bind(C, name="mpi_fortran_statuses_ignore") :: MPI_STATUSES_IGNORE(1)
|
||||
integer, bind(C, name="mpi_fortran_bottom") :: MPI_BOTTOM
|
||||
integer, bind(C, name="mpi_fortran_in_place") :: MPI_IN_PLACE
|
||||
integer, bind(C, name="mpi_fortran_argv_null") :: MPI_ARGV_NULL
|
||||
integer, bind(C, name="mpi_fortran_argvs_null") :: MPI_ARGVS_NULL
|
||||
integer, bind(C, name="mpi_fortran_errcodes_ignore") :: MPI_ERRCODES_IGNORE
|
||||
integer, bind(C, name="mpi_fortran_unweighted") :: MPI_UNWEIGHTED
|
||||
integer, bind(C, name="mpi_fortran_weights_empty") :: MPI_WEIGHTS_EMPTY
|
||||
#include "mpif-f08-types.h"
|
||||
|
||||
!... Interfaces for operators with handles
|
||||
!-----------------------------------------
|
||||
|
@ -10,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2006-2009 University of Houston. All rights reserved.
|
||||
@ -257,30 +257,7 @@ MPI_Fint *MPI_F_STATUSES_IGNORE = NULL;
|
||||
ompi/include/mpif-common.h.
|
||||
*/
|
||||
|
||||
#define INST(type, value, upper_case, lower_case, single_u, double_u) \
|
||||
type lower_case = value; \
|
||||
type upper_case = value; \
|
||||
type single_u = value; \
|
||||
type double_u = value
|
||||
|
||||
INST(int, -1, MPI_FORTRAN_BOTTOM, mpi_fortran_bottom,
|
||||
mpi_fortran_bottom_, mpi_fortran_bottom__);
|
||||
INST(int, -1, MPI_FORTRAN_IN_PLACE, mpi_fortran_in_place,
|
||||
mpi_fortran_in_place_, mpi_fortran_in_place__);
|
||||
INST(int, -1, MPI_FORTRAN_UNWEIGHTED, mpi_fortran_unweighted,
|
||||
mpi_fortran_unweighted_, mpi_fortran_unweighted__);
|
||||
INST(int, -1, MPI_FORTRAN_WEIGHTS_EMPTY, mpi_fortran_weights_empty,
|
||||
mpi_fortran_weights_empty_, mpi_fortran_weights_empty__);
|
||||
INST(char *, NULL, MPI_FORTRAN_ARGV_NULL, mpi_fortran_argv_null,
|
||||
mpi_fortran_argv_null_, mpi_fortran_argv_null__);
|
||||
INST(char *, NULL, MPI_FORTRAN_ARGVS_NULL, mpi_fortran_argvs_null,
|
||||
mpi_fortran_argvs_null_, mpi_fortran_argvs_null__);
|
||||
INST(int *, NULL, MPI_FORTRAN_ERRCODES_IGNORE, mpi_fortran_errcodes_ignore,
|
||||
mpi_fortran_errcodes_ignore_, mpi_fortran_errcodes_ignore__);
|
||||
INST(int *, NULL, MPI_FORTRAN_STATUS_IGNORE, mpi_fortran_status_ignore,
|
||||
mpi_fortran_status_ignore_, mpi_fortran_status_ignore__);
|
||||
INST(int *, NULL, MPI_FORTRAN_STATUSES_IGNORE, mpi_fortran_statuses_ignore,
|
||||
mpi_fortran_statuses_ignore_, mpi_fortran_statuses_ignore__);
|
||||
#include "mpif-c-constants.h"
|
||||
|
||||
/*
|
||||
* Hash tables for MPI_Type_create_f90* functions
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user