1
1

Revert "Update to sync with OMPI master and cleanup to build"

This reverts commit cb55c88a8b.
Этот коммит содержится в:
Ralph Castain 2016-11-22 15:03:20 -08:00
родитель cb55c88a8b
Коммит 1e2019ce2a
4869 изменённых файлов: 668748 добавлений и 141 удалений

Просмотреть файл

@ -11,7 +11,7 @@
# All rights reserved. # All rights reserved.
# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2012-2015 Los Alamos National Security, Inc. All rights reserved. # Copyright (c) 2012-2015 Los Alamos National Security, Inc. All rights reserved.
# Copyright (c) 2014-2016 Intel, Inc. All rights reserved. # Copyright (c) 2014 Intel, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -19,7 +19,7 @@
# $HEADER$ # $HEADER$
# #
SUBDIRS = config contrib $(MCA_PROJECT_SUBDIRS) SUBDIRS = config contrib $(MCA_PROJECT_SUBDIRS) test
EXTRA_DIST = README INSTALL VERSION Doxyfile LICENSE autogen.pl README.JAVA.txt EXTRA_DIST = README INSTALL VERSION Doxyfile LICENSE autogen.pl README.JAVA.txt
include examples/Makefile.include include examples/Makefile.include

Просмотреть файл

@ -1,7 +1,6 @@
# -*- makefile -*- # -*- makefile -*-
# Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -10,9 +9,18 @@
# #
TRIM_OPTIONS= TRIM_OPTIONS=
if ! MAN_PAGE_BUILD_MPI_CXX_BINDINGS
TRIM_OPTIONS += --nocxx
endif
if ! MAN_PAGE_BUILD_MPIFH_BINDINGS
TRIM_OPTIONS += --nofortran
endif
if ! MAN_PAGE_BUILD_USEMPIF08_BINDINGS
TRIM_OPTIONS += --nof08
endif
.1in.1: .1in.1:
$(OMPI_V_GEN) $(top_srcdir)/contrib/make_manpage.pl \ $(OMPI_V_GEN) $(top_srcdir)/ompi/mpi/man/make_manpage.pl \
--package-name='@PACKAGE_NAME@' \ --package-name='@PACKAGE_NAME@' \
--package-version='@PACKAGE_VERSION@' \ --package-version='@PACKAGE_VERSION@' \
--ompi-date='@OMPI_RELEASE_DATE@' \ --ompi-date='@OMPI_RELEASE_DATE@' \
@ -22,7 +30,7 @@ TRIM_OPTIONS=
--output=$@ --output=$@
.3in.3: .3in.3:
$(OMPI_V_GEN) $(top_srcdir)/contrib/make_manpage.pl \ $(OMPI_V_GEN) $(top_srcdir)/ompi/mpi/man/make_manpage.pl \
--package-name='@PACKAGE_NAME@' \ --package-name='@PACKAGE_NAME@' \
--package-version='@PACKAGE_VERSION@' \ --package-version='@PACKAGE_VERSION@' \
--ompi-date='@OMPI_RELEASE_DATE@' \ --ompi-date='@OMPI_RELEASE_DATE@' \
@ -33,7 +41,7 @@ TRIM_OPTIONS=
--output=$@ --output=$@
.7in.7: .7in.7:
$(OMPI_V_GEN) $(top_srcdir)/contrib/make_manpage.pl \ $(OMPI_V_GEN) $(top_srcdir)/ompi/mpi/man/make_manpage.pl \
--package-name='@PACKAGE_NAME@' \ --package-name='@PACKAGE_NAME@' \
--package-version='@PACKAGE_VERSION@' \ --package-version='@PACKAGE_VERSION@' \
--ompi-date='@OMPI_RELEASE_DATE@' \ --ompi-date='@OMPI_RELEASE_DATE@' \

Просмотреть файл

@ -4,7 +4,7 @@
# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc. # Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved. # All rights reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved. # Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
# Copyright (c) 2015-2016 Research Organization for Information Science # Copyright (c) 2015-2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved. # and Technology (RIST). All rights reserved.
# Copyright (c) 2015 IBM Corporation. All rights reserved. # Copyright (c) 2015 IBM Corporation. All rights reserved.
@ -45,6 +45,9 @@ my $mpicontrib_found;
my @subdirs; my @subdirs;
# Command line parameters # Command line parameters
my $no_ompi_arg = 0;
my $no_orte_arg = 0;
my $no_oshmem_arg = 0;
my $quiet_arg = 0; my $quiet_arg = 0;
my $debug_arg = 0; my $debug_arg = 0;
my $help_arg = 0; my $help_arg = 0;
@ -576,6 +579,180 @@ dnl List of configure.m4 files to include\n";
} }
} }
##############################################################################
sub mpiext_process_extension {
my ($topdir, $ext_prefix, $extdir) = @_;
my $edir = "$topdir/$ext_prefix/$extdir";
return
if (! -d $edir);
# Process this directory (pretty much the same treatment as for
# MCA components, so it's in a sub).
my $found_ext;
$found_ext->{"name"} = $extdir;
# Push the results onto the hash array
push(@{$mpiext_found}, $found_ext);
# Is there an autogen.subdirs in here?
process_autogen_subdirs($edir);
}
##############################################################################
sub mpiext_run_global {
my ($ext_prefix) = @_;
my $topdir = Cwd::cwd();
my $dir = "$topdir/$ext_prefix";
opendir(DIR, $dir) ||
my_die "Can't open $dir directory";
foreach my $d (readdir(DIR)) {
# Skip any non-directory, "base", or any dir that begins with "."
next
if (! -d "$dir/$d" || $d eq "base" || substr($d, 0, 1) eq ".");
# If this directory has a configure.m4, then it's an
# extension.
if (-f "$dir/$d/configure.m4") {
verbose "=== Found $d MPI extension";
# Check ignore status
if (ignored("$dir/$d")) {
verbose " (ignored)\n";
} else {
verbose "\n";
mpiext_process_extension($topdir, $ext_prefix, $d);
}
}
}
closedir(DIR);
debug_dump($mpiext_found);
#-----------------------------------------------------------------------
$m4 .= "\n$dnl_line
$dnl_line
$dnl_line
dnl Open MPI extensions information
$dnl_line\n\n";
# Array for all the m4_includes that we'll need to pick up the
# configure.m4's.
my @includes;
my $m4_config_ext_list;
# Troll through each of the found exts
foreach my $ext (@{$mpiext_found}) {
my $e = $ext->{name};
push(@includes, "$ext_prefix/$e/configure.m4");
$m4_config_ext_list .= ", $e";
}
$m4_config_ext_list =~ s/^, //;
# List the M4 and no configure exts
$m4 .= "dnl List of all MPI extensions
m4_define([ompi_mpiext_list], [$m4_config_ext_list])\n";
# List out all the m4_include
$m4 .= "\ndnl List of configure.m4 files to include\n";
foreach my $i (@includes) {
$m4 .= "m4_include([$i])\n";
}
}
##############################################################################
sub mpicontrib_process {
my ($topdir, $contrib_prefix, $contribdir) = @_;
my $cdir = "$topdir/$contrib_prefix/$contribdir";
return
if (! -d $cdir);
# Process this directory (pretty much the same treatment as for
# MCA components, so it's in a sub).
my $found_contrib;
$found_contrib->{"name"} = $contribdir;
# Push the results onto the hash array
push(@{$mpicontrib_found}, $found_contrib);
# Is there an autogen.subdirs in here?
process_autogen_subdirs($cdir);
}
##############################################################################
sub mpicontrib_run_global {
my ($contrib_prefix) = @_;
my $topdir = Cwd::cwd();
my $dir = "$topdir/$contrib_prefix";
opendir(DIR, $dir) ||
my_die "Can't open $dir directory";
foreach my $d (readdir(DIR)) {
# Skip any non-directory, "base", or any dir that begins with "."
next
if (! -d "$dir/$d" || $d eq "base" || substr($d, 0, 1) eq ".");
# If this directory has a configure.m4, then it's an
# contrib.
if (-f "$dir/$d/configure.m4") {
verbose "=== Found $d MPI contrib";
# Check ignore status
if (ignored("$dir/$d")) {
verbose " (ignored)\n";
} else {
verbose "\n";
mpicontrib_process($topdir, $contrib_prefix, $d);
}
}
}
closedir(DIR);
debug_dump($mpicontrib_found);
#-----------------------------------------------------------------------
$m4 .= "\n$dnl_line
$dnl_line
$dnl_line
dnl Open MPI contrib information
$dnl_line\n\n";
# Array for all the m4_includes that we'll need to pick up the
# configure.m4's.
my @includes;
my $m4_config_contrib_list;
# Troll through each of the found contribs
foreach my $contrib (@{$mpicontrib_found}) {
my $c = $contrib->{name};
push(@includes, "$contrib_prefix/$c/configure.m4");
$m4_config_contrib_list .= ", $c";
}
$m4_config_contrib_list =~ s/^, //;
# List the M4 and no configure contribs
$m4 .= "dnl List of all MPI contribs
m4_define([ompi_mpicontrib_list], [$m4_config_contrib_list])\n";
# List out all the m4_include
$m4 .= "\ndnl List of configure.m4 files to include\n";
foreach my $i (@includes) {
$m4 .= "m4_include([$i])\n";
}
}
############################################################################## ##############################################################################
# Find and remove stale files # Find and remove stale files
@ -900,7 +1077,10 @@ sub in_tarball {
# Command line parameters # Command line parameters
my $ok = Getopt::Long::GetOptions("quiet|q" => \$quiet_arg, my $ok = Getopt::Long::GetOptions("no-ompi" => \$no_ompi_arg,
"no-orte" => \$no_orte_arg,
"no-oshmem" => \$no_oshmem_arg,
"quiet|q" => \$quiet_arg,
"debug|d" => \$debug_arg, "debug|d" => \$debug_arg,
"help|h" => \$help_arg, "help|h" => \$help_arg,
"platform=s" => \$platform_arg, "platform=s" => \$platform_arg,
@ -913,6 +1093,9 @@ if (!$ok || $help_arg) {
print "Invalid command line argument.\n\n" print "Invalid command line argument.\n\n"
if (!$ok); if (!$ok);
print "Options: print "Options:
--no-ompi | -no-ompi Do not build the Open MPI layer
--no-orte | -no-orte Do not build the ORTE layer
--no-oshmem | -no-oshmem Do not build the OSHMEM layer
--quiet | -q Do not display normal verbose output --quiet | -q Do not display normal verbose output
--debug | -d Output lots of debug information --debug | -d Output lots of debug information
--help | -h This help list --help | -h This help list
@ -932,8 +1115,39 @@ if (!$ok || $help_arg) {
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Check for project existence # Check for project existence
my $project_name_long = "PMI-Exascale"; my $project_name_long = "Open MPI";
my $project_name_short = "pmix"; my $project_name_short = "openmpi";
if (! -e "ompi") {
$no_ompi_arg = 1;
debug "No ompi subdirectory found - will not build MPI layer\n";
}
if (! -e "orte") {
$no_orte_arg = 1;
debug "No orte subdirectory found - will not build ORTE\n";
}
if (! -e "oshmem") {
$no_oshmem_arg = 1;
debug "No oshmem subdirectory found - will not build OSHMEM\n";
}
if (-e "orcm") {
# bozo check - ORCM requires ORTE
if ($no_orte_arg == 1) {
print "Cannot build ORCM without ORTE\n";
my_exit(1);
}
$project_name_long = "Open Resilient Cluster Manager";
$project_name_short = "open-rcm";
} elsif ($no_ompi_arg == 1) {
if ($no_orte_arg == 0) {
$project_name_long = "Open MPI Run Time Environment";
$project_name_short = "open-rte";
} else {
$project_name_long = "Open Portability Access Layer";
$project_name_short = "open-pal";
}
}
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -953,24 +1167,24 @@ $dnl_line\n\n";
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Verify that we're in the root directorty by checking for a token file. # Verify that we're in the OMPI root directorty by checking for a token file.
my_die "Not at the root directory of the PMIx reference server source tree" my_die "Not at the root directory of an OMPI source tree"
if (! -f "config/opal_try_assemble.m4"); if (! -f "config/opal_try_assemble.m4");
my_die "autogen.pl has been invoked in the source tree of PMIx reference server distribution tarball; aborting... my_die "autogen.pl has been invoked in the source tree of an Open MPI distribution tarball; aborting...
You likely do not need to invoke \"autogen.pl\" -- you can probably run \"configure\" directly. You likely do not need to invoke \"autogen.pl\" -- you can probably run \"configure\" directly.
If you really know what you are doing, and really need to run autogen.pl, use the \"--force\" flag." If you really know what you are doing, and really need to run autogen.pl, use the \"--force\" flag."
if (!$force_arg && in_tarball()); if (!$force_arg && in_tarball());
# Now that we've verified that we're in the top-level directory, # Now that we've verified that we're in the top-level OMPI directory,
# set the sentinel file to remove if we abort. # set the sentinel file to remove if we abort.
$sentinel = Cwd::cwd() . "/configure"; $sentinel = Cwd::cwd() . "/configure";
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
my $step = 1; my $step = 1;
verbose "PMIx Reference Server autogen (buckle up!) verbose "Open MPI autogen (buckle up!)
$step. Checking tool versions\n\n"; $step. Checking tool versions\n\n";
@ -1052,6 +1266,31 @@ if ($include_arg) {
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
++$step;
verbose "\n$step. Running template-generating scripts\n\n";
# These scripts generate fortran header files of different types, but
# guaranteed to have the same value (i.e., so humans don't have to
# maintain two sets of files, and potentially have values get out of
# sync).
my @scripts;
push(@scripts, "ompi/include/mpif-values.pl");
foreach my $s (@scripts) {
verbose "=== $s\n";
if (! -x $s) {
print "Cannot find executable $s!\nAborting.\n";
my_exit(1);
}
if (system($s) != 0) {
print "Script failed: $s\n";
my_exit(1);
}
}
#---------------------------------------------------------------------------
# Find projects, frameworks, components # Find projects, frameworks, components
++$step; ++$step;
verbose "\n$step. Searching for projects, MCA frameworks, and MCA components\n"; verbose "\n$step. Searching for projects, MCA frameworks, and MCA components\n";
@ -1067,7 +1306,14 @@ if (! (-f "VERSION" && -f "configure.ac" && -f $topdir_file)) {
# Top-level projects to examine # Top-level projects to examine
my $projects; my $projects;
push(@{$projects}, { name => "opal", dir => "opal", need_base => 1 }); push(@{$projects}, { name => "opal", dir => "opal", need_base => 1 });
push(@{$projects}, { name => "orte", dir => "orte", need_base => 1 }); push(@{$projects}, { name => "orte", dir => "orte", need_base => 1 })
if (!$no_orte_arg);
push(@{$projects}, { name => "ompi", dir => "ompi", need_base => 1 })
if (!$no_ompi_arg);
push(@{$projects}, { name => "oshmem", dir => "oshmem", need_base => 1 })
if (!$no_ompi_arg && !$no_orte_arg && !$no_oshmem_arg);
push(@{$projects}, { name => "orcm", dir => "orcm", need_base => 1 })
if (-e "orcm");
$m4 .= "dnl Separate m4 define for each project\n"; $m4 .= "dnl Separate m4 define for each project\n";
foreach my $p (@$projects) { foreach my $p (@$projects) {
@ -1083,6 +1329,19 @@ mca_run_global($projects);
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Find MPI extensions and contribs
if (!$no_ompi_arg) {
++$step;
verbose "\n$step. Searching for Open MPI extensions\n\n";
mpiext_run_global("ompi/mpiext");
++$step;
verbose "\n$step. Searching for Open MPI contribs\n\n";
mpicontrib_run_global("ompi/contrib");
}
#---------------------------------------------------------------------------
# Process all subdirs that we found in previous steps # Process all subdirs that we found in previous steps
++$step; ++$step;
verbose "\n$step. Processing autogen.subdirs directories\n"; verbose "\n$step. Processing autogen.subdirs directories\n";
@ -1135,7 +1394,7 @@ patch_autotools_output(".");
verbose " verbose "
================================================ ================================================
PMIx Reference Server autogen: completed successfully. w00t! Open MPI autogen: completed successfully. w00t!
================================================\n\n"; ================================================\n\n";
# Done! # Done!

70
config/ompi_check_libfca.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,70 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2011 Mellanox Technologies. All rights reserved.
dnl Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_CHECK_FCA(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if fca support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_FCA],[
OPAL_VAR_SCOPE_PUSH([ompi_check_fca_libs ompi_check_fca_happy CPPFLAGS_save LDFLAGS_save LIBS_save])
AC_ARG_WITH([fca],
[AC_HELP_STRING([--with-fca(=DIR)],
[Build fca (Mellanox Fabric Collective Accelerator) support, optionally adding
DIR/include and DIR/lib or DIR/lib64 to the search path for headers and libraries])])
AS_IF([test "$with_fca" != "no"],
[ompi_check_fca_libs=fca
AS_IF([test ! -z "$with_fca" && test "$with_fca" != "yes"],
[ompi_check_fca_dir=$with_fca
AC_SUBST([coll_fca_HOME], "$ompi_check_fca_dir")],
[AC_SUBST([coll_fca_HOME], "/")])
CPPFLAGS_save=$CPPFLAGS
LDFLAGS_save=$LDFLAGS
LIBS_save=$LIBS
OPAL_LOG_MSG([$1_CPPFLAGS : $$1_CPPFLAGS], 1)
OPAL_LOG_MSG([$1_LDFLAGS : $$1_LDFLAGS], 1)
OPAL_LOG_MSG([$1_LIBS : $$1_LIBS], 1)
OPAL_CHECK_PACKAGE([$1],
[fca/fca_api.h],
[$ompi_check_fca_libs],
[fca_get_version],
[],
[$ompi_check_fca_dir],
[],
[ompi_check_fca_happy="yes"],
[ompi_check_fca_happy="no"])
CPPFLAGS=$CPPFLAGS_save
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save],
[ompi_check_fca_happy="no"])
AS_IF([test "$ompi_check_fca_happy" = "yes" && test "$enable_progress_threads" = "yes"],
[AC_MSG_WARN([fca driver does not currently support progress threads. Disabling FCA.])
ompi_check_fca_happy="no"])
AS_IF([test "$ompi_check_fca_happy" = "yes"],
[$2],
[AS_IF([test ! -z "$with_fca" && test "$with_fca" != "no"],
[AC_MSG_ERROR([FCA support requested but not found. Aborting])])
$3])
OPAL_VAR_SCOPE_POP
])

66
config/ompi_check_libhcoll.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,66 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2011 Mellanox Technologies. All rights reserved.
dnl Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_CHECK_HCOLL(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if hcoll support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_HCOLL],[
OPAL_VAR_SCOPE_PUSH([ompi_check_hcoll_dir ompi_check_hcoll_libs ompi_check_hcoll_happy CPPFLAGS_save LDFLAGS_save LIBS_save])
AC_ARG_WITH([hcoll],
[AC_HELP_STRING([--with-hcoll(=DIR)],
[Build hcoll (Mellanox Hierarchical Collectives) support, optionally adding
DIR/include and DIR/lib or DIR/lib64 to the search path for headers and libraries])])
AS_IF([test "$with_hcoll" != "no"],
[ompi_check_hcoll_libs=hcoll
AS_IF([test ! -z "$with_hcoll" && test "$with_hcoll" != "yes"],
[ompi_check_hcoll_dir=$with_hcoll])
CPPFLAGS_save=$CPPFLAGS
LDFLAGS_save=$LDFLAGS
LIBS_save=$LIBS
OPAL_LOG_MSG([$1_CPPFLAGS : $$1_CPPFLAGS], 1)
OPAL_LOG_MSG([$1_LDFLAGS : $$1_LDFLAGS], 1)
OPAL_LOG_MSG([$1_LIBS : $$1_LIBS], 1)
OPAL_CHECK_PACKAGE([$1],
[hcoll/api/hcoll_api.h],
[$ompi_check_hcoll_libs],
[hcoll_get_version],
[],
[$ompi_check_hcoll_dir],
[],
[ompi_check_hcoll_happy="yes"],
[ompi_check_hcoll_happy="no"])
CPPFLAGS=$CPPFLAGS_save
LDFLAGS=$LDFLAGS_save
LIBS=$LIBS_save],
[ompi_check_hcoll_happy=no])
AS_IF([test "$ompi_check_hcoll_happy" = "yes" && test "$enable_progress_threads" = "yes"],
[AC_MSG_WARN([hcoll driver does not currently support progress threads. Disabling HCOLL.])
ompi_check_hcoll_happy="no"])
AS_IF([test "$ompi_check_hcoll_happy" = "yes"],
[$2],
[AS_IF([test ! -z "$with_hcoll" && test "$with_hcoll" != "no"],
[AC_MSG_ERROR([HCOLL support requested but not found. Aborting])])
$3])
OPAL_VAR_SCOPE_POP
])

93
config/ompi_check_lustre.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,93 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2008-2012 University of Houston. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_CHECK_LUSTRE(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if LUSTRE support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_LUSTRE],[
check_lustre_CPPFLAGS=
check_lustre_LDFLAGS=
check_lustre_LIBS=
check_lustre_save_LIBS="$LIBS"
check_lustre_save_LDFLAGS="$LDFLAGS"
check_lustre_save_CPPFLAGS="$CPPFLAGS"
check_lustre_configuration="none"
ompi_check_lustre_happy="yes"
# Get some configuration information
AC_ARG_WITH([lustre],
[AC_HELP_STRING([--with-lustre(=DIR)],
[Build Lustre support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
OPAL_CHECK_WITHDIR([lustre], [$with_lustre], [include/lustre/liblustreapi.h])
AS_IF([test -z "$with_lustre"],
[ompi_check_lustre_dir="/usr"],
[ompi_check_lustre_dir="$with_lustre"])
if test -e "$ompi_check_lustre_dir/lib64" ; then
ompi_check_lustre_libdir="$ompi_check_lustre_dir/lib64"
else
ompi_check_lustre_libdir="$ompi_check_lustre_dir/lib"
fi
# Add correct -I and -L flags
OPAL_CHECK_PACKAGE([$1], [lustre/liblustreapi.h], [lustreapi], [llapi_file_create], [],
[$ompi_check_lustre_dir], [$ompi_check_lustre_libdir], [ompi_check_lustre_happy="yes"],
[ompi_check_lustre_happy="no"])
AC_MSG_CHECKING([for required lustre data structures])
cat > conftest.c <<EOF
#include "lustre/liblustreapi.h"
void alloc_lum()
{
int v1, v3;
v1 = sizeof(struct lov_user_md_v1) +
LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
v3 = sizeof(struct lov_user_md_v3) +
LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1);
}
EOF
# Try the compile
OPAL_LOG_COMMAND(
[$CC $CFLAGS -I$with_lustre/include -c conftest.c],
[ompi_check_lustre_struct_happy="yes"],
[ompi_check_lustre_struct_happy="no"
ompi_check_lustre_happy="no"]
)
rm -f conftest.c conftest.o
AC_MSG_RESULT([$ompi_check_lustre_struct_happy])
AS_IF([test "$ompi_check_lustre_happy" = "yes"],
[$2],
[AS_IF([test ! -z "$with_lustre" && test "$with_lustre" != "no"],
[echo LUSTRE support not found])
$3])
])

94
config/ompi_check_mxm.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,94 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2001-2011 Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_CHECK_MXM(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if MXM support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_MXM],[
if test -z "$ompi_check_mxm_happy" ; then
AC_ARG_WITH([mxm],
[AC_HELP_STRING([--with-mxm(=DIR)],
[Build Mellanox Messaging support, optionally adding
DIR/include and DIR/lib or DIR/lib64 to the search path for headers and libraries])])
AC_ARG_WITH([mxm-libdir],
[AC_HELP_STRING([--with-mxm-libdir=DIR],
[Search for Mellanox MXM libraries in DIR])])
OPAL_CHECK_WITHDIR([mxm-libdir], [$with_mxm_libdir], [libmxm.*])
ompi_check_mxm_$1_save_CPPFLAGS="$CPPFLAGS"
ompi_check_mxm_$1_save_LDFLAGS="$LDFLAGS"
ompi_check_mxm_$1_save_LIBS="$LIBS"
AS_IF([test "$with_mxm" != "no"],
[AS_IF([test ! -z "$with_mxm" && test "$with_mxm" != "yes"],
[
ompi_check_mxm_dir="$with_mxm"
])
AS_IF([test ! -z "$with_mxm_libdir" && test "$with_mxm_libdir" != "yes"],
[ompi_check_mxm_libdir="$with_mxm_libdir"])
OPAL_CHECK_PACKAGE([ompi_check_mxm],
[mxm/api/mxm_api.h],
[mxm],
[mxm_cleanup],
[],
[$ompi_check_mxm_dir],
[$ompi_check_mxm_libdir],
[ompi_check_mxm_happy="yes"],
[ompi_check_mxm_happy="no"])],
[ompi_check_mxm_happy="no"])
CPPFLAGS="$ompi_check_mxm_$1_save_CPPFLAGS"
LDFLAGS="$ompi_check_mxm_$1_save_LDFLAGS"
LIBS="$ompi_check_mxm_$1_save_LIBS"
AC_MSG_CHECKING(for MXM version compatibility)
AC_REQUIRE_CPP
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I$ompi_check_mxm_dir/include"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <mxm/api/mxm_version.h>]],
[[
#ifndef MXM_VERSION
#error "MXM Version is less than 2.1, please upgrade"
#endif
#
#if MXM_API < MXM_VERSION(2,1)
#error "MXM Version is less than 2.1, please upgrade"
#endif
]])],
[ompi_mxm_version_ok="yes"],
[ompi_mxm_version_ok="no"])
AC_MSG_RESULT([$ompi_mxm_version_ok])
CFLAGS=$old_CFLAGS
AS_IF([test "$ompi_mxm_version_ok" = "no"], [ompi_check_mxm_happy="no"])
OPAL_SUMMARY_ADD([[Transports]],[[Mellanox MXM]],[$1],[$ompi_check_mxm_happy])
fi
AS_IF([test "$ompi_check_mxm_happy" = "yes"],
[$1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_mxm_LDFLAGS"
$1_LIBS="[$]$1_LIBS $ompi_check_mxm_LIBS"
$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_mxm_CPPFLAGS"
$2],
[AS_IF([test ! -z "$with_mxm" && test "$with_mxm" != "no"],
[AC_MSG_ERROR([MXM support requested but not found. Aborting])])
$3])
])

114
config/ompi_check_plfs.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,114 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2008-2012 University of Houston. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_CHECK_PLFS(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if PLFS support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_PLFS],[
check_plfs_CPPFLAGS=
check_plfs_LDFLAGS=
check_plfs_LIBS=
check_plfs_save_LIBS="$LIBS"
check_plfs_save_LDFLAGS="$LDFLAGS"
check_plfs_save_CPPFLAGS="$CPPFLAGS"
check_plfs_configuration="none"
ompi_check_plfs_happy="yes"
# Get some configuration information
AC_ARG_WITH([plfs],
[AC_HELP_STRING([--with-plfs(=DIR)],
[Build Plfs support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
OPAL_CHECK_WITHDIR([plfs], [$with_plfs], [include/plfs.h])
AC_ARG_WITH([plfs-libs],
[AC_HELP_STRING([--with-plfs-libs=LIBS],
[Libraries to link with for plfs])])
temp_with_plfs="$with_plfs"
AS_IF([test -z "$with_plfs"],
[with_plfs="/usr/local"])
temp_with_plfs_libs="$with_plfs_libs"
AS_IF([test -z "$with_plfs_libs"],
[with_plfs_libs="plfs pthread"])
# Add correct -I and -L flags
AS_IF([test -d "$with_plfs/include"],
[check_plfs_CPPFLAGS="-I$with_plfs/include"
$1_CPPFLAGS="$check_plfs_CPPFLAGS"
CPPFLAGS="$CPPFLAGS $check_plfs_CPPFLAGS"],
[ompi_check_plfs_happy="no"])
AS_IF([test "$ompi_check_plfs_happy" = "yes"],
[AS_IF([test -d "$with_plfs/lib"],
[check_plfs_LDFLAGS="-L$with_plfs/lib"
$1_LDFLAGS="$check_plfs_LDFLAGS"
LDFLAGS="$LDFLAGS $check_plfs_LDFLAGS"],
[ompi_check_plfs_happy="no"])
],[])
# Try to find all the plfs libraries
AS_IF([test "$ompi_check_plfs_happy" = "yes"],
[ AS_IF([test -n "$with_plfs_libs"]
[for lib in $with_plfs_libs ; do
check_plfs_LIBS="$check_plfs_LIBS -l$lib"
done])
$1_LIBS="$check_plfs_LIBS"
LIBS="$LIBS $check_plfs_LIBS"
# check for plfs
AC_CHECK_HEADERS([plfs.h],
[AC_MSG_CHECKING([if possible to link PLFS])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <plfs.h>]],
[[is_plfs_path(NULL);]])],
[AC_MSG_RESULT([yes])
ompi_check_plfs_happy="yes"],
[AC_MSG_RESULT([no])
ompi_check_plfs_happy="no"])],
[ompi_check_plfs_happy="no"])
])
LDFLAGS="$check_plfs_save_LDFLAGS"
CPPFLAGS="$check_plfs_save_CPPFLAGS"
LIBS="$check_plfs_save_LIBS"
AS_IF([test "$ompi_check_plfs_happy" = "yes"],
[$2],
[AS_IF([test ! -z "$with_plfs" && test "$with_plfs" != "no"],
[echo PLFS support not found])
$3])
with_plfs="$temp_with_plfs"
with_plfs_libs="$temp_with_plfs_libs"
])

92
config/ompi_check_psm.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,92 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006 QLogic Corp. All rights reserved.
dnl Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2016 Intel Corporation. All rights reserved.
dnl
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_CHECK_PSM(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if PSM support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_PSM],[
if test -z "$ompi_check_psm_happy" ; then
AC_ARG_WITH([psm],
[AC_HELP_STRING([--with-psm(=DIR)],
[Build PSM (Qlogic InfiniPath) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
OPAL_CHECK_WITHDIR([psm], [$with_psm], [include/psm.h])
AC_ARG_WITH([psm-libdir],
[AC_HELP_STRING([--with-psm-libdir=DIR],
[Search for PSM (QLogic InfiniPath PSM) libraries in DIR])])
OPAL_CHECK_WITHDIR([psm-libdir], [$with_psm_libdir], [libpsm_infinipath.*])
ompi_check_psm_$1_save_CPPFLAGS="$CPPFLAGS"
ompi_check_psm_$1_save_LDFLAGS="$LDFLAGS"
ompi_check_psm_$1_save_LIBS="$LIBS"
AS_IF([test "$with_psm" != "no"],
[AS_IF([test ! -z "$with_psm" && test "$with_psm" != "yes"],
[ompi_check_psm_dir="$with_psm"])
AS_IF([test ! -z "$with_psm_libdir" && test "$with_psm_libdir" != "yes"],
[ompi_check_psm_libdir="$with_psm_libdir"])
OPAL_CHECK_PACKAGE([ompi_check_psm],
[psm.h],
[psm_infinipath],
[psm_finalize],
[],
[$ompi_check_psm_dir],
[$ompi_check_psm_libdir],
[ompi_check_psm_happy="yes"],
[ompi_check_psm_happy="no"])],
[ompi_check_psm_happy="no"])
CPPFLAGS="$ompi_check_psm_$1_save_CPPFLAGS"
LDFLAGS="$ompi_check_psm_$1_save_LDFLAGS"
LIBS="$ompi_check_psm_$1_save_LIBS"
AS_IF([test "$ompi_check_psm_happy" = "yes" && test "$enable_progress_threads" = "yes"],
[AC_MSG_WARN([PSM driver does not currently support progress threads. Disabling BTL.])
ompi_check_psm_happy="no"])
AS_IF([test "$ompi_check_psm_happy" = "yes"],
[AC_CHECK_HEADERS(
glob.h,
[],
[AC_MSG_WARN([glob.h not found. Can not build component.])
ompi_check_psm_happy="no"])])
OPAL_SUMMARY_ADD([[Transports]],[[Intel TrueScale (PSM)]],[$1],[$ompi_check_psm_happy])
fi
AS_IF([test "$ompi_check_psm_happy" = "yes"],
[$1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_psm_LDFLAGS"
$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_psm_CPPFLAGS"
$1_LIBS="[$]$1_LIBS $ompi_check_psm_LIBS"
$2],
[AS_IF([test ! -z "$with_psm" && test "$with_psm" != "no"],
[AC_MSG_ERROR([PSM support requested but not found. Aborting])])
$3])
])

90
config/ompi_check_psm2.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,90 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2006 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006 QLogic Corp. All rights reserved.
# Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2016 Intel Corporation. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# OMPI_CHECK_PSM2(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if PSM2 support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_PSM2],[
if test -z "$ompi_check_psm2_happy" ; then
AC_ARG_WITH([psm2],
[AC_HELP_STRING([--with-psm2(=DIR)],
[Build PSM2 (Intel PSM2) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
OPAL_CHECK_WITHDIR([psm2], [$with_psm2], [include/psm2.h])
AC_ARG_WITH([psm2-libdir],
[AC_HELP_STRING([--with-psm2-libdir=DIR],
[Search for PSM (Intel PSM2) libraries in DIR])])
OPAL_CHECK_WITHDIR([psm2-libdir], [$with_psm2_libdir], [libpsm2.*])
ompi_check_psm2_$1_save_CPPFLAGS="$CPPFLAGS"
ompi_check_psm2_$1_save_LDFLAGS="$LDFLAGS"
ompi_check_psm2_$1_save_LIBS="$LIBS"
AS_IF([test "$with_psm2" != "no"],
[AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "yes"],
[ompi_check_psm2_dir="$with_psm2"])
AS_IF([test ! -z "$with_psm2_libdir" && test "$with_psm2_libdir" != "yes"],
[ompi_check_psm2_libdir="$with_psm2_libdir"])
OPAL_CHECK_PACKAGE([ompi_check_psm2],
[psm2.h],
[psm2],
[psm2_mq_irecv2],
[],
[$ompi_check_psm2_dir],
[$ompi_check_psm2_libdir],
[ompi_check_psm2_happy="yes"],
[ompi_check_psm2_happy="no"])],
[ompi_check_psm2_happy="no"])
CPPFLAGS="$ompi_check_psm2_$1_save_CPPFLAGS"
LDFLAGS="$ompi_check_psm2_$1_save_LDFLAGS"
LIBS="$ompi_check_psm2_$1_save_LIBS"
AS_IF([test "$ompi_check_psm2_happy" = "yes" && test "$enable_progress_threads" = "yes"],
[AC_MSG_WARN([PSM2 driver does not currently support progress threads. Disabling MTL.])
ompi_check_psm2_happy="no"])
AS_IF([test "$ompi_check_psm2_happy" = "yes"],
[AC_CHECK_HEADERS(
glob.h,
[],
[AC_MSG_WARN([glob.h not found. Can not build component.])
ompi_check_psm2_happy="no"])])
OPAL_SUMMARY_ADD([[Transports]],[[Intel Omnipath (PSM2)]],[$1],[$ompi_check_psm2_happy])
fi
AS_IF([test "$ompi_check_psm2_happy" = "yes"],
[$1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_psm2_LDFLAGS"
$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_psm2_CPPFLAGS"
$1_LIBS="[$]$1_LIBS $ompi_check_psm2_LIBS"
$2],
[AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "no"],
[AC_MSG_ERROR([PSM2 support requested but not found. Aborting])])
$3])
])

68
config/ompi_check_pvfs2.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,68 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2008-2016 University of Houston. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_CHECK_PVFS2(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if PVFS2 support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_PVFS2],[
check_pvfs2_CPPFLAGS=
check_pvfs2_LDFLAGS=
check_pvfs2_LIBS=
check_pvfs2_configuration="none"
ompi_check_pvfs2_happy="yes"
# Get some configuration information
AC_ARG_WITH([pvfs2],
[AC_HELP_STRING([--with-pvfs2(=DIR)],
[Build Pvfs2 support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
OPAL_CHECK_WITHDIR([pvfs2], [$with_pvfs2], [include/pvfs2.h])
AS_IF([test -z "$with_pvfs2"],
[ompi_check_pvfs2_dir="/usr/local"],
[ompi_check_pvfs2_dir=$with_pvfs2])
if test -e "$ompi_check_pvfs2_dir/lib64" ; then
ompi_check_pvfs2_libdir="$ompi_check_pvfs2_dir/lib64"
else
ompi_check_pvfs2_libdir="$ompi_check_pvfs2_dir/lib"
fi
# Add correct -I and -L flags
OPAL_CHECK_PACKAGE([$1], [pvfs2.h], [pvfs2], [PVFS_util_resolve], [],
[$ompi_check_pvfs2_dir], [$ompi_check_pvfs2_libdir], [ompi_check_pvfs2_happy="yes"],
[ompi_check_pvfs2_happy="no"])
AS_IF([test "$ompi_check_pvfs2_happy" = "yes"],
[$2],
[AS_IF([test ! -z "$with_pvfs2" && test "$with_pvfs2" != "no"],
[echo PVFS2 support not found])
$3])
])

93
config/ompi_check_ucx.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,93 @@
# -*- shell-script -*-
#
# Copyright (C) 2015 Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# OMPI_CHECK_UCX(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if UCX support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_UCX],[
if test -z "$ompi_check_ucx_happy" ; then
AC_ARG_WITH([ucx],
[AC_HELP_STRING([--with-ucx(=DIR)],
[Build with Unified Communication X library support])])
OPAL_CHECK_WITHDIR([ucx], [$with_ucx], [include/ucp/api/ucp.h])
AC_ARG_WITH([ucx-libdir],
[AC_HELP_STRING([--with-ucx-libdir=DIR],
[Search for Unified Communication X libraries in DIR])])
OPAL_CHECK_WITHDIR([ucx-libdir], [$with_ucx_libdir], [libucp.*])
ompi_check_ucx_$1_save_CPPFLAGS="$CPPFLAGS"
ompi_check_ucx_$1_save_LDFLAGS="$LDFLAGS"
ompi_check_ucx_$1_save_LIBS="$LIBS"
AS_IF([test "$with_ucx" != "no"],
[AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "yes"],
[
ompi_check_ucx_dir="$with_ucx"
ompi_check_ucx_libdir="$with_ucx/lib"
])
AS_IF([test ! -z "$with_ucx_libdir" && test "$with_ucx_libdir" != "yes"],
[ompi_check_ucx_libdir="$with_ucx_libdir"])
ompi_check_ucx_extra_libs="-L$ompi_check_ucx_libdir"
OPAL_CHECK_PACKAGE([ompi_check_ucx],
[ucp/api/ucp.h],
[ucp],
[ucp_cleanup],
[$ompi_check_ucx_extra_libs],
[$ompi_check_ucx_dir],
[$ompi_check_ucx_libdir],
[ompi_check_ucx_happy="yes"],
[ompi_check_ucx_happy="no"])],
[ompi_check_ucx_happy="no"])
CPPFLAGS="$ompi_check_ucx_$1_save_CPPFLAGS"
LDFLAGS="$ompi_check_ucx_$1_save_LDFLAGS"
LIBS="$ompi_check_ucx_$1_save_LIBS"
AC_MSG_CHECKING(for UCX version compatibility)
AC_REQUIRE_CPP
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$ompi_check_ucx_dir/include"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <uct/api/version.h>]],
[[
]])],
[ompi_ucx_version_ok="yes"],
[ompi_ucx_version_ok="no"])
AC_MSG_RESULT([$ompi_ucx_version_ok])
CPPFLAGS=$old_CPPFLAGS
AS_IF([test "$ompi_ucx_version_ok" = "no"], [ompi_check_ucx_happy="no"])
OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])
fi
AS_IF([test "$ompi_check_ucx_happy" = "yes"],
[$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_ucx_CPPFLAGS"
$1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_ucx_LDFLAGS"
$1_LIBS="[$]$1_LIBS $ompi_check_ucx_LIBS"
$2],
[AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "no"],
[AC_MSG_ERROR([UCX support requested but not found. Aborting])])
$3])
])

120
config/ompi_check_udapl.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,120 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_CHECK_UDAPL(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
# check if uDAPL support can be found. sets prefix_{CPPFLAGS,
# LDFLAGS, LIBS} as needed and runs action-if-found if there is
# support, otherwise executes action-if-not-found
AC_DEFUN([OMPI_CHECK_UDAPL],[
AC_ARG_WITH([udapl],
[AC_HELP_STRING([--with-udapl(=DIR)],
[Build uDAPL support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
OPAL_CHECK_WITHDIR([udapl], [$with_udapl], [include/dat/udat.h])
AC_ARG_WITH([udapl-libdir],
[AC_HELP_STRING([--with-udapl-libdir=DIR],
[Search for uDAPL libraries in DIR])])
OPAL_CHECK_WITHDIR([udapl-libdir], [$with_udapl_libdir], [libdat.*])
# Special case for OFED/Linux: the default /etc/dat.conf that
# ships with OFED is broken in that it includes DAT providers that
# are not guarnateed to work (e.g., it includes providers for ib0,
# ib1, ib2, ib3, and bond0). Usually, a sysadmin will need to
# edit this file to configure it for the specific environment in
# which it will be used. Hence, if you run the udapl BTL on
# Linux/OFED, you'll get a bunch of warning messages about the
# providers that don't work. However, on Linux/OFED, you don't
# really want to use udapl anyway; you likely really want to use
# the openib BTL (i.e., native verbs, not udapl).
# So after exploring many different scenarios, the least evil
# solution seemed to be to disable building the udapl BTL on
# Linux/OFED *unless the user specifically asks for it.* To be
# specific: on Linux/OFED, if you do not specify
# --with-udapl(=DIR), the udapl BTL will not be built.
AS_IF([test -z "$with_udapl"],
[case $host in
*linux*)
AC_MSG_WARN([On Linux and --with-udapl was not specified])
AC_MSG_WARN([Not building the udapl BTL])
with_udapl=no
;;
esac])
AS_IF([test ! -z "$with_udapl" && test "$with_udapl" != "yes"],
[ompi_check_udapl_dir="$with_udapl"])
AS_IF([test ! -z "$with_udapl_libdir" && test "$with_udapl_libdir" != "yes"],
[ompi_check_udapl_libdir="$with_udapl_libdir"])
AS_IF([test "$with_udapl" = "no"],
[ompi_check_udapl_happy="no"],
[ompi_check_udapl_happy="yes"])
dnl Do not use ompi_check_package directly, because then we have
dnl to test for the header file twice, and caching is disabled
dnl for all ompi_check_package checks. Instead, do what
dnl ompi_check_package does, but only do the header check once.
dnl Still do the lib check twice, the second time if it turns
dnl out we need -ldapl to link (looks like udapl over GM).
ompi_check_package_$1_save_CPPFLAGS="$CPPFLAGS"
ompi_check_package_$1_save_LDFLAGS="$LDFLAGS"
ompi_check_package_$1_save_LIBS="$LIBS"
ompi_check_package_$1_orig_CPPFLAGS="$$1_CPPFLAGS"
ompi_check_package_$1_orig_LDFLAGS="$$1_LDFLAGS"
ompi_check_package_$1_orig_LIBS="$$1_LIBS"
AS_IF([test "$ompi_check_udapl_happy" = "yes"],
[_OPAL_CHECK_PACKAGE_HEADER([$1],
[dat/udat.h],
[$ompi_check_udapl_dir],
[ompi_check_udapl_happy="yes"],
[ompi_check_udapl_happy="no"])])
AS_IF([test "$ompi_check_udapl_happy" = "yes"],
[_OPAL_CHECK_PACKAGE_LIB([$1],
[dat],
[dat_registry_list_providers],
[],
[$ompi_check_udapl_dir],
[$ompi_check_udapl_libdir],
[ompi_check_udapl_happy="yes"],
[_OPAL_CHECK_PACKAGE_LIB([$1],
[dat],
[dat_registry_list_providers],
[-ldapl],
[$ompi_check_udapl_dir],
[$ompi_check_udapl_libdir],
[ompi_check_udapl_happy="yes"],
[ompi_check_udapl_happy="no"])])])
CPPFLAGS="$ompi_check_package_$1_save_CPPFLAGS"
LDFLAGS="$ompi_check_package_$1_save_LDFLAGS"
LIBS="$ompi_check_package_$1_save_LIBS"
AS_IF([test "$ompi_check_udapl_happy" = "yes"],
[$2],
[AS_IF([test ! -z "$with_udapl" && test "$with_udapl" != "no"],
[AC_MSG_ERROR([uDAPL support requested but not found. Aborting])])
$3])
])

52
config/ompi_config_files.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,52 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_DEFUN([OMPI_CONFIG_FILES],[
AC_CONFIG_FILES([
ompi/Makefile
ompi/etc/Makefile
ompi/include/Makefile
ompi/include/mpif.h
ompi/include/mpif-config.h
ompi/datatype/Makefile
ompi/debuggers/Makefile
ompi/mpi/c/Makefile
ompi/mpi/c/profile/Makefile
ompi/mpi/cxx/Makefile
ompi/mpi/fortran/base/Makefile
ompi/mpi/fortran/mpif-h/Makefile
ompi/mpi/fortran/mpif-h/profile/Makefile
ompi/mpi/fortran/use-mpi-tkr/Makefile
ompi/mpi/fortran/use-mpi-tkr/fortran_sizes.h
ompi/mpi/fortran/use-mpi-tkr/fortran_kinds.sh
ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-interfaces.h
ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h
ompi/mpi/fortran/use-mpi-f08/Makefile
ompi/mpi/fortran/use-mpi-f08-desc/Makefile
ompi/mpi/fortran/mpiext/Makefile
ompi/mpi/tool/Makefile
ompi/mpi/tool/profile/Makefile
ompi/tools/ompi_info/Makefile
ompi/tools/wrappers/Makefile
ompi/tools/wrappers/mpicc-wrapper-data.txt
ompi/tools/wrappers/mpic++-wrapper-data.txt
ompi/tools/wrappers/mpifort-wrapper-data.txt
ompi/tools/wrappers/ompi.pc
ompi/tools/wrappers/ompi-c.pc
ompi/tools/wrappers/ompi-cxx.pc
ompi/tools/wrappers/ompi-fort.pc
ompi/tools/wrappers/mpijavac.pl
ompi/tools/mpisync/Makefile
])
])

271
config/ompi_configure_options.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,271 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009 IBM Corporation. All rights reserved.
dnl Copyright (c) 2009 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2013 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015-2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_CONFIGURE_OPTIONS],[
opal_show_subtitle "OMPI Configuration options"
#
# Disable MPI layer?
#
AC_ARG_ENABLE([mpi],
[AC_HELP_STRING([--disable-mpi],
[Disable building the MPI layer (default:enabled)])])
#
# Do we want to enable MPI interface warnings (e.g. deprecated
# functionality and others)?
#
# This was disabled by default in v1.5, but will be enabled by default
# in 1.7 and beyond.
#
AC_MSG_CHECKING([if want compile-time warnings inside of mpi.h])
AC_ARG_ENABLE(mpi-interface-warning,
AC_HELP_STRING([--enable-mpi-interface-warning],
[enable compile-time warnings when deprecated MPI functions are used (default: enabled)]))
if test "$enable_mpi_interface_warning" != "no"; then
AC_MSG_RESULT([yes])
OMPI_WANT_MPI_INTERFACE_WARNING=1
else
AC_MSG_RESULT([no])
OMPI_WANT_MPI_INTERFACE_WARNING=0
fi
AC_DEFINE_UNQUOTED([OMPI_WANT_MPI_INTERFACE_WARNING], [$OMPI_WANT_MPI_INTERFACE_WARNING],
[Enable warnings when using deprecated MPI functions])
#
# Sparse Groups
#
AC_MSG_CHECKING([if want sparse process groups])
AC_ARG_ENABLE(sparse-groups,
AC_HELP_STRING([--enable-sparse-groups],
[enable sparse process groups (default: not enabled)]))
if test "$enable_sparse_groups" = "yes"; then
AC_MSG_RESULT([yes])
GROUP_SPARSE=1
else
AC_MSG_RESULT([no])
GROUP_SPARSE=0
fi
AC_DEFINE_UNQUOTED([OMPI_GROUP_SPARSE],$GROUP_SPARSE,
[Wether we want sparse process groups])
#
# Do we want to enable peruse interface?
#
AC_MSG_CHECKING([if want peruse support])
AC_ARG_ENABLE(peruse,
AC_HELP_STRING([--enable-peruse],
[enable PERUSE interface (default: disabled)]))
if test "$enable_peruse" = "yes"; then
AC_MSG_RESULT([yes])
WANT_PERUSE=1
else
AC_MSG_RESULT([no])
WANT_PERUSE=0
fi
AC_DEFINE_UNQUOTED([OMPI_WANT_PERUSE],
[$WANT_PERUSE],
[if the peruse interface should be enabled])
AM_CONDITIONAL(WANT_PERUSE, test "$WANT_PERUSE" = "1")
#
# Fortran MPI bindings
#
AC_MSG_CHECKING([if want Fortran MPI bindings])
AC_ARG_ENABLE(mpi-fortran,
AC_HELP_STRING([--enable-mpi-fortran],
[specify which Fortran MPI bindings to build: yes, none (or no), best-effort, mpifh (build only mpif.h support), usempi (build mpif.h and the mpi module), or usempif08 (or all, build mpifh, the mpi module, and the mpi_f08 module) (default: "yes" if Fortran compiler found)]))
# These are the 4 monotonically-rising values indicating levels of
# Fortran bindings support.
OMPI_FORTRAN_NO_BINDINGS=0
OMPI_FORTRAN_MPIFH_BINDINGS=1
OMPI_FORTRAN_USEMPI_BINDINGS=2
OMPI_FORTRAN_USEMPIF08_BINDINGS=3
# Set this variable to minimum the level of Fortran bindings support
# that is *required* (i.e., if we can't achieve this level, then
# configure should abort).
OMPI_MIN_REQUIRED_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
# Set this variable to the highest level of Fortran bindings support
# that should be attempted. This value will never be <=
# $OMPI_MIN_REQUIRED_FORTRAN_BINDINGS.
OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
case "x$enable_mpi_fortran" in
x|xbest-effort)
AC_MSG_RESULT([ (try)])
OMPI_MIN_REQUIRED_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPIF08_BINDINGS
;;
xyes)
AC_MSG_RESULT([yes (default)])
OMPI_MIN_REQUIRED_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS
OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPIF08_BINDINGS
;;
xall|xusempif08)
AC_MSG_RESULT([all (usempif08)])
OMPI_MIN_REQUIRED_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPIF08_BINDINGS
OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPIF08_BINDINGS
;;
xno|xnone)
AC_MSG_RESULT([no (none)])
OMPI_MIN_REQUIRED_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
;;
xmpifh)
AC_MSG_RESULT([yes (mpif.h)])
OMPI_MIN_REQUIRED_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS
OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS
;;
xusempi)
AC_MSG_RESULT([yes (mpif.h, mpi module)])
OMPI_MIN_REQUIRED_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS
OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS
;;
*)
AC_MSG_RESULT([unknown: $binding])
AC_MSG_WARN([--enable-mpi-fortran supports only one of the following values: yes, all, none, best-effort, mpifh, usempi, or usempif08])
AC_MSG_ERROR([Cannot continue])
;;
esac
#
# C++
#
AC_MSG_CHECKING([if want C++ bindings])
AC_ARG_ENABLE(mpi-cxx,
AC_HELP_STRING([--enable-mpi-cxx],
[enable C++ MPI bindings (default: disabled)]))
if test "$enable_mpi_cxx" = "yes"; then
AC_MSG_RESULT([yes])
WANT_MPI_CXX_SUPPORT=1
else
AC_MSG_RESULT([no])
WANT_MPI_CXX_SUPPORT=0
fi
AC_MSG_CHECKING([if want MPI::SEEK_SET support])
AC_ARG_ENABLE([mpi-cxx-seek],
[AC_HELP_STRING([--enable-mpi-cxx-seek],
[enable support for MPI::SEEK_SET, MPI::SEEK_END, and MPI::SEEK_POS in C++ bindings (default: enabled)])])
if test "$enable_mpi_cxx_seek" != "no" ; then
AC_MSG_RESULT([yes])
OMPI_WANT_MPI_CXX_SEEK=1
else
AC_MSG_RESULT([no])
OMPI_WANT_MPI_CXX_SEEK=0
fi
AC_DEFINE_UNQUOTED([OMPI_WANT_MPI_CXX_SEEK], [$OMPI_WANT_MPI_CXX_SEEK],
[do we want to try to work around C++ bindings SEEK_* issue?])
#
# Do we want to disable MPI parameter checking at run-time?
#
AC_MSG_CHECKING([if want run-time MPI parameter checking])
AC_ARG_WITH(mpi-param-check,
AC_HELP_STRING([--with-mpi-param-check(=VALUE)],
[behavior of MPI function parameter checking. Valid values are: always, never, runtime. If --with-mpi-param-check is specified with no VALUE argument, it is equivalent to a VALUE of "always"; --without-mpi-param-check is equivalent to "never" (default: runtime).]))
mpi_param_check=ompi_mpi_param_check
if test "$with_mpi_param_check" = "no" || \
test "$with_mpi_param_check" = "never"; then
mpi_param_check=0
ompi_param_check=0
AC_MSG_RESULT([never])
elif test "$with_mpi_param_check" = "yes" || \
test "$with_mpi_param_check" = "always"; then
mpi_param_check=1
ompi_param_check=1
AC_MSG_RESULT([always])
elif test "$with_mpi_param_check" = "runtime" || \
test -z "$with_mpi_params_check"; then
ompi_param_check=1
AC_MSG_RESULT([runtime])
else
AC_MSG_RESULT([unknown])
AC_MSG_WARN([*** Unrecognized --with-mpi-param-check value])
AC_MSG_WARN([*** See "configure --help" output])
AC_MSG_WARN([*** Defaulting to "runtime"])
fi
AC_DEFINE_UNQUOTED(MPI_PARAM_CHECK, $mpi_param_check,
[Whether we want to check MPI parameters always, never, or decide at run-time])
AC_DEFINE_UNQUOTED(OMPI_PARAM_CHECK, $ompi_param_check,
[Whether we want to check MPI parameters never or possible (an integer constant)])
#
# Do we want the prototype "use mpi_f08" implementation that uses
# Fortran descriptors?
#
AC_MSG_CHECKING([which 'use mpi_f08' implementation to use])
AC_ARG_ENABLE(mpi-f08-subarray-prototype,
AC_HELP_STRING([--enable-mpi-f08-subarray-prototype],
[Use the PROTOTYPE and SEVERLY FUNCTIONALITY-LIMITED Fortran 08 'use mpi_f08' implementation that supports subarrrays (via Fortran descriptors). This option will disable the normal 'use mpi_f08' implementation and *only* build the prototype implementation.]))
OMPI_BUILD_FORTRAN_F08_SUBARRAYS=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -lt $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[AC_MSG_RESULT([none (use mpi_f08 disabled)])],
[AS_IF([test "$enable_mpi_f08_subarray_prototype" = "yes"],
[OMPI_BUILD_FORTRAN_F08_SUBARRAYS=1
AC_MSG_RESULT([extra crispy (subarray prototype)])
AC_MSG_WARN([Sorry, the subarray prototype is no longer available])
AC_MSG_WARN([Contact your favorite OMPI developer and ask for it to be re-enabled])
AC_MSG_ERROR([Cannot continue])],
[AC_MSG_RESULT([regular (no subarray support)])])
])
AC_DEFINE_UNQUOTED([OMPI_BUILD_FORTRAN_F08_SUBARRAYS],
[$OMPI_BUILD_FORTRAN_F08_SUBARRAYS],
[Whether we built the 'use mpi_f08' prototype subarray-based implementation or not (i.e., whether to build the use-mpi-f08-desc prototype or the regular use-mpi-f08 implementation)])
AC_ARG_ENABLE([mpi-io],
[AC_HELP_STRING([--disable-mpi-io],
[Disable built-in support for MPI-2 I/O, likely because
an externally-provided MPI I/O package will be used.
Default is to use the internal framework system that uses
the ompio component and a specially modified version of ROMIO
that fits inside the romio314 component])])
AC_ARG_ENABLE([io-ompio],
[AC_HELP_STRING([--disable-io-ompio],
[Disable the ompio MPI-IO component])])
])dnl

140
config/ompi_contrib.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,140 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
######################################################################
#
# OMPI_CONTRIB
#
# configure the contributed software components. Currently fairly
# hard-wired, but someday should be much more like OMPI_MCA. See
# https://svn.open-mpi.org/trac/ompi/ticket/1162.
#
# USAGE:
# OMPI_CONTRIB()
#
######################################################################
AC_DEFUN([OMPI_CONTRIB],[
dnl for OPAL_CONFIGURE_USER env variable
AC_REQUIRE([OPAL_CONFIGURE_SETUP])
# Option to not build some of the contributed software packages
AC_ARG_ENABLE([contrib-no-build],
AC_HELP_STRING([--enable-contrib-no-build=LIST],
[Comma-separated list of contributed package names that will not be built. Possible values: ompi_mpicontrib_list. Example: "--enable-contrib-no-build=foo,bar" will disable building both the "foo" and "bar" contributed software packages (default: none -- i.e., build all possible contrib packages)]))
# Parse the list to see what we should not build
opal_show_subtitle "Configuring contributed software packages"
AC_MSG_CHECKING([which contributed software packages should be disabled])
if test "$enable_contrib_no_build" = "yes"; then
AC_MSG_RESULT([yes])
AC_MSG_ERROR([*** The enable-contrib-no-build flag requires an explicit list
*** of packages to not build. For example, --enable-contrib-no-build=libompitrace])
else
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
msg=
for item in $enable_contrib_no_build; do
str="`echo DISABLE_contrib_${item}=1 | sed s/-/_/g`"
eval $str
msg="$item $msg"
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
# List of contrib subdirs to traverse into
OMPI_CONTRIB_SUBDIRS=
OMPI_CONTRIB_DIST_SUBDIRS=
OMPI_MPI_CONTRIBS=
# Cycle through each of the software packages and
# configure them if not disabled.
m4_foreach(software, [ompi_mpicontrib_list],
[_OMPI_CONTRIB_CONFIGURE(software)])
# Setup the top-level glue
AC_DEFINE_UNQUOTED([OMPI_MPI_CONTRIBS], ["$OMPI_MPI_CONTRIBS"],
[Contributed software packages built with Open MPI])
AC_SUBST(OMPI_CONTRIB_SUBDIRS)
AC_SUBST(OMPI_CONTRIB_DIST_SUBDIRS)
])dnl
######################################################################
#
# _OMPI_CONTRIB_SOFTWARE
#
# Setup a specific contributed software package. This is a subroutine
# because the work to setup each package is essentially the same.
# Currently assumes that there is a configure.m4 file in the
# contributed software directory. May someday be expanded to handle
# other things.
#
# USAGE:
# _OMPI_CONTRIB_SOFTARE([package_name])
#
######################################################################
AC_DEFUN([_OMPI_CONTRIB_CONFIGURE],[
opal_show_subsubsubtitle "$1 (m4 configuration macro)"
# Put in a convenient enable/disable switch (it's a little more
# user friendly than
# --enable-contrib-no-build=<comma_delimited_list>, although each
# works just as well as the other).
AC_ARG_ENABLE([$1],
[AS_HELP_STRING([--disable-$1],
[disable support for contributed package $1 (default: enabled)])])
AS_IF([test "x$enable_$1" = xno], [DISABLE_contrib_$1=yes])
OMPI_CONTRIB_HAPPY=0
if test "$DISABLE_contrib_$1" = "" && test "$DISABLE_contrib_all" = ""; then
OMPI_contrib_$1_CONFIG([OMPI_CONTRIB_HAPPY=1], [])
AC_MSG_CHECKING([if contributed component $1 can compile])
if test "$OMPI_CONTRIB_HAPPY" = "1"; then
OMPI_CONTRIB_SUBDIRS="$OMPI_CONTRIB_SUBDIRS contrib/$1"
OMPI_CONTRIB_DIST_SUBDIRS="$OMPI_CONTRIB_DIST_SUBDIRS contrib/$1"
if test "$OMPI_MPI_CONTRIBS" = ""; then
OMPI_MPI_CONTRIBS=$1
else
OMPI_MPI_CONTRIBS="$1, $OMPI_MPI_CONTRIBS"
fi
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
# If this component was requested via command line switch, then abort.
if test "x$enable_$1" = xyes ; then
AC_MSG_WARN([Contributed component "$1" failed to configure properly])
AC_MSG_WARN([This component was requested via command line switch])
AC_MSG_ERROR([Cannot continue])
fi
fi
else
AC_MSG_NOTICE([disabled via command line switch])
fi
AC_DEFINE_UNQUOTED(OMPI_ENABLE_CONTRIB_$1, [$OMPI_CONTRIB_HAPPY],
[Enable contributed software package $1])
unset OMPI_CONTRIB_HAPPY
])dnl

94
config/ompi_cxx_find_exception_flags.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,94 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_CXX_FIND_EXCEPTION_FLAGS],[
#
# Arguments: none
#
# Dependencies: none
#
# Get the exception handling flags for the C++ compiler. Leaves
# CXXFLAGS undisturbed.
# Provides --with-exflags command line argument for configure as well.
#
# Sets OMPI_CXX_EXCEPTION_CXXFLAGS and OMPI_CXX_EXCEPTION_LDFLAGS as
# appropriate.
# Must call AC_SUBST manually
#
# Command line flags
AC_ARG_WITH(exflags,
AC_HELP_STRING([--with-exflags],
[Specify flags necessary to enable C++ exceptions]),
ompi_force_exflags="$withval")
ompi_CXXFLAGS_SAVE="$CXXFLAGS"
AC_MSG_CHECKING([for compiler exception flags])
# See which flags to use
if test "$ompi_force_exflags" != ""; then
# If the user supplied flags, use those
ompi_exflags="$ompi_force_exflags"
elif test "$GXX" = "yes"; then
# g++ has changed their flags a few times. Sigh.
CXXFLAGS="$CXXFLAGS -fexceptions"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[try { int i = 0; } catch(...) { int j = 2; }]])], ompi_happy=1, ompi_happy=0)
if test "$ompi_happy" = "1"; then
ompi_exflags="-fexceptions";
else
CXXFLAGS="$CXXFLAGS_SAVE -fhandle-exceptions"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[try { int i = 0; } catch(...) { int j = 2; }]])], ompi_happy=1, ompi_happy=0)
if test "$ompi_happy" = "1"; then
ompi_exflags="-fhandle-exceptions";
fi
fi
AC_LANG_RESTORE
elif test "`basename $CXX`" = "KCC"; then
# KCC flags
ompi_exflags="--exceptions"
fi
CXXFLAGS="$ompi_CXXFLAGS_SAVE"
# Save the result
OMPI_CXX_EXCEPTIONS_CXXFLAGS="$ompi_exflags"
OMPI_CXX_EXCEPTIONS_LDFLAGS="$ompi_exflags"
if test "$ompi_exflags" = ""; then
AC_MSG_RESULT([none necessary])
else
AC_MSG_RESULT([$ompi_exflags])
fi
# Clean up
unset ompi_force_exflags ompi_CXXFLAGS_SAVE ompi_exflags ompi_happy])dnl

44
config/ompi_cxx_find_template_parameters.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,44 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_CXX_FIND_TEMPLATE_PARAMETERS],[
#
# Arguments: none
#
# Dependencies: None
#
# Get the C++ compiler template parameters.
#
# Adds to CXXFLAGS
AC_MSG_CHECKING([for C++ compiler template parameters])
if test "$BASECXX" = "KCC"; then
new_flags="--one_instantiation_per_object"
CXXFLAGS="$CXXFLAGS $new_flags"
else
new_flags="none needed"
fi
AC_MSG_RESULT([$new_flags])
#
# Clean up
#
unset new_flags
])

172
config/ompi_cxx_find_template_repository.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,172 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_CXX_FIND_TEMPLATE_REPOSITORY],[
AC_REQUIRE([AC_PROG_GREP])
#
# Arguments: None
#
# Dependencies: None
#
# See if the compiler makes template repository directories
# Warning: this is a really screwy example! -JMS
#
# Sets OMPI_CXX_TEMPLATE_REPOSITORY to the template repository, or blank.
# Must call AC_SUBST manually
#
AC_CACHE_CHECK([for C++ template_repository_directory],
[ompi_cv_cxx_template_repository],
[_OMPI_CXX_FIND_TEMPLATE_REPOSITORY])
if test "$ompi_cv_cxx_template_repository" = "not used" ; then
OMPI_CXX_TEMPLATE_REPOSITORY=
elif test "$ompi_cv_cxx_template_repository" = "templates not supported" ; then
OMPI_CXX_TEMPLATE_REPOSITORY=
else
OMPI_CXX_TEMPLATE_REPOSITORY="$ompi_cv_cxx_template_repository"
fi
])
AC_DEFUN([_OMPI_CXX_FIND_TEMPLATE_REPOSITORY],[
# Find the repository
mkdir conf_tmp_$$
cd conf_tmp_$$
cat > conftest.h <<EOF
template <class T>
class foo {
public:
foo(T yow) : data(yow) { yow.member(3); };
void member(int i);
private:
T data;
};
class bar {
public:
bar(int i) { data = i; };
void member(int j) { data = data * j; };
private:
int data;
};
EOF
cat > conftest2.C <<EOF
#include "conftest.h"
void
some_other_function(void)
{
foo<bar> var1(6);
foo< foo<bar> > var2(var1);
}
EOF
cat > conftest1.C <<EOF
#include "conftest.h"
void some_other_function(void);
template <class T>
void
foo<T>::member(int i)
{
i += 2;
}
int
main()
{
foo<bar> var1(6);
foo< foo<bar> > var2(var1);
some_other_function();
return 0;
}
EOF
ompi_template_failed=
echo configure:__oline__: $CXX $CXXFLAGS -c conftest1.C >&5
$CXX $CXXFLAGS -c conftest1.C >&5 2>&5
if test ! -f conftest1.o ; then
ompi_cv_cxx_template_repository="templates not supported"
echo configure:__oline__: here is the program that failed: >&5
cat conftest1.C >&5
echo configure:__oline__: here is conftest.h: >&5
cat conftest.h >&5
ompi_template_failed=1
else
echo configure:__oline__: $CXX $CXXFLAGS -c conftest2.C >&5
$CXX $CXXFLAGS -c conftest2.C >&5 2>&5
if test ! -f conftest2.o ; then
ompi_cv_cxx_template_repository=
echo configure:__oline__: here is the program that failed: >&5
cat conftest2.C >&5
echo configure:__oline__: here is conftest.h: >&5
cat conftest.h >&5
else
rm -rf conftest*
for ompi_file in `ls`
do
if test "$ompi_file" != "." && test "$ompi_file" != ".."; then
# Is it a directory?
if test -d "$ompi_file"; then
ompi_template_dir="$ompi_file $ompi_template_dir"
# Or is it a file?
else
name="`echo $ompi_file | cut -d. -f1`"
temp_mask=
if test "$name" = "main" || test "$name" = "other"; then
temp_mask="`echo $ompi_file | cut -d. -f2`"
if test "$ompi_template_filemask" = ""; then
ompi_template_filemask="$temp_mask";
elif test "`echo $ompi_template_filemask | $GREP $temp_mask`" = ""; then
ompi_template_filemask="$ompi_template_filemask $temp_mask"
fi
fi
fi
fi
done
if test "$ompi_template_filemask" != ""; then
temp_mask=
for mask in $ompi_template_filemask
do
temp_mask="*.$mask $temp_mask"
done
ompi_template_filemask=$temp_mask
fi
fi
fi
ompi_cv_cxx_template_repository="$ompi_template_dir $ompi_template_filemask"
if test "`echo $ompi_cv_cxx_template_repository`" = ""; then
ompi_cv_cxx_template_repository="not used"
fi
cd ..
rm -rf conf_tmp_$$
# Clean up
unset ompi_file ompi_template_failed ompi_template_dir])

44
config/ompi_cxx_have_exceptions.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,44 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_CXX_HAVE_EXCEPTIONS],[
#
# Arguments: None
#
# Depdencies: None
#
# Check to see if the C++ compiler can handle exceptions
#
# Sets OMPI_CXX_EXCEPTIONS to 1 if compiler has exceptions, 0 if not
#
AC_MSG_CHECKING([for throw/catch])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int i=1; throw(i);]])],
OMPI_CXX_EXCEPTIONS=1, OMPI_CXX_EXCPTIONS=0)
if test "$OMPI_CXX_EXCEPTIONS" = "1"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
# Clean up
AC_LANG_RESTORE])dnl

48
config/ompi_endpoint_tag.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,48 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2013 Sandia National Laboratories. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_REQUIRE_ENDPOINT_TAG_INIT], [
ompi_endpoint_tag_counter=0
])
# OMPI_REQUIRE_ENDPOINT_TAG(tag_name)
# -----------------------------------
# This component requires an endpoint tag (storage space in the
# ompi_proc_t structure) for a tag named tag_name. If tag_name
# already has a tag index, this function is a no-op.
AC_DEFUN([OMPI_REQUIRE_ENDPOINT_TAG], [
AC_REQUIRE([OMPI_REQUIRE_ENDPOINT_TAG_INIT])
AC_MSG_CHECKING([for index in endpoint array for tag $1])
AS_IF([test -z "$OMPI_PROC_ENDPOINT_TAG_$1"],
[OMPI_PROC_ENDPOINT_TAG_$1=$ompi_endpoint_tag_counter
AC_DEFINE_UNQUOTED([OMPI_PROC_ENDPOINT_TAG_$1], [$OMPI_PROC_ENDPOINT_TAG_$1],
[Index into endpoint array for $1])
ompi_endpoint_tag_counter=`expr $ompi_endpoint_tag_counter + 1`])
AC_MSG_RESULT([$OMPI_PROC_ENDPOINT_TAG_$1])
])
AC_DEFUN([OMPI_REQUIRE_ENDPOINT_TAG_FINI], [
dnl AC_ARG_ENABLE([dynamic-endpoint-information],
dnl [AC_HELP_STRING([--disable-dynamic-endpoint-information],
dnl [Disable support for dynamic endpoint information storage. This saves a considerable amount of memory for large processes, but makes loading outside components which require endpoint storage impossible.])])
dnl AS_IF([test "$enable_endpoint_information" != "no"],
dnl [OMPI_REQUIRE_ENDPOINT_TAG(DYNAMIC)])
AC_MSG_CHECKING([for size of endpoint array])
AS_IF([test -z "$ompi_endpoint_tag_counter" || test "$ompi_endpoint_tag_counter" = "0"],
[AC_MSG_ERROR([Endpoint index count is 0. This means no MPI communication would be possible. Aborting.])])
AC_MSG_RESULT([$ompi_endpoint_tag_counter])
AC_DEFINE_UNQUOTED([OMPI_PROC_ENDPOINT_TAG_MAX], [$ompi_endpoint_tag_counter],
[Maximum number of endpoint entries to be attached to an ompi_proc_t])
])

778
config/ompi_ext.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,778 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2011-2012 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
######################################################################
#
# OMPI_EXT
#
# configure the Interface Extensions [similar to MCA version]. Works hand in
# hand with Open MPI's autogen.pl, requiring it's specially formatted lists
# of frameworks, components, etc.
#
# USAGE:
# OMPI_EXT()
#
######################################################################
AC_DEFUN([OMPI_EXT],[
dnl for OPAL_CONFIGURE_USER env variable
AC_REQUIRE([OPAL_CONFIGURE_SETUP])
# Note that we do not build DSO's here -- we *only* build convenience
# libraries that get slurped into higher-level libraries
#
# [default -- no option given] = No extensions built
# --enable-mpi-ext=[,]*EXTENSION[,]*
#
AC_ARG_ENABLE(mpi-ext,
AC_HELP_STRING([--enable-mpi-ext[=LIST]],
[Comma-separated list of extensions that should be built. Possible values: ompi_mpiext_list. Example: "--enable-mpi-ext=foo,bar" will enable building the MPI extensions "foo" and "bar". If LIST is empty or the special value "all", then all available MPI extensions will be built (default: all).]))
# print some nice messages about what we're about to do...
AC_MSG_CHECKING([for available MPI Extensions])
AC_MSG_RESULT([ompi_mpiext_list])
AC_MSG_CHECKING([which MPI extension should be enabled])
if test "$enable_mpi_ext" = "" || \
test "$enable_mpi_ext" = "yes" || \
test "$enable_mpi_ext" = "all"; then
enable_mpi_ext=all
msg="All Available Extensions"
str="`echo ENABLE_EXT_ALL=1`"
eval $str
else
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
msg=
for item in $enable_mpi_ext; do
type="`echo $item | cut -s -f1 -d-`"
if test -z $type ; then
type=$item
fi
str="`echo ENABLE_${type}=1 | sed s/-/_/g`"
eval $str
msg="$item $msg"
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
m4_ifdef([ompi_mpiext_list], [],
[m4_fatal([Could not find MPI Extensions list. Aborting.])])
EXT_CONFIGURE
])
######################################################################
#
# EXT_CONFIGURE
#
# USAGE:
# EXT_CONFIGURE()
#
######################################################################
AC_DEFUN([EXT_CONFIGURE],[
outdir=ompi/include
# first create the output include directory
mkdir -p $outdir
###############
# C Bindings
###############
# remove any previously generated #include files
mpi_ext_h=$outdir/mpi-ext.h
rm -f $mpi_ext_h
# Create the final mpi-ext.h file.
cat > $mpi_ext_h <<EOF
/*
* \$HEADER\$
*/
#ifndef OMPI_MPI_EXT_H
#define OMPI_MPI_EXT_H 1
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define OMPI_HAVE_MPI_EXT 1
EOF
###############
# mpif.h Bindings
###############
# remove any previously generated #include files
mpif_ext_h=$outdir/mpif-ext.h
rm -f $mpif_ext_h
# Create the final mpif-ext.h file.
cat > $mpif_ext_h <<EOF
! -*- fortran -*-
! \$HEADER\$
!
! *** THIS FILE IS AUTOMATICALLY GENERATED!
! *** Any manual edits will be lost!
!
integer OMPI_HAVE_MPI_EXT
parameter (OMPI_HAVE_MPI_EXT=1)
!
EOF
###############
# "use mpi" Bindings
###############
# Although Fortran module files are essentially compiled header
# files, we don't create them in ompi/include, like we do for
# mpi.h and mpif.h. Instead, we build them down in ompi/fortran,
# when we build the rest of the Fortran modules. Indeed, in the
# "use mpi" case, it needs some of the same internal modules that
# the mpi_f08 module itself needs. So the mpi_f08_ext module has
# to be built *after* the mpi_f08 module (so that all the internal
# modules it needs are already built).
# remove any previously generated #include files
outdir=ompi/mpi/fortran/mpiext
mkdir -p $outdir
mpiusempi_ext_h=$outdir/mpi-ext-module.F90
rm -f $mpiusempi_ext_h
# Create the final mpiusempi-ext.h file.
cat > $mpiusempi_ext_h <<EOF
! -*- fortran -*-
! \$HEADER\$
!
! *** THIS FILE IS AUTOMATICALLY GENERATED!
! *** Any manual edits will be lost!
!
module mpi_ext
! Even though this is not a useful parameter (cannot be used as a
! preprocessor catch) define it to keep the linker from complaining
! during the build.
integer OMPI_HAVE_MPI_EXT
parameter (OMPI_HAVE_MPI_EXT=1)
!
EOF
# Make an AM conditional to see whether we're building the mpi_ext
# module. Note that we only build it if we support the ignore-tkr
# mpi module.
AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1],
[OMPI_BUILD_FORTRAN_USEMPI_EXT=1],
[OMPI_BUILD_FORTRAN_USEMPI_EXT=0])
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_EXT,
[test $OMPI_BUILD_FORTRAN_USEMPI_EXT -eq 1])
###############
# "use mpi_f08" Bindings
###############
# See note above: we generate the mpi_f08_ext module in
# ompi/mpi/fortran/mpiext
# remove any previously generated #include files
mpiusempif08_ext_h=$outdir/mpi-f08-ext-module.F90
rm -f $mpiusempif08_ext_h
# Create the final mpiusempi-ext.h file.
cat > $mpiusempif08_ext_h <<EOF
! -*- fortran -*-
! \$HEADER\$
!
! *** THIS FILE IS AUTOMATICALLY GENERATED!
! *** Any manual edits will be lost!
!
module mpi_f08_ext
! Even though this is not a useful parameter (cannot be used as a
! preprocessor catch) define it to keep the linker from complaining
! during the build.
integer OMPI_HAVE_MPI_EXT
parameter (OMPI_HAVE_MPI_EXT=1)
!
EOF
# Only build this mpi_f08_ext module if we're building the "use
# mpi_f08" module *and* it's the non-descriptor one.
AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_F08_SUBARRAYS -eq 0],
[OMPI_BUILD_FORTRAN_USEMPIF08_EXT=1],
[OMPI_BUILD_FORTRAN_USEMPIF08_EXT=0])
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPIF08_EXT,
[test $OMPI_BUILD_FORTRAN_USEMPIF08_EXT -eq 1])
# Make an AM conditional to see whether we're building either the
# mpi_ext or mpi_f08_Ext modules.
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT,
[test $OMPI_BUILD_FORTRAN_USEMPI_EXT -eq 1 || \
test $OMPI_BUILD_FORTRAN_USEMPIF08_EXT -eq 1])
#
# Process each component
#
# remove any previously generated #include files
outfile_real=ompi/mpiext/static-components.h
outfile=$outfile_real.new
rm -f $outfile $outfile.struct $outfile.extern
$MKDIR_P ompi/mpiext
touch $outfile.struct $outfile.extern
m4_foreach(extension, [ompi_mpiext_list],
[m4_ifval(extension,
[EXT_CONFIGURE_M4_CONFIG_COMPONENT(extension,
[OMPI_MPIEXT_ALL],
[OMPI_MPIEXT_C],
[OMPI_MPIEXT_MPIFH],
[OMPI_MPIEXT_USEMPI],
[OMPI_MPIEXT_USEMPIF08])])])
###############
# C Bindings
###############
# Create the final mpi-ext.h file.
cat >> $mpi_ext_h <<EOF
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* OMPI_MPI_EXT_H */
EOF
###############
# mpif.h Bindings
###############
# Create the final mpif-ext.h file.
cat >> $mpif_ext_h <<EOF
!
EOF
###############
# "use mpi" Bindings
###############
# Create the final mpiusempi-ext.h file.
cat >> $mpiusempi_ext_h <<EOF
!
end module mpi_ext
EOF
###############
# "use mpi_f08" Bindings
###############
# Create the final mpiusempi-ext.h file.
cat >> $mpiusempif08_ext_h <<EOF
!
end module mpi_f08_ext
EOF
# Create the final .h file that will be included in the type's
# top-level glue. This lists all the static components. We don't
# need to do this for "common".
if test "$2" != "common"; then
cat > $outfile <<EOF
/*
* \$HEADER\$
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
`cat $outfile.extern`
const ompi_mpiext_component_t *ompi_mpiext_components[[]] = {
`cat $outfile.struct`
NULL
};
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
EOF
# Only replace the header file if a) it doesn't previously
# exist, or b) the contents are different. Do this to not
# trigger recompilation of certain .c files just because the
# timestamp changed on $outfile_real (similar to the way AC
# handles AC_CONFIG_HEADER files).
diff $outfile $outfile_real > /dev/null 2>&1
if test "$?" != "0"; then
mv $outfile $outfile_real
else
rm -f $outfile
fi
fi
rm -f $outfile.struct $outfile.extern
# We have all the results we need. Now put them in various
# variables/defines so that others can see the results.
OMPI_EXT_MAKE_DIR_LIST(OMPI_MPIEXT_ALL_SUBDIRS, $OMPI_MPIEXT_ALL)
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_C, $OMPI_MPIEXT_C, c, c)
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_MPIFH, $OMPI_MPIEXT_MPIFH, mpif-h, mpifh)
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_USEMPI, $OMPI_MPIEXT_USEMPI, use-mpi, usempi)
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_USEMPIF08, $OMPI_MPIEXT_USEMPIF08, use-mpi-f08, usempif08)
comps=`echo $OMPI_MPIEXT_C | sed -e 's/^[ \t]*//;s/[ \t]*$//;s/ /, /g'`
AC_DEFINE_UNQUOTED([OMPI_MPIEXT_COMPONENTS], ["$comps"],
[MPI Extensions included in libmpi])
])
######################################################################
#
# EXT_CONFIGURE_M4_CONFIG_COMPONENT
#
#
# USAGE:
# EXT_CONFIGURE_M4_CONFIG_COMPONENT((1) component_name,
# (2) all_components_variable,
# (3) c_components_variable,
# (4) mpifh_components_variable,
# (5) usempi_components_variable,
# (6) usempif08_components_variable)
#
# - component_name is a single, naked string (no prefix)
# - all others are naked component names (e.g., "example"). If an
# extension is named in that variable, it means that that extension
# has bindings of that flavor.
#
######################################################################
AC_DEFUN([EXT_CONFIGURE_M4_CONFIG_COMPONENT],[
opal_show_subsubsubtitle "MPI Extension $1"
EXT_COMPONENT_BUILD_CHECK($1, [should_build=1], [should_build=0])
# try to configure the component
m4_ifdef([OMPI_MPIEXT_$1_CONFIG], [],
[m4_fatal([Could not find OMPI_MPIEXT_]$1[_CONFIG macro for ]$1[ component])])
OMPI_MPIEXT_$1_CONFIG([should_build=${should_build}], [should_build=0])
AS_IF([test $should_build -eq 1],
[EXT_PROCESS_COMPONENT([$1], [$2], [$3], [$4], [$5], [$6])],
[EXT_PROCESS_DEAD_COMPONENT([$1], [$2])])
])
######################################################################
#
# EXT_PROCESS_COMPONENT
#
# does all setup work for given component. It should be known before
# calling that this component can build properly (and exists)
#
# USAGE:
# EXT_CONFIGURE_ALL_CONFIG_COMPONENTS((1) component_name
# (2) all_components_variable,
# (3) c_components_variable,
# (4) mpifh_components_variable,
# (5) usempi_components_variable,
# (6) usempif08_components_variable)
#
# C bindings are mandatory. Other bindings are optional / built if
# they are found. Here's the files that the m4 expects:
#
#--------------------
#
# C:
# - c/mpiext_<component>_c.h: is included in mpi_ext.h
# - c/libmpiext_<component>.la: convneience library slurped into libmpi.la
#
# mpi.f.h:
# - mpif-h/mpiext_<component>_mpifh.h: is included mpi mpif_ext.h
# - mpif-h/libmpiext_<component>_mpifh.la: convenience library slurped
# into libmpi_mpifh.la
#
# If the ..._mpifh.h file exists, it is assumed that "make all" will
# build the .la file. And therefore we'll include full support for
# the mpif.h bindings for this extension in OMPI.
#
#--------------------
#
# use mpi:
# - use-mpi/mpiext_<component>_usempi.h: included in the mpi_ext module
#
# Only supported when the ignore-tkr mpi module is built (this
# currently means: when you don't use gfortran).
#
# If the ..._usempi.h file exists, it is assumed that we'll include
# full support for the mpi_ext bindings for this extension in OMPI.
#
# NO LIBRARY IS SUPPORTED FOR THE mpi MODULE BINDINGS! It is assumed
# that all required symbols will be in the
# libmpiext_<component>_mpifh.la library, and all that this set of
# bindings does it give strong type checking to those subroutines.
#
#--------------------
#
# use mpi_f08:
# - use-mpi-f08/mpiext_<component>_usempif08.h: included in the mpi_ext module
# - use-mpi-f08/libmpiext_<component>_usempif08.la: convenience
# library slurped into libmpi_usempif08.la
#
# Only supported when the non-descriptor-based mpi_f08 module is built
# (this currently means: when you don't use gfortran).
#
# If the ..._usempif08.h file exists, it is assumed that "make all"
# will build the .la file. And therefore we'll include full support
# for the mpi_f08 bindings for this extension in OMPI.
#
######################################################################
AC_DEFUN([EXT_PROCESS_COMPONENT],[
component=$1
# Output pretty results
AC_MSG_CHECKING([if MPI Extension $component can compile])
AC_MSG_RESULT([yes])
tmp[=]m4_translit([$1],[a-z],[A-Z])
component_define="OMPI_HAVE_MPI_EXT_${tmp}"
###############
# C Bindings
###############
test_header="${srcdir}/ompi/mpiext/$component/c/mpiext_${component}_c.h"
AC_MSG_CHECKING([if MPI Extension $component has C bindings])
AS_IF([test ! -e "$test_header" && test ! -e "$test_header.in"],
[ # There *must* be C bindings
AC_MSG_RESULT([no])
AC_MSG_WARN([C bindings for MPI extensions are required])
AC_MSG_ERROR([Cannot continue])])
AC_MSG_RESULT([yes (required)])
# Save the list of headers and convenience libraries that this
# component will output
$2="$$2 $component"
$3="$$3 $component"
# JMS Where is this needed?
EXT_C_HEADERS="$EXT_C_HEADERS mpiext/$component/c/mpiext_${component}_c.h"
component_header="mpiext_${component}_c.h"
cat >> $mpi_ext_h <<EOF
/* Enabled Extension: $component */
#define $component_define 1
#include "openmpi/ompi/mpiext/$component/c/$component_header"
EOF
###############
# mpif.h bindings
###############
#
# Test if this extension has mpif.h bindings
# If not, skip this step.
#
test_header="${srcdir}/ompi/mpiext/$component/mpif-h/mpiext_${component}_mpifh.h"
enabled_mpifh=0
AC_MSG_CHECKING([if MPI Extension $component has mpif.h bindings])
if test -e "$test_header" ; then
AC_MSG_RESULT([yes])
enabled_mpifh=1
# JMS Where is this needed?
EXT_MPIFH_HEADERS="$EXT_MPIFH_HEADERS mpiext/$component/mpif-h/mpiext_${component}_mpifh.h"
$4="$$4 $component"
component_header="mpiext_${component}_mpifh.h"
cat >> $mpif_ext_h <<EOF
!
! Enabled Extension: $component
!
integer $component_define
parameter ($component_define=1)
include 'openmpi/ompi/mpiext/$component/mpif-h/$component_header'
EOF
else
AC_MSG_RESULT([no])
cat >> $mpif_ext_h <<EOF
!
! Enabled Extension: $component
! No mpif.h bindings available
!
integer $component_define
parameter ($component_define=0)
EOF
fi
###############
# "use mpi" bindings
###############
#
# Test if this extension has "use mpi" bindings
# If not, skip this step.
#
test_header="${srcdir}/ompi/mpiext/$component/use-mpi/mpiext_${component}_usempi.h"
AC_MSG_CHECKING([if MPI Extension $component has "use mpi" bindings])
if test -e "$test_header" ; then
AC_MSG_RESULT([yes])
# JMS Where is this needed?
EXT_USEMPI_HEADERS="$EXT_USEMPI_HEADERS mpiext/$component/use-mpi/mpiext_${component}_usempi.h"
$5="$$5 $component"
component_header="mpiext_${component}_usempi.h"
cat >> $mpiusempi_ext_h <<EOF
!
! Enabled Extension: $component
!
EOF
#
# Include the mpif.h header if it is available. Cannot do
# this from inside the usempi.h since, for VPATH builds, the
# top_ompi_srcdir is needed to find the header.
#
if test "$enabled_mpifh" = 1; then
mpifh_component_header="mpiext_${component}_mpifh.h"
cat >> $mpiusempi_ext_h <<EOF
include '$top_ompi_srcdir/ompi/mpiext/$component/mpif-h/$mpifh_component_header'
EOF
fi
cat >> $mpiusempi_ext_h <<EOF
include '$top_ompi_srcdir/ompi/mpiext/$component/use-mpi/$component_header'
EOF
else
AC_MSG_RESULT([no])
cat >> $mpiusempi_ext_h <<EOF
!
! Enabled Extension: $component
! No "use mpi" bindings available
!
EOF
fi
###############
# "use mpi_f08" bindings
###############
#
# Test if this extension has "use mpi_f08" bindings
# If not, skip this step.
#
test_header="${srcdir}/ompi/mpiext/$component/use-mpi-f08/mpiext_${component}_usempif08.h"
AC_MSG_CHECKING([if MPI Extension $component has "use mpi_f08" bindings])
if test -e "$test_header" ; then
AC_MSG_RESULT([yes])
# JMS Where is this needed?
EXT_USEMPIF08_HEADERS="$EXT_USEMPIF08_HEADERS mpiext/$component/use-mpi-f08/mpiext_${component}_usempif08.h"
$6="$$6 $component"
component_header="mpiext_${component}_usempif08.h"
cat >> $mpiusempif08_ext_h <<EOF
!
! Enabled Extension: $component
!
EOF
#
# Include the mpif.h header if it is available. Cannot do
# this from inside the usempif08.h since, for VPATH builds,
# the top_ompi_srcdir is needed to find the header.
#
if test "$enabled_mpifh" = 1; then
mpifh_component_header="mpiext_${component}_mpifh.h"
cat >> $mpiusempif08_ext_h <<EOF
include '$top_ompi_srcdir/ompi/mpiext/$component/mpif-h/$mpifh_component_header'
EOF
fi
cat >> $mpiusempif08_ext_h <<EOF
include '$top_ompi_srcdir/ompi/mpiext/$component/use-mpi-f08/$component_header'
EOF
else
AC_MSG_RESULT([no])
cat >> $mpiusempif08_ext_h <<EOF
!
! Enabled Extension: $component
! No "use mpi_f08" bindings available
!
EOF
fi
m4_ifdef([OMPI_MPIEXT_]$1[_NEED_INIT],
[echo "extern const ompi_mpiext_component_t ompi_mpiext_${component};" >> $outfile.extern
echo " &ompi_mpiext_${component}, " >> $outfile.struct])
# now add the flags that were set in the environment variables
# framework_component_FOO (for example, the flags set by
# m4_configure components)
m4_foreach(flags, [LDFLAGS, LIBS],
[AS_IF([test "$mpiext_$1_WRAPPER_EXTRA_]flags[" = ""],
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_]m4_tolower(flags), [$mpiext_$1_]flags)],
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_]m4_tolower(flags), [$mpiext_$1_WRAPPER_EXTRA_]flags)])
])
AS_IF([test "$mpiext_$1_WRAPPER_EXTRA_CPPFLAGS" != ""],
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_cppflags], [$mpiext_$1_WRAPPER_EXTRA_CPPFLAGS])])
])
######################################################################
#
# EXT_PROCESS_DEAD_COMPONENT
#
# process a component that can not be built. Do the last minute checks
# to make sure the user isn't doing something stupid.
#
# USAGE:
# EXT_PROCESS_DEAD_COMPONENT((1) component_name,
# (2) all_components_variable)
#
# NOTE: component_name will not be determined until run time.
#
######################################################################
AC_DEFUN([EXT_PROCESS_DEAD_COMPONENT],[
AC_MSG_CHECKING([if MPI Extension $1 can compile])
# Need to add this component to the "all" list so that it is
# included in DIST SUBDIRS
$2="$$2 $1"
AC_MSG_RESULT([no])
])
######################################################################
#
# EXT_COMPONENT_BUILD_CHECK
#
# checks the standard rules of component building to see if the
# given component should be built.
#
# USAGE:
# EXT_COMPONENT_BUILD_CHECK(component,
# action-if-build, action-if-not-build)
#
######################################################################
AC_DEFUN([EXT_COMPONENT_BUILD_CHECK],[
AC_REQUIRE([AC_PROG_GREP])
component=$1
component_path="$srcdir/ompi/mpiext/$component"
want_component=0
# build if:
# - the component type is direct and we are that component
# - there is no ompi_ignore file
# - there is an ompi_ignore, but there is an empty ompi_unignore
# - there is an ompi_ignore, but username is in ompi_unignore
if test -d $component_path ; then
# decide if we want the component to be built or not. This
# is spread out because some of the logic is a little complex
# and test's syntax isn't exactly the greatest. We want to
# build the component by default.
want_component=1
if test -f $component_path/.ompi_ignore ; then
# If there is an ompi_ignore file, don't build
# the component. Note that this decision can be
# overridden by the unignore logic below.
want_component=0
fi
if test -f $component_path/.ompi_unignore ; then
# if there is an empty ompi_unignore, that is
# equivalent to having your userid in the unignore file.
# If userid is in the file, unignore the ignore file.
if test ! -s $component_path/.ompi_unignore ; then
want_component=1
elif test ! -z "`$GREP $OPAL_CONFIGURE_USER $component_path/.ompi_unignore`" ; then
want_component=1
fi
fi
fi
# if we asked for everything, then allow it to build if able
str="ENABLED_COMPONENT_CHECK=\$ENABLE_EXT_ALL"
eval $str
if test ! "$ENABLED_COMPONENT_CHECK" = "1" ; then
# if we were explicitly disabled, don't build :)
str="ENABLED_COMPONENT_CHECK=\$ENABLE_${component}"
eval $str
if test ! "$ENABLED_COMPONENT_CHECK" = "1" ; then
want_component=0
fi
fi
AS_IF([test "$want_component" = "1"], [$2], [$3])
])
# OMPI_EXT_MAKE_DIR_LIST(subst'ed variable, shell list)
#
# Prefix every extension name with "mpiext/" and AC subst it.
# -------------------------------------------------------------------------
AC_DEFUN([OMPI_EXT_MAKE_DIR_LIST],[
$1=
for item in $2 ; do
$1="$$1 mpiext/$item"
done
AC_SUBST($1)
])
# OMPI_EXT_MAKE_LISTS((1) subst'ed variable prefix,
# (2) shell list,
# (3) bindings dir name,
# (4) bindings suffix)
#
# Prefix every extension name with "mpiext/".
# -------------------------------------------------------------------------
AC_DEFUN([OMPI_EXT_MAKE_LISTS],[
# Make the directory list
tmp=
for item in $2 ; do
tmp="$tmp mpiext/$item/$3"
done
$1_DIRS=$tmp
AC_SUBST($1_DIRS)
# Make the list of libraries
tmp=
for item in $2 ; do
tmp="$tmp "'$(top_builddir)'"/ompi/mpiext/$item/$3/libmpiext_${item}_$4.la"
done
$1_LIBS=$tmp
AC_SUBST($1_LIBS)
])

246
config/ompi_find_mpi_aint_count_offset.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,246 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
# 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-2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2014 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_DEFUN([OMPI_FIND_MPI_AINT_COUNT_OFFSET],[
_OMPI_FIND_MPI_AINT_TYPE
_OMPI_FIND_MPI_COUNT_TYPE
_OMPI_FIND_MPI_OFFSET_TYPE
if test "$ompi_fortran_happy" = "1" && \
test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS"; then
_OMPI_FIND_MPI_INTEGER_KIND
_OMPI_FIND_MPI_ADDRESS_KIND
_OMPI_FIND_MPI_COUNT_KIND
_OMPI_FIND_MPI_OFFSET_KIND
fi
])
dnl #########################################################################
AC_DEFUN([_OMPI_FIND_MPI_AINT_TYPE], [
# Find the type of MPI_Aint. We already did the work to figure
# out what opal_ptrdiff will be; just use that.
AC_MSG_CHECKING([for type of MPI_Aint])
MPI_AINT_TYPE=$opal_ptrdiff_t
# Get the size of this type; we'll need it to figure out Fortran's
# MPI_ADDRESS_KIND, later
MPI_AINT_SIZE=$opal_ptrdiff_size
AC_DEFINE_UNQUOTED(OMPI_MPI_AINT_TYPE, [$MPI_AINT_TYPE],
[Type of MPI_Aint])
AC_MSG_RESULT([$MPI_AINT_TYPE (size: $MPI_AINT_SIZE)])
])
dnl #########################################################################
AC_DEFUN([_OMPI_FIND_MPI_COUNT_TYPE], [
# Find the type of MPI_Count. Per MPI-3.0 2.5.8, it needs to be
# as least as large as an int, MPI_Aint, and MPI_Offset (we'll
# define MPI_Offset later to be the same as an MPI_Count).
# Note, however, that per
# https://svn.open-mpi.org/trac/ompi/ticket/4205, MPI_Count cannot
# be larger than a size_t (e.g., if you're compiling in 32 bit
# more on a 64 bit platform, long long will be 8 bytes, but size_t
# will only be 4 bytes). The entire BTL, PML, and convertor
# infrastructure rely on sizeof(MPI_Count) being <=
# sizeof(size_t). So artificially limit the size of MPI_Count, if
# necessary.
# Also note: do not search for int64_t or int32_t, because using
# these types mean that we would need to include <stdint.h> in
# mpi.h, which we probably shouldn't do.
# Finally, note that MPI_Count has an impact on the extent of a
# datatype, extent defined by the MPI standard as an MPI_Aint.
# This MPI_Aint is also the largest different between two memory
# pointers -- the well-known ptrdiff_t. There *are* systems where
# the address space is 32 bit but the filesystem space is 64 bit
# (e.g., BlueGene), and therefore MPI_Aint is 32 bit and
# MPI_Offset (and therefore MPI_Count) is 64 bit. Open MPI
# doesn't currently support this configuration -- re-tooling in
# the convertor/PML/BML/BTL will be necessary before that can work
# properly.
# Keep in mind, however, that while ptrdiff_t and size_t represent
# similar concepts (length or displacement in memory), one is
# slightly larger than the other (one is unsigned and the other
# signed) and there is no requirement for them to be of the same
# width. On systems with non-monolithic memory space, the scheme
# we use below may not work. On systems with non-monolithic
# memory space, the scheme we use below may not work. ...but such
# systems are pretty rare today.
MPI_COUNT_TYPE=unknonwn
AC_MSG_CHECKING([for type of MPI_Count])
if test $ac_cv_type_long_long = yes && \
test $ac_cv_sizeof_long_long -le $ac_cv_sizeof_size_t && \
test $ac_cv_sizeof_long_long -ge $MPI_AINT_SIZE; then
MPI_COUNT_TYPE="long long"
MPI_COUNT_DATATYPE=MPI_LONG_LONG
MPI_COUNT_SIZE=$ac_cv_sizeof_long_long
elif test $ac_cv_sizeof_long -le $ac_cv_sizeof_size_t && \
test $ac_cv_sizeof_long -ge $MPI_AINT_SIZE; then
MPI_COUNT_TYPE=long
MPI_COUNT_DATATYPE=MPI_LONG
MPI_COUNT_SIZE=$ac_cv_sizeof_long
elif test $ac_cv_sizeof_int -le $ac_cv_sizeof_size_t && \
test $ac_cv_sizeof_int -ge $MPI_AINT_SIZE; then
MPI_COUNT_TYPE=int
MPI_COUNT_DATATYPE=MPI_INT
MPI_COUNT_SIZE=$ac_cv_sizeof_int
fi
if test "$MPI_COUNT_TYPE" = "unknown"; then
AC_MSG_RESULT([not found])
AC_MSG_WARN([*** Unable to find a good type for MPI_Count])
AC_MSG_ERROR([Cannot continue])
fi
if test $MPI_COUNT_SIZE -eq 8 ; then
MPI_COUNT_MAX="0x7fffffffffffffffll"
elif test $MPI_COUNT_SIZE -eq 4 ; then
MPI_COUNT_MAX="0x7fffffffl"
elif test $MPI_COUNT_SIZE -eq 2 ; then
MPI_COUNT_MAX="0x7fff"
else
AC_MSG_RESULT([$MPI_COUNT_TYPE (size: $MPI_COUNT_SIZE)])
AC_MSG_WARN([*** Configure cannot handle this size -- contact Open MPI developers])
AC_MSG_ERROR([Cannot continue])
fi
AC_DEFINE_UNQUOTED(OMPI_MPI_COUNT_SIZE, $MPI_COUNT_SIZE,
[Size of the MPI_Count datatype])
AC_DEFINE_UNQUOTED(OMPI_MPI_COUNT_TYPE, $MPI_COUNT_TYPE,
[Type of the MPI_Count datatype])
AC_DEFINE_UNQUOTED(MPI_COUNT_MAX, $MPI_COUNT_MAX,
[Maximum value for an MPI_Count])
AC_MSG_RESULT([$MPI_COUNT_TYPE (size: $MPI_COUNT_SIZE)])
])
dnl #########################################################################
AC_DEFUN([_OMPI_FIND_MPI_OFFSET_TYPE], [
# Just make MPI_Offset be the same as MPI_Count
AC_MSG_CHECKING([for type of MPI_Offset])
MPI_OFFSET_TYPE=$MPI_COUNT_TYPE
AC_DEFINE_UNQUOTED(OMPI_MPI_OFFSET_TYPE, $MPI_OFFSET_TYPE,
[Type of MPI_Offset])
MPI_OFFSET_SIZE=$MPI_COUNT_SIZE
AC_DEFINE_UNQUOTED(OMPI_MPI_OFFSET_SIZE, $MPI_OFFSET_SIZE,
[Size of the MPI_Offset])
AC_MSG_RESULT([$MPI_COUNT_TYPE (size: $MPI_OFFSET_SIZE)])
AC_MSG_CHECKING([for an MPI datatype for MPI_Offset])
MPI_OFFSET_DATATYPE=$MPI_COUNT_DATATYPE
AC_DEFINE_UNQUOTED(OMPI_OFFSET_DATATYPE, $MPI_OFFSET_DATATYPE,
[MPI datatype corresponding to MPI_Offset])
AC_MSG_RESULT([$MPI_OFFSET_DATATYPE])
])
dnl #########################################################################
AC_DEFUN([_OMPI_FIND_MPI_INTEGER_KIND], [
# Get the kind value for Fortran MPI_INTEGER_KIND (corresponding
# to whatever is the same size as a F77 INTEGER -- for the
# most-likely-will-never-occur case where F77 INTEGER is smaller
# than an F90 INTEGER; see MPI-2 4.12.6.5. As with OMPI
# FORTRAN_CHECK, use the official BIND(C) KIND names (see comment
# in fortran_check.m4).
AC_MSG_CHECKING([for MPI_INTEGER_KIND])
if test $OMPI_SIZEOF_FORTRAN_INTEGER -eq 2; then
OMPI_MPI_INTEGER_KIND=$OMPI_FORTRAN_C_INT16_T_KIND
elif test $OMPI_SIZEOF_FORTRAN_INTEGER -eq 4; then
OMPI_MPI_INTEGER_KIND=$OMPI_FORTRAN_C_INT32_T_KIND
elif test $OMPI_SIZEOF_FORTRAN_INTEGER -eq 8; then
OMPI_MPI_INTEGER_KIND=$OMPI_FORTRAN_C_INT64_T_KIND
elif test $OMPI_SIZEOF_FORTRAN_INTEGER -eq 16; then
AC_MSG_ERROR([Cannot support Fortran MPI_INTEGER_KIND!])
fi
AC_SUBST(OMPI_MPI_INTEGER_KIND)
AC_MSG_RESULT([$OMPI_MPI_INTEGER_KIND])
])
dnl #########################################################################
AC_DEFUN([_OMPI_FIND_MPI_ADDRESS_KIND], [
# Get the kind value for Fortran MPI_ADDRESS_KIND (corresponding
# to whatever is big enough to hold MPI_Aint).
AC_MSG_CHECKING([for MPI_ADDRESS_KIND])
if test $MPI_AINT_SIZE -eq 2 ; then
OMPI_MPI_ADDRESS_KIND=$OMPI_FORTRAN_C_INT16_T_KIND
elif test $MPI_AINT_SIZE -eq 4 ; then
OMPI_MPI_ADDRESS_KIND=$OMPI_FORTRAN_C_INT32_T_KIND
elif test $MPI_AINT_SIZE -eq 8 ; then
OMPI_MPI_ADDRESS_KIND=$OMPI_FORTRAN_C_INT64_T_KIND
elif test $MPI_AINT_SIZE -eq 16 ; then
AC_MSG_ERROR([Cannot support Fortran MPI_ADDRESS_KIND!])
fi
AC_SUBST(OMPI_MPI_ADDRESS_KIND)
AC_MSG_RESULT([$OMPI_MPI_ADDRESS_KIND])
])
dnl #########################################################################
AC_DEFUN([_OMPI_FIND_MPI_COUNT_KIND], [
# Get the kind value for Fortran MPI_COUNT_KIND (corresponding to
# whatever is big enough to hold an MPI_Count)
AC_MSG_CHECKING([for MPI_COUNT_KIND])
if test $MPI_COUNT_SIZE -eq 2 ; then
OMPI_MPI_COUNT_KIND=$OMPI_FORTRAN_C_INT16_T_KIND
elif test $MPI_COUNT_SIZE -eq 4 ; then
OMPI_MPI_COUNT_KIND=$OMPI_FORTRAN_C_INT32_T_KIND
elif test $MPI_COUNT_SIZE -eq 8 ; then
OMPI_MPI_COUNT_KIND=$OMPI_FORTRAN_C_INT64_T_KIND
elif test $MPI_COUNT_SIZE -eq 16 ; then
AC_MSG_ERROR([Cannot support Fortran MPI_COUNT_KIND!])
fi
AC_SUBST(OMPI_MPI_COUNT_KIND)
AC_MSG_RESULT([$OMPI_MPI_COUNT_KIND])
])
dnl #########################################################################
AC_DEFUN([_OMPI_FIND_MPI_OFFSET_KIND], [
# Get the kind value for Fortran MPI_OFFSET_KIND (corresponding to
# whatever is big enough to hold an MPI_Offset)
AC_MSG_CHECKING([for MPI_OFFSET_KIND])
if test $MPI_OFFSET_SIZE -eq 2 ; then
OMPI_MPI_OFFSET_KIND=$OMPI_FORTRAN_C_INT16_T_KIND
elif test $MPI_OFFSET_SIZE -eq 4 ; then
OMPI_MPI_OFFSET_KIND=$OMPI_FORTRAN_C_INT32_T_KIND
elif test $MPI_OFFSET_SIZE -eq 8 ; then
OMPI_MPI_OFFSET_KIND=$OMPI_FORTRAN_C_INT64_T_KIND
elif test $MPI_OFFSET_SIZE -eq 16 ; then
AC_MSG_ERROR([Cannot support Fortran MPI_OFFSET_KIND!])
fi
AC_SUBST(OMPI_MPI_OFFSET_KIND)
AC_MSG_RESULT([$OMPI_MPI_OFFSET_KIND])
])

203
config/ompi_fortran_check.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,203 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_CHECK(Fortran type, c type required, types to search,
# expected size, define ompi_fortran_<foo>_t or not))
#----------------------------------------------------------
# Check Fortran type, including:
# - whether compiler supports or not
# - size of type
# - equal to expected size
# - alignment
# - associated C type
#
# types to search is a comma-seperated list of values
AC_DEFUN([OMPI_FORTRAN_CHECK], [
OPAL_VAR_SCOPE_PUSH([ofc_have_type ofc_type_size ofc_type_alignment ofc_c_type ofc_expected_size])
ofc_expected_size=$4
ofc_define_type=$5
ofc_have_type=0
ofc_type_size=$ac_cv_sizeof_int
ofc_type_alignment=$ac_cv_sizeof_int
ofc_c_type=ompi_fortran_bogus_type_t
ofc_type_kind=0
# Only check if we actually want the Fortran bindings / have a
# Fortran compiler. This allows us to call this macro, even if
# there is no Fortran compiler. If we have no Fortran compiler,
# then just set a bunch of defaults.
if test $OMPI_TRY_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS; then
OMPI_FORTRAN_CHECK_TYPE([$1], [ofc_have_type=1], [ofc_have_type=0])
else
AC_MSG_CHECKING([if Fortran compiler supports $1])
AC_MSG_RESULT([skipped])
fi
if test "$ofc_have_type" = "1"; then
# What is the size of this type?
# NOTE: Some Fortran compilers actually will return that a
# type exists even if it doesn't support it -- the compiler
# will automatically convert the unsupported type to a type
# that it *does* support. For example, if you try to use
# INTEGER*16 and the compiler doesn't support it, it may well
# automatically convert it to INTEGER*8 for you (!). So we
# have to check the actual size of the type once we determine
# that the compiler doesn't error if we try to use it
# (i.e,. the compiler *might* support that type). If the size
# doesn't match the expected size, then the compiler doesn't
# really support it.
OMPI_FORTRAN_GET_SIZEOF([], [$1], [ofc_type_size])
if test "$ofc_expected_size" != "-1" && test "$ofc_type_size" != "$ofc_expected_size"; then
AC_MSG_WARN([*** Fortran $1 does not have expected size!])
AC_MSG_WARN([*** Expected $ofc_expected_size, got $ofc_type_size])
AC_MSG_WARN([*** Disabling MPI support for Fortran $1])
ofc_have_type=0
else
# Look for a corresponding C type (will abort by itself if the
# type isn't found and we need it)
ofc_c_type=
m4_ifval([$3], [OPAL_FIND_TYPE([$1], [$3], [$2], [$ofc_type_size], [ofc_c_type])
if test -z "$ofc_c_type" ; then
ofc_have_type=0
fi])
# Get the alignment of the type
if test "$ofc_have_type" = "1"; then
OMPI_FORTRAN_GET_ALIGNMENT([$1], [ofc_type_alignment])
# Add it to the relevant list of types found
if test "$ofc_expected_size" != "-1"; then
ofc_letter=m4_translit(m4_bpatsubst($1, [^\(.\).+], [[\1]]), [a-z], [A-Z])
ofc_str="OMPI_FORTRAN_${ofc_letter}KINDS=\"\$OMPI_FORTRAN_${ofc_letter}KINDS $ofc_type_size \""
eval $ofc_str
fi
fi
# Get the kind of the type. We do this by looking at the
# Fortran type's corresponding C type (which we figured
# out above). Then we look a the official BIND(C) KIND
# type for that type. The official BIND(C) types were
# taken from table 15.2 of the Fortran 2008 standard,
# published on 6 October as ISO/IEC 1539-1:2010 (this is
# not a free document). A copy of this table is in the
# file ompi/mpi/fortran/c_to_integer_kind_mapping.pdf.
# NOTE: Some of the values of these C_* constants *may be
# negative* if the compiler doesn't support them. We have
# already verified that both the Fortran and the C types
# both exist. However, the compiler may still have -1 for
# the C_<foo> constants if the C type is not the same
# format as its corresponding Fortran type (e.g., Absoft's
# "REAL*16" and "long double" are the same size, but not
# the same format -- so the compiler is allowed to define
# C_LONG_DOUBLE to -1).
AC_MSG_CHECKING([for corresponding KIND value of $1])
case "$ofc_c_type" in
char) ofc_type_kind=C_SIGNED_CHAR ;;
double) ofc_type_kind=C_DOUBLE ;;
float) ofc_type_kind=C_FLOAT ;;
int) ofc_type_kind=C_INT ;;
int16_t) ofc_type_kind=C_INT16_T ;;
int32_t) ofc_type_kind=C_INT32_T ;;
int64_t) ofc_type_kind=C_INT64_T ;;
int8_t) ofc_type_kind=C_INT8_T ;;
long) ofc_type_kind=C_LONG ;;
long*double) ofc_type_kind=C_LONG_DOUBLE ;;
long*long) ofc_type_kind=C_LONG_LONG ;;
short) ofc_type_kind=C_SHORT ;;
float*_Complex) ofc_type_kind=C_FLOAT_COMPLEX ;;
double*_Complex) ofc_type_kind=C_DOUBLE_COMPLEX ;;
long*double*_Complex) ofc_type_kind=C_LONG_DOUBLE_COMPLEX ;;
*)
# Skip types like "DOUBLE PRECISION"
;;
esac
AS_IF([test "$ofc_type_kind" != ""],
[AC_MSG_RESULT([$ofc_type_kind])],
[AC_MSG_RESULT([<skipped>])])
# See if the value is -1. If so, then just say we don't
# have a match. If the compiler doesn't support
# ISO_C_BINDING, then we'll just fall back to a default
# kind and hope for the best. :-\
OMPI_FORTRAN_GET_KIND_VALUE([$ofc_type_kind], 4, [ofc_type_kind_value])
AS_IF([test $ofc_type_kind_value -le 0],
[ofc_have_type=0
AC_MSG_WARN([Compiler $1 and $ofc_c_type mismatch; MPI datatype unsupported])])
fi
fi
# We always need these defines -- even if we don't have a given
# type, there are some places in the code where we have to have
# *something*. Note that the bpatsubst's are the same as used
# above (see comment above), but we added a translit to make them
# uppercase.
# If we got a pretty name, use that as the basis. If not, use the
# first part of the provided fortran type (e.g.,
# "logical(selected_int_kind(2))" -> logical1")
# Finally, note that it is necessary to use the Big Long Ugly m4
# expressions in the AC_DEFINE_UNQUOTEDs. If you don't (e.g., put
# the result of the BLUm4E in a shell variable and use that in
# AC_DEFINE_UNQUOTED), autoheader won't put them in the
# AC_CONFIG_HEADER (or AM_CONFIG_HEADER, in our case).
AC_DEFINE_UNQUOTED([OMPI_HAVE_FORTRAN_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z]),
[$ofc_have_type],
[Whether we have Fortran $1 or not])
AC_DEFINE_UNQUOTED([OMPI_SIZEOF_FORTRAN_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z]),
[$ofc_type_size],
[Size of Fortran $1])
AC_DEFINE_UNQUOTED([OMPI_ALIGNMENT_FORTRAN_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z]),
[$ofc_type_alignment],
[Alignment of Fortran $1])
AC_DEFINE_UNQUOTED([OMPI_KIND_FORTRAN_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z]),
[$ofc_type_kind],
[Fortrn KIND number for $1])
if test "$3" != "" && test "$ofc_define_type" = "yes"; then
AC_DEFINE_UNQUOTED([ompi_fortran_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [A-Z], [a-z])[_t],
[$ofc_c_type],
[C type corresponding to Fortran $1])
fi
# Save some in shell variables for later use (e.g., need
# OMPI_SIZEOF_FORTRAN_INTEGER in OMPI_FORTRAN_GET_HANDLE_MAX)
[OMPI_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_])[_C_TYPE=$ofc_c_type]
[OMPI_KIND_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_])[=$ofc_type_kind]
[OMPI_HAVE_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_])[=$ofc_have_type]
[OMPI_SIZEOF_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_])[=$ofc_type_size]
[OMPI_ALIGNMENT_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_])[=$ofc_type_alignment]
# Wow, this is sick. But it works! :-)
AC_SUBST([OMPI_HAVE_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]))
AC_SUBST([OMPI_KIND_FORTRAN_]m4_translit(m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]), [a-z], [A-Z]))
AC_SUBST([OMPI_SIZEOF_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]))
AC_SUBST([OMPI_SIZEOF_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]))
AC_SUBST([OMPI_ALIGNMENT_FORTRAN_]m4_bpatsubst(m4_bpatsubst([$1], [*], []), [[^a-zA-Z0-9_]], [_]))
# Clean up
OPAL_VAR_SCOPE_POP
])dnl

47
config/ompi_fortran_check_abstract.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports the "abstract"
# keyword in derived types or not.
# OMPI_FORTRAN_CHECK_ABSTRACT([action if found],
# [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_ABSTRACT],[
AS_VAR_PUSHDEF([abstract_var], [ompi_cv_fortran_abstract])
AC_CACHE_CHECK([if Fortran compiler supports ABSTRACT], abstract_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[MODULE abstract_mod
ABSTRACT INTERFACE
SUBROUTINE binky
END SUBROUTINE
END INTERFACE
END MODULE abstract_mod]])],
[AS_VAR_SET(abstract_var, yes)],
[AS_VAR_SET(abstract_var, no)])
touch conftest_foo.mod
rm -rf *.mod 2>/dev/null
AC_LANG_POP([Fortran])
])
AS_VAR_IF(abstract_var, [yes], [$1], [$2])
AS_VAR_POPDEF([abstract_var])dnl
])

48
config/ompi_fortran_check_asynchronous.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,48 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports the "asynchronous"
# keyword in derived types or not.
# OMPI_FORTRAN_CHECK_ASYNCHRONOUS([action if found],
# [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_ASYNCHRONOUS],[
AS_VAR_PUSHDEF([asynchronous_var], [ompi_cv_fortran_asynchronous])
AC_CACHE_CHECK([if Fortran compiler supports ASYNCHRONOUS], asynchronous_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[MODULE asynch_mod
INTERFACE
SUBROUTINE binky(buf)
REAL, DIMENSION(*), ASYNCHRONOUS :: buf
END SUBROUTINE
END INTERFACE
END MODULE asynch_mod]])],
[AS_VAR_SET(asynchronous_var, yes)],
[AS_VAR_SET(asynchronous_var, no)])
touch conftest_foo.mod
rm -rf *.mod 2>/dev/null
AC_LANG_POP([Fortran])
])
AS_VAR_IF(asynchronous_var, [yes], [$1], [$2])
AS_VAR_POPDEF([asynchronous_var])dnl
])

119
config/ompi_fortran_check_bind_c.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,119 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports iso_c_binding or not
#
# OMPI_FORTRAN_CHECK_ISO_C_BINDING([action if found], [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_ISO_C_BINDING],[
AS_VAR_PUSHDEF([iso_c_binding_var], [ompi_cv_fortran_have_iso_c_binding])
AC_CACHE_CHECK([if Fortran compiler supports ISO_C_BINDING], iso_c_binding_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program check_for_iso_c_binding
use, intrinsic :: iso_c_binding
type CType
integer(C_INT) :: i
end type
end program]])],
[AS_VAR_SET(iso_c_binding_var, yes)],
[AS_VAR_SET(iso_c_binding_var, no)])
AC_LANG_POP([Fortran])
])
AS_VAR_IF(iso_c_binding_var, [yes], [$1], [$2])
AS_VAR_POPDEF([iso_c_binding_var])
])
# Check for SUBROUTINE ... BIND(C)
# OMPI_FORTRAN_CHECK_BIND_C_SUB([action if found], [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_BIND_C_SUB],[
AS_VAR_PUSHDEF([bind_c_sub_var], [ompi_cv_fortran_have_bind_c_sub])
AC_CACHE_CHECK([if Fortran compiler supports SUBROUTINE BIND(C)], bind_c_sub_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program check_for_bind_c_sub
use, intrinsic :: iso_c_binding
interface
subroutine foo(i) bind(c)
integer :: i
end subroutine foo
end interface
end program]])],
[AS_VAR_SET(bind_c_sub_var, yes)],
[AS_VAR_SET(bind_c_sub_var, no)])
AC_LANG_POP([Fortran])
])
AS_VAR_IF(bind_c_sub_var, [yes], [$1], [$2])
AS_VAR_POPDEF([bind_c_sub_var])
])
# Check for TYPE, BIND(C) :: derived_type
# OMPI_FORTRAN_CHECK_BIND_C_TYPE([action if found], [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_BIND_C_TYPE],[
AS_VAR_PUSHDEF([bind_c_type_var], [ompi_cv_fortran_have_bind_c_type])
AC_CACHE_CHECK([if Fortran compiler supports TYPE, BIND(C)], bind_c_type_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[module bindc_test
use, intrinsic :: iso_c_binding
type, bind(c) :: foo
integer :: value
end type foo
end module]])],
[AS_VAR_SET(bind_c_type_var, yes)],
[AS_VAR_SET(bind_c_type_var, no)])
AC_LANG_POP([Fortran])
])
AS_VAR_IF(bind_c_type_var, [yes], [$1], [$2])
AS_VAR_POPDEF([bind_c_type_var])dnl
])
# Check for TYPE(type), BIND(C, name="name")
# OMPI_FORTRAN_CHECK_BIND_C_TYPE_NAME([action if found], [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_BIND_C_TYPE_NAME],[
AS_VAR_PUSHDEF([bind_c_type_name_var], [ompi_cv_fortran_have_bind_c_type_name])
# See comment in ompi_setup_mpi_fortran.m4: it is important that
# the bind(c) name in this text is longer than 32 characters.
AC_CACHE_CHECK([if Fortran compiler supports TYPE(type), BIND(C, NAME="name")], bind_c_type_name_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[module bindc_test
use, intrinsic :: iso_c_binding
type, bind(c) :: foo
integer :: value
end type foo
type(foo), bind(c, name="really_long_name_longer_than_32_chars") :: bar
end module]])],
[AS_VAR_SET(bind_c_type_name_var, yes)],
[AS_VAR_SET(bind_c_type_name_var, no)])
AC_LANG_POP([Fortran])
])
AS_VAR_IF(bind_c_type_name_var, [yes], [$1], [$2])
AS_VAR_POPDEF([bind_c_type_name_var])dnl
])

49
config/ompi_fortran_check_c_funloc.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,49 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2014 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler implements
# TS 29113 subclause 8.1:
# Removed restrictions on ISO_C_BINDING module procedures.
# OMPI_FORTRAN_CHECK_C_FUNLOC([action if found],
# [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_C_FUNLOC],[
AS_VAR_PUSHDEF([c_funloc], [ompi_cv_fortran_c_funloc])
AC_CACHE_CHECK([if Fortran compiler supports C_FUNLOC/TS 29113], c_funloc,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program main
abstract interface
subroutine MPI_Comm_errhandler_function(comm, error_code)
implicit none
integer :: comm, error_code
end subroutine
end interface
contains
subroutine mysub(fn)
use, intrinsic :: iso_c_binding, only : c_funloc, c_funptr
procedure(MPI_Comm_errhandler_function) :: comm_errhandler_fn
type(c_funptr) :: comm_errhandler_fn_c
comm_errhandler_fn_c = c_funloc(comm_errhandler_fn)
end subroutine mysub
end program]])],
[AS_VAR_SET(c_funloc, yes)],
[AS_VAR_SET(c_funloc, no)])
AC_LANG_POP([Fortran])
])
AS_VAR_IF(c_funloc, [yes], [$1], [$2])
AS_VAR_POPDEF([c_funloc])dnl
])

Просмотреть файл

@ -0,0 +1,61 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
# Does this compiler support the Fortran 2008 assumed rank syntax?
# OMPI_FORTRAN_CHECK_F08_ASSUMED_RANK([action if found],
# [action if not found])
# ----------------------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_F08_ASSUMED_RANK], [
AS_VAR_PUSHDEF([fortran_f08_assumed_rank],
[ompi_cv_fortran_f08_assumed_rank])
AC_CACHE_CHECK([Fortran compiler F08 assumed rank syntax],
fortran_f08_assumed_rank,
[_OMPI_FORTRAN_CHECK_F08_ASSUMED_RANK])
AS_VAR_IF(fortran_f08_assumed_rank, [yes], [$1], [$2])
])
###################################
AC_DEFUN([_OMPI_FORTRAN_CHECK_F08_ASSUMED_RANK], [
OPAL_VAR_SCOPE_PUSH([happy])
# If we were called here, it means that the value was not cached,
# so we need to check several different things. Since CACHE_CHECK
# puts up a MSG_CHECKING, we need to terminate it with a bogus
# answer before doing the individual checks.
AC_MSG_RESULT([not cached; checking])
# Check for the F08 type(*),dimension(..) syntax
OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB([!], [TYPE(*), DIMENSION(..)],
[TYPE(*), DIMENSION(..)],
[happy=yes], [happy=no])
AS_VAR_SET(fortran_f08_assumed_rank, [$happy]);
# Now put the orignal CACHE_CHECK MSG_CHECKING back so that it can
# output the MSG_RESULT.
AC_MSG_CHECKING([Fortran compiler F08 assumed rank syntax])
OPAL_VAR_SCOPE_POP
])

205
config/ompi_fortran_check_ignore_tkr.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,205 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
# Does this compiler support (void*)-like functionality for MPI choice
# buffers? If so, which flavor?
AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR], [
OPAL_VAR_SCOPE_PUSH([result happy type predecl])
OMPI_FORTRAN_IGNORE_TKR_PREDECL=
OMPI_FORTRAN_IGNORE_TKR_TYPE=
AS_VAR_PUSHDEF([fortran_ignore_tkr_data],
[ompi_cv_fortran_ignore_tkr_data])
# Note that we can only cache 1 value at a time, but this test
# needs to check for 2 things: the ignore TKR predecl and the
# type. So we encode them into a string of the form
# <1|0>:<type>:<predecl>. Ugh.
AC_CACHE_CHECK([Fortran compiler ignore TKR syntax],
fortran_ignore_tkr_data,
[_OMPI_FORTRAN_CHECK_IGNORE_TKR])
AS_VAR_COPY([result], [fortran_ignore_tkr_data])
# Parse the result
happy=`echo $result | cut -d: -f1`
type=`echo $result | cut -d: -f2`
predecl=`echo $result | cut -d: -f3-`
AS_IF([test $happy -eq 1],
[OMPI_FORTRAN_IGNORE_TKR_PREDECL=$predecl
OMPI_FORTRAN_IGNORE_TKR_TYPE=$type
$1],
[$2])
AS_VAR_POPDEF([fortran_ignore_tkr_data])
OPAL_VAR_SCOPE_POP
])
################
AC_DEFUN([_OMPI_FORTRAN_CHECK_IGNORE_TKR], [
OPAL_VAR_SCOPE_PUSH([happy ompi_fortran_ignore_tkr_predecl ompi_fortran_ignore_tkr_type])
# If we were called here, it means that the value was not cached,
# so we need to check several different things. Since CACHE_CHECK
# puts up a MSG_CHECKING, we need to terminate it with a bogus
# answer before doing the individual checks.
AC_MSG_RESULT([not cached; checking variants])
# Default values
ompi_fortran_ignore_tkr_predecl=!
ompi_fortran_ignore_tkr_type=real
# Vendor-neutral, TYPE(*) syntax
OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!], [type(*)],
[TYPE(*), DIMENSION(*)],
[happy=1], [happy=0])
# GCC compilers
AS_IF([test $happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!GCC\$ ATTRIBUTES NO_ARG_CHECK ::], [type(*), dimension(*)],
[!GCC\$ ATTRIBUTES NO_ARG_CHECK],
[happy=1], [happy=0])])
# Intel compilers
AS_IF([test $happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!DEC\$ ATTRIBUTES NO_ARG_CHECK ::], [real, dimension(*)],
[!DEC\$ ATTRIBUTES NO_ARG_CHECK],
[happy=1], [happy=0])])
# Solaris Studio compilers
# Note that due to a compiler bug, we have been advised by Oracle to
# use the "character(*)" type
AS_IF([test $happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!\$PRAGMA IGNORE_TKR], [character(*)],
[!\$PRAGMA IGNORE_TKR],
[happy=1], [happy=0])])
# Cray compilers
AS_IF([test $happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!DIR\$ IGNORE_TKR], [real, dimension(*)],
[!DIR\$ IGNORE_TKR],
[happy=1], [happy=0])])
# IBM compilers
AS_IF([test $happy -eq 0],
[OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB(
[!IBM* IGNORE_TKR], [real, dimension(*)],
[!IBM* IGNORE_TKR],
[happy=1], [happy=0])])
AS_VAR_SET(fortran_ignore_tkr_data,
[${happy}:${ompi_fortran_ignore_tkr_type}:${ompi_fortran_ignore_tkr_predecl}])
# Now put the orignal CACHE_CHECK MSG_CHECKING back so that it can
# output the MSG_RESULT.
AC_MSG_CHECKING([Fortran compiler ignore TKR syntax])
OPAL_VAR_SCOPE_POP
])dnl
###################################
# Generic check to see if Fortran compiler supports (void*)-like
# functionality
# $1: pre-decl qualifier line -- likely a compiler directive
# $2: parameter type
# $3: message for AC-MSG-CHECKING
# $4: action to take if the test passes
# $5: action to take if the test fails
AC_DEFUN([OMPI_FORTRAN_CHECK_IGNORE_TKR_SUB], [
OPAL_VAR_SCOPE_PUSH(msg)
AC_LANG_PUSH([Fortran])
AC_MSG_CHECKING([for Fortran compiler support of $3])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[[!
! Autoconf puts "program main" at the top
interface
subroutine force_assumed_shape(a, count)
integer :: count
complex, dimension(:,:) :: a
end subroutine force_assumed_shape
end interface
interface
subroutine foo(buffer, count)
$1 buffer
$2, intent(in) :: buffer
integer, intent(in) :: count
end subroutine foo
end interface
! Simple interface with an un-typed first argument (e.g., a choice buffer)
integer :: count
real :: buffer1(3)
character :: buffer2
complex :: buffer3(4,4)
complex, pointer, dimension(:,:) :: ptr
target :: buffer3
integer :: buffer4
ptr => buffer3
! Set some known values (somewhat irrelevant for this test, but just be
! sure that the values are initialized)
a = 17
buffer1(1) = 4.5
buffer1(2) = 6.7
buffer1(3) = 8.9
buffer2 = 'a'
! Call with one type for the first argument
call foo(buffer1, count)
! Call with a different type for the first argument
call foo(buffer2, count)
! Force us through an assumed shape
call force_assumed_shape(buffer3, count)
! Force a pointer call through an assumed shape (!)
ptr => buffer3
! Also try with a simple scalar integer
! (Intel 2016 compiler suite only partially supports GCC pragmas;
! they work with all the above buffer types, but fail with a
! simple scalar integer)
call foo(buffer4, count)
end program
subroutine force_assumed_shape(a, count)
integer :: count
real, dimension(:,:) :: a
call foo(a, count)
end subroutine force_assumed_shape
! Autoconf puts "end" after the last line
subroutine bogus
]]),
[msg=yes
ompi_fortran_ignore_tkr_predecl="$1"
ompi_fortran_ignore_tkr_type="$2"
$4],
[msg=no
$5])
AC_MSG_RESULT($msg)
AC_LANG_POP([Fortran])
OPAL_VAR_SCOPE_POP
])

51
config/ompi_fortran_check_interface.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,51 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports the "interface"
# keyword or not.
# OMPI_FORTRAN_CHECK_INTERFACE([action if found],
# [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_INTERFACE],[
AS_VAR_PUSHDEF([interface_var], [ompi_cv_fortran_interface])
AC_CACHE_CHECK([if Fortran compiler supports INTERFACE], interface_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[MODULE my_module
INTERFACE MPI_Foo
SUBROUTINE inky(a)
DOUBLE PRECISION A
END SUBROUTINE inky
SUBROUTINE blinky(a)
INTEGER A
END SUBROUTINE blinky
END INTERFACE MPI_Foo
END MODULE my_module]])],
[AS_VAR_SET(interface_var, yes)],
[AS_VAR_SET(interface_var, no)])
touch conftest_foo.mod
rm -rf *.mod 2>/dev/null
AC_LANG_POP([Fortran])
])
AS_VAR_IF(interface_var, [yes], [$1], [$2])
AS_VAR_POPDEF([interface_var])dnl
])

Просмотреть файл

@ -0,0 +1,42 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports iso_fortran_env or not
#
# OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV([action if found], [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV],[
AS_VAR_PUSHDEF([iso_fortran_env_var], [ompi_cv_fortran_have_iso_fortran_env])
AC_CACHE_CHECK([if Fortran compiler supports ISO_FORTRAN_ENV], iso_fortran_env_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program check_for_iso_fortran_env
use, intrinsic :: iso_fortran_env
real(real32) :: var
var = 12.34
end program]])],
[AS_VAR_SET(iso_fortran_env_var, yes)],
[AS_VAR_SET(iso_fortran_env_var, no)])
AC_LANG_POP([Fortran])
])
AS_VAR_IF(iso_fortran_env_var, [yes], [$1], [$2])
AS_VAR_POPDEF([iso_fortran_env_var])
])

122
config/ompi_fortran_check_logical_array.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,122 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University.
dnl All rights reserved.
dnl Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
dnl All rights reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_FORTRAN_CHECK_LOGICAL_ARRAY],[
AS_VAR_PUSHDEF([logical_array_var],
[ompi_cv_fortran_logical_array_correct])
AC_CACHE_CHECK([for correct handling of Fortran logical arrays],
logical_array_var,
[if test "$1" = "none" || \
test $OMPI_TRY_FORTRAN_BINDINGS -eq $OMPI_FORTRAN_NO_BINDINGS || \
test $ompi_fortran_happy -eq 0; then
value=skipped
else
# Fortran module
cat > conftestf.f <<EOF
program check_logical_array
external ompi_check
logical l(2)
l(1)=.FALSE.
l(2)=.TRUE.
CALL ompi_check(l)
end
EOF
# C module
# We really need the confdefs.h Header file for
# the ompi_fortran_logical_t definition
if test \! -f confdefs.h ; then
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** Cannot find confdefs.h file for config test])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
fi
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include "confdefs.h"
#ifdef __cplusplus
extern "C" {
#endif
void ompi_check_f(ompi_fortran_logical_t * logical)
{
int result = 0;
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
if (logical[[0]] == 0 &&
logical[[1]] == $ompi_cv_fortran_true_value)
result = 1;
fprintf(f, "%d\n", result);
}
void ompi_check(ompi_fortran_logical_t * logical)
{ ompi_check_f(logical); }
void ompi_check_(ompi_fortran_logical_t * logical)
{ ompi_check_f(logical); }
void ompi_check__(ompi_fortran_logical_t * logical)
{ ompi_check_f(logical); }
void OMPI_CHECK(ompi_fortran_logical_t * logical)
{ ompi_check_f(logical); }
#ifdef __cplusplus
}
#endif
EOF
# Try the compilation and run. Can't use AC_TRY_RUN
# because it's two module files.
OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
[OPAL_LOG_COMMAND([$FC $FCFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
[happy=1], [happy=0])],
[happy=0])
if test "$happy" = "0" ; then
AC_MSG_ERROR([Error determining if arrays of logical values work properly.])
fi
AS_IF([test "$cross_compiling" = "yes"],
[ # assume we're ok
value=yes],
[OPAL_LOG_COMMAND([./conftest],
[if test "`cat conftestval`" = "1" ; then
value=yes
else
value=no
fi],
[value=no])])
fi
AS_VAR_SET(logical_array_var, [$value])
])
AS_VAR_COPY([ompi_fortran_logical_array_correct], [logical_array_var])
if test "$ompi_fortran_logical_array_correct" = "no" ; then
AC_MSG_ERROR([Error determining if arrays of logical values work properly.])
fi
AS_VAR_POPDEF([logical_array_var])
unset happy ompi_check_logical_fn
rm -rf conftest*
])dnl

69
config/ompi_fortran_check_max_array_rank.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,69 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check the max array rank that the Fortran compiler supports.
#
# OMPI_FORTRAN_CHECK_MAX_ARRAY_RANK
#
# Sets $OMPI_FORTRAN_MAX_ARRAY_RANK, AC_SUBSTs it, and AC_DEFINEs
# OMPI_FORTRAN_MAX_ARRAY_RANK.
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_MAX_ARRAY_RANK],[
AS_VAR_PUSHDEF([max_array_rank_var], [ompi_cv_fortran_max_array_rank])
OPAL_VAR_SCOPE_PUSH([f_max_rank f_fail f_rank f_i f_dim])
AC_CACHE_CHECK([max supported Fortran array rank], max_array_rank_var,
[AC_LANG_PUSH([Fortran])
f_max_rank=0
f_fail=0
# Realistically, this will only be 7 or 15. But what the heck
# -- try them all. Note that we don't test above 15, because
# that's the max value from the F2008 spec (and some compilers
# will let you go above rank=16, e.g., Intel ifort).
for f_rank in 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
if test $f_fail -eq 0; then
f_i=1
f_dim=2
while test `expr $f_i + 1` -le $f_rank; do
f_dim="$f_dim,2"
f_i=`expr $f_i + 1`
done
OPAL_LOG_MSG([testing Fortran dimension $f_rank / $f_dim])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[PROGRAM test_program
INTEGER, DIMENSION($f_dim) :: var
var($f_dim) = 3
END PROGRAM test_program]])],
[f_max_rank=$f_rank], [f_fail=1])
fi
done
AS_VAR_SET(max_array_rank_var, $f_max_rank)
AC_LANG_POP([Fortran])
])
AS_VAR_COPY([OMPI_FORTRAN_MAX_ARRAY_RANK], [max_array_rank_var])
AC_SUBST(OMPI_FORTRAN_MAX_ARRAY_RANK)
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_MAX_ARRAY_RANK],
[$OMPI_FORTRAN_MAX_ARRAY_RANK],
[Max dimension rank of Fortran arrays])
OPAL_VAR_SCOPE_POP
AS_VAR_POPDEF([max_array_rank_var])dnl
])

54
config/ompi_fortran_check_optional_args.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,54 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports the "optional"
# keyword or not.
# OMPI_FORTRAN_CHECK_OPTIONAL_ARGS([action if found],
# [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_OPTIONAL_ARGS],[
AS_VAR_PUSHDEF([optional_var], [ompi_cv_fortran_optional])
AC_CACHE_CHECK([if Fortran compiler supports optional arguments], optional_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program check_for_optional
use, intrinsic :: iso_c_binding
interface
subroutine check_op(i, ierror)
integer, intent(in), value :: i
integer, intent(out), optional :: ierror
end subroutine check_op
end interface
integer :: ierror
call check_op(0)
call check_op(1, ierror)
end program]])],
[AS_VAR_SET(optional_var, yes)],
[AS_VAR_SET(optional_var, no)])
AC_LANG_POP([Fortran])
])
AS_VAR_IF(optional_var, [yes], [$1], [$2])
AS_VAR_POPDEF([optional_var])dnl
])

47
config/ompi_fortran_check_private.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports the "private"
# keyword in derived types or not.
# OMPI_FORTRAN_CHECK_PRIVATE([action if found],
# [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_PRIVATE],[
AS_VAR_PUSHDEF([private_var], [ompi_cv_fortran_private])
AC_CACHE_CHECK([if Fortran compiler supports PRIVATE], private_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[module test_for_private
type :: derived_with_private
integer :: this_is_a_public_integer
integer, private :: this_is_a_private_integer
end type derived_with_private
end module test_for_private]])],
[AS_VAR_SET(private_var, yes)],
[AS_VAR_SET(private_var, no)])
touch conftest_foo.mod
rm -rf *.mod 2>/dev/null
AC_LANG_POP([Fortran])
])
AS_VAR_IF(private_var, [yes], [$1], [$2])
AS_VAR_POPDEF([private_var])dnl
])

56
config/ompi_fortran_check_procedure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,56 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports the "procedure"
# keyword in derived types or not.
# OMPI_FORTRAN_CHECK_PROCEDURE([action if found],
# [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_PROCEDURE],[
AS_VAR_PUSHDEF([procedure_var], [ompi_cv_fortran_procedure])
AC_CACHE_CHECK([if Fortran compiler supports PROCEDURE], procedure_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[MODULE proc_mod
INTERFACE
SUBROUTINE MPI_User_function
END SUBROUTINE
END INTERFACE
END MODULE proc_mod
PROGRAM test_proc
INTERFACE
SUBROUTINE binky(user_fn)
USE proc_mod
PROCEDURE(MPI_User_function) :: user_fn
END SUBROUTINE
END INTERFACE
END PROGRAM]])],
[AS_VAR_SET(procedure_var, yes)],
[AS_VAR_SET(procedure_var, no)])
touch conftest_foo.mod
rm -rf *.mod 2>/dev/null
AC_LANG_POP([Fortran])
])
AS_VAR_IF(procedure_var, [yes], [$1], [$2])
AS_VAR_POPDEF([procedure_var])dnl
])

44
config/ompi_fortran_check_protected.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,44 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports the "protected"
# keyword in derived types or not.
# OMPI_FORTRAN_CHECK_PROTECTED([action if found],
# [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_PROTECTED],[
AS_VAR_PUSHDEF([protected_var], [ompi_cv_fortran_protected])
AC_CACHE_CHECK([if Fortran compiler supports PROTECTED], protected_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[module test_for_protected
integer, protected :: bogus
end module test_for_protected]])],
[AS_VAR_SET(protected_var, yes)],
[AS_VAR_SET(protected_var, no)])
touch conftest_foo.mod
rm -rf *.mod 2>/dev/null
AC_LANG_POP([Fortran])
])
AS_VAR_IF(protected_var, [yes], [$1], [$2])
AS_VAR_POPDEF([protected_var])dnl
])

156
config/ompi_fortran_check_real16_c_equiv.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,156 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_CHECK_REAL16_C_EQUIV
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_REAL16_C_EQUIV],[
unset happy
OPAL_VAR_SCOPE_PUSH([happy define_value msg CFLAGS_save])
AS_VAR_PUSHDEF([real16_matches_c_var], [ompi_cv_real16_c_equiv])
# We have to do this as a cache check for cross-compilation platforms
AC_CACHE_CHECK([for C type matching bit representation of REAL*16],
real16_matches_c_var,
[AS_IF([test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS" && \
test "$OMPI_HAVE_FORTRAN_REAL16" = "1"],
[
# AC_CACHE_CHECK automatically does its own AC_MSG_CHECKING, so close it out
AC_MSG_RESULT([pending])
# First check the type that we found was the same length in C
AC_MSG_CHECKING([if $OMPI_FORTRAN_REAL16_C_TYPE == REAL*16])
OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE([$OMPI_FORTRAN_REAL16_C_TYPE], [L])
# If that didn't work, see if we have a compiler-specific
# type that might work
AS_IF([test "$happy" = "no"],
[AC_MSG_RESULT([$happy])
# Intel compiler has a special type that should work
AS_IF([test "$opal_cv_c_compiler_vendor" = "intel"],
[AC_MSG_CHECKING([if intel compiler _Quad == REAL*16])
CFLAGS_save="$CFLAGS"
CFLAGS="$CFLAGS -Qoption,cpp,--extended_float_types"
OPAL_UNIQ([CFLAGS])
OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE([_Quad], [q])
AS_IF([test "$happy" = "yes"],
[OMPI_FORTRAN_REAL16_C_TYPE="_Quad"
AC_MSG_RESULT([works!])],
[CFLAGS="$CFLAGS_save"
AC_MSG_RESULT([does not work])])
])
AS_IF([test "$opal_cv_c_compiler_vendor" = "gnu" && test "$ac_cv_type___float128" = "yes"],
[AC_MSG_CHECKING([if gnu compiler __float128 == REAL*16])
OPAL_UNIQ([CFLAGS])
OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE([__float128], [q])
AS_IF([test "$happy" = "yes"],
[OMPI_FORTRAN_REAL16_C_TYPE="__float128"
AC_MSG_RESULT([works!])],
[AC_MSG_RESULT([does not work])])
])
# We have to [re-]print a new message here, because
# AC_CACHE_CHECK will automatically AC_MSG_RESULT
AC_MSG_CHECKING([for C type matching bit representation of REAL*16])
])
AS_VAR_SET(real16_matches_c_var, [$happy])
],[
# No fortran bindings or no REAL*16
AS_IF([test "$OMPI_TRY_FORTRAN_BINDINGS" = "$OMPI_FORTRAN_NO_BINDINGS"],
[msg="skipped (no Fortran MPI bindings)"],
[msg="skipped (no REAL*16)"])
AS_VAR_SET(real16_matches_c_var, [$msg])
])
])
AS_VAR_COPY([ompi_real16_matches_c], [real16_matches_c_var])
AS_VAR_POPDEF([real16_matches_c_var])
AS_IF([test "$ompi_real16_matches_c" = "yes"],
[define_value=1],
[define_value=0
AC_MSG_WARN([MPI_REAL16 and MPI_COMPLEX32 support have been disabled])])
AC_DEFINE_UNQUOTED([OMPI_REAL16_MATCHES_C], [$define_value],
[Whether Fortran REAL*16 matches the bit format of the equivalent C type])
OPAL_VAR_SCOPE_POP
])
# OMPI_FORTRAN_CHECK_REAL16_C_EQUIV_TYPE(type, suffix)
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_REAL16_EQUIV_TYPE],[
# C module
cat > conftest_c.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
void c_backend($1 *a) {
$1 foo = 11;
FILE *fp = fopen("conftestval", "w");
if (NULL == fp) exit(1);
foo = 1 / foo;
fprintf(fp, "%s\n", (foo == *a) ? "yes" : "no");
fclose(fp);
}
void C($1 *a) { c_backend(a); }
void c($1 *a) { c_backend(a); }
void c_($1 *a) { c_backend(a); }
/* JMS I'm pretty sure this one will never happen...? */
void c__($1 *a) { c_backend(a); }
#ifdef __cplusplus
}
#endif
EOF
# Fortran module
cat > conftest_f.f <<EOF
program bogus
REAL*16 :: foo = 11
foo = 1 / foo
call c(foo)
end program bogus
EOF
rm -f conftestval
# Compile and link
OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest_c.c],
[OPAL_LOG_COMMAND([$FC $FCFLAGS conftest_f.f conftest_c.o -o conftest $LDFLAGS $LIBS],
[happy="yes"], [happy="no"])], [happy="no"])
AS_IF([test "$happy" = "no"],
[AC_MSG_RESULT([Could not determine if REAL*16 bit-matches C type])],
# If it worked so far, try running to see what we get
[AS_IF([test "$happy" = "yes" && test "$cross_compiling" = "yes"],
[AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Can not determine if REAL*16 bit-matches C if cross compiling])],
[OPAL_LOG_COMMAND([./conftest],
[happy=`cat conftestval`],
[AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Could not determine if REAL*16 bit-matches C type])
])
])
])
# All done; whack tmp files
rm -rf conftest*
])

106
config/ompi_fortran_check_storage_size.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,106 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# Check whether or not the Fortran compiler supports storage_size()
# for all relevant types or not. E.g., gfortran 4.8 supports
# storage_size() on some types, not but all.
#
# OMPI_FORTRAN_CHECK_STORAGE_SIZE([action if found], [action if not found])
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_STORAGE_SIZE],[
AS_VAR_PUSHDEF([fortran_storage_size_var], [ompi_cv_fortran_have_storage_size])
AC_CACHE_CHECK([if Fortran compiler supports STORAGE_SIZE for relevant types],
fortran_storage_size_var,
[AC_LANG_PUSH([Fortran])
AC_LINK_IFELSE([AC_LANG_SOURCE([[program check_for_storage_size
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32, INT32
integer size
complex(real32) :: c32
complex(real32), dimension(5) :: c32_array
real(real32) :: r32
real(real32), dimension(5) :: r32_array
integer(int32) :: i32
integer(int32), dimension(5) :: i32_array
call storage_size_complex32_scalar(c32, size)
call storage_size_complex32_r1(c32_array, size)
call storage_size_int32_scalar(i32, size)
call storage_size_int32_r1(i32_array, size)
call storage_size_real32_scalar(r32, size)
call storage_size_real32_r1(r32_array, size)
end program
SUBROUTINE storage_size_complex32_scalar(x, size)
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32
COMPLEX(REAL32) ::x
INTEGER, INTENT(OUT) :: size
size = storage_size(x) / 8
END SUBROUTINE storage_size_complex32_scalar
SUBROUTINE storage_size_complex32_r1(x, size)
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32
COMPLEX(REAL32), DIMENSION(*)::x
INTEGER, INTENT(OUT) :: size
size = storage_size(x) / 8
END SUBROUTINE storage_size_complex32_r1
SUBROUTINE storage_size_int32_scalar(x, size)
USE, INTRINSIC :: iso_fortran_env, ONLY: INT32
INTEGER(INT32) ::x
INTEGER, INTENT(OUT) :: size
size = storage_size(x) / 8
END SUBROUTINE storage_size_int32_scalar
SUBROUTINE storage_size_int32_r1(x, size)
USE, INTRINSIC :: iso_fortran_env, ONLY: INT32
INTEGER(INT32), DIMENSION(*)::x
INTEGER, INTENT(OUT) :: size
size = storage_size(x) / 8
END SUBROUTINE storage_size_int32_r1
SUBROUTINE storage_size_real32_scalar(x, size)
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32
REAL(REAL32) ::x
INTEGER, INTENT(OUT) :: size
size = storage_size(x) / 8
END SUBROUTINE storage_size_real32_scalar
SUBROUTINE storage_size_real32_r1(x, size)
USE, INTRINSIC :: iso_fortran_env, ONLY: REAL32
REAL(REAL32), DIMENSION(*)::x
INTEGER, INTENT(OUT) :: size
size = storage_size(x) / 8
END SUBROUTINE storage_size_real32_r1
]])],
[AS_VAR_SET(fortran_storage_size_var, yes)],
[AS_VAR_SET(fortran_storage_size_var, no)])
AC_LANG_POP([Fortran])
])
AS_VAR_IF(fortran_storage_size_var, [yes], [$1], [$2])
AS_VAR_POPDEF([fortran_storage_size_var])
])

43
config/ompi_fortran_check_type.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,43 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_CHECK_TYPE([type, action if found, action if not found])
# -----------------------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_TYPE],[
# Use of m4_translit suggested by Eric Blake:
# http://lists.gnu.org/archive/html/bug-autoconf/2010-10/msg00016.html
AS_VAR_PUSHDEF([type_var],
m4_translit([[ompi_cv_fortran_have_$1]], [*], [p]))
# Determine Fortran datatype size.
# First arg is type, 2nd arg is config var to define
AC_CACHE_CHECK([if Fortran compiler supports $1], type_var,
[AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[program main
$1 :: bogus_variable
end program]])],
[AS_VAR_SET(type_var, yes)],
[AS_VAR_SET(type_var, no)])
AC_LANG_POP([Fortran])])
AS_VAR_IF(type_var, [yes], [$2], [$3])
AS_VAR_POPDEF([type_var])dnl
])dnl

75
config/ompi_fortran_check_use_only.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,75 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
dnl
dnl Check whether Fortran compiler supports the "only" clause properly
dnl when using modules. Specifically, if we "use a :: only foo" and "use
dnl b :: only bar", and modules a and b have a conflicting "yow"
dnl definition, it *should* be ignored because of the "only" clauses. PGI
dnl 15.7 (and probably prior versions) does not -- but only when
dnl compiling with -g (!).
dnl
dnl OMPI_FORTRAN_CHECK_USE_ONLY([action if supported],
dnl [action if not supported])
dnl ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_CHECK_USE_ONLY],[
AS_VAR_PUSHDEF([use_only_var], [ompi_cv_fortran_use_only])
OPAL_VAR_SCOPE_PUSH([FCFLAGS_save])
FCFLAGS_save=$FCFLAGS
FCFLAGS="-I. $FCFLAGS"
AC_CACHE_CHECK([if Fortran compiler supports USE...ONLY], use_only_var,
[AC_LANG_PUSH([Fortran])
cat > aaa.f90 << EOF
MODULE aaa
INTEGER :: CMON(1)
COMMON/CMMON/CMON
INTEGER :: global_aaa
END MODULE aaa
EOF
cat > bbb.f90 << EOF
MODULE bbb
integer, bind(C, name="cmmon_") :: CMON
INTEGER :: global_bbb
END MODULE bbb
EOF
OPAL_LOG_COMMAND([$FC $FCFLAGS -c aaa.f90],
[OPAL_LOG_COMMAND([$FC $FCFLAGS -c bbb.f90],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[PROGRAM test
USE aaa, ONLY : global_aaa
USE bbb, ONLY : global_bbb
implicit none
END PROGRAM]])],
[AS_VAR_SET(use_only_var, yes)],
[AS_VAR_SET(use_only_var, no)])],
[AS_VAR_SET(use_only_var, no)])],
[AS_VAR_SET(use_only_var, no)])
rm -rf aaa.f90 aaa.o bbb.f90 bbb.o *.mod 2>/dev/null
AC_LANG_POP([Fortran])
])
AS_VAR_IF(use_only_var, [yes], [$1], [$2])
FCFLAGS=$FCFLAGS_save
OPAL_VAR_SCOPE_POP
AS_VAR_POPDEF([use_only_var])dnl
])

Просмотреть файл

@ -0,0 +1,143 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_FORTRAN_FIND_EXT_SYMBOL_CONVENTION], [
AC_REQUIRE([AC_PROG_NM])
AC_REQUIRE([AC_PROG_GREP])
OPAL_VAR_SCOPE_PUSH([FCFLAGS_NEW LDFLAGS_NEW FLAG])
# invalidate cache if result came from a run where FORTRAN was disabled
if test "$ompi_cv_fortran_external_symbol" = "skipped" ; then
unset ompi_cv_fortran_external_symbol
fi
AC_CACHE_CHECK([$FORTRAN external symbol convention],
[ompi_cv_fortran_external_symbol],
[if test "$FC" = "none" || \
test "$OMPI_TRY_FORTRAN_BINDINGS" = "$OMPI_FORTRAN_NO_BINDINGS"; then
ompi_cv_fortran_external_symbol="skipped"
else
cat >conftest.f <<EOF
subroutine FOO_bar(a)
integer a
a = 1
return
end
EOF
# Try without certain optimization flags, which produce object
# files without the required external symbols;
# e.g. option -fast turns on -ipo on Intel Compilers 11.0
FCFLAGS_NEW=""
LDFLAGS_NEW=""
case $FC in
ifort)
for FLAG in $FCFLAGS ; do
case $FLAG in
-fast) ;;
-ipo*) ;;
*) FCFLAGS_NEW="$FCFLAGS_NEW $FLAG" ;;
esac
done
for FLAG in $LDFLAGS ; do
case $FLAG in
-fast) ;;
-ipo*) ;;
*) LDFLAGS_NEW="$LDFLAGS_NEW $FLAG" ;;
esac
done
OPAL_LOG_MSG([Try with new FCFLAGS: $FCFLAGS_NEW and new LDFLAGS:$LDFLAGS_NEW])
;;
*)
FCFLAGS_NEW="$FCFLAGS"
LDFLAGS_NEW="$LDFLAGS"
;;
esac
happy=1
OPAL_LOG_COMMAND([$FC $FCFLAGS_NEW -c conftest.f $LDFLAGS_NEW $LIBS],
[if $NM conftest.o | $GREP foo_bar__ >/dev/null 2>&1 ; then
ompi_cv_fortran_external_symbol="double underscore"
elif $NM conftest.o | $GREP foo_bar_ >/dev/null 2>&1 ; then
ompi_cv_fortran_external_symbol="single underscore"
elif $NM conftest.o | $GREP FOO_bar >/dev/null 2>&1 ; then
ompi_cv_fortran_external_symbol="mixed case"
elif $NM conftest.o | $GREP foo_bar >/dev/null 2>&1 ; then
ompi_cv_fortran_external_symbol="no underscore"
elif $NM conftest.o | $GREP FOO_BAR >/dev/null 2>&1 ; then
ompi_cv_fortran_external_symbol="upper case"
else
$NM conftest.o >conftest.out 2>&1
OPAL_LOG_MSG([Could not determine Fortran naming convention. Output from $NM:])
OPAL_LOG_FILE([conftest.out])
happy=0
fi],
[AC_MSG_ERROR([Fortran compiler did not produce object file])])
fi])
# These values were all already set to 0 back up in
# ompi_setup_mpi_fortran.m4, because this whole macro is
# conditionally executed (i.e., it is not executed in the
# --disable-mpi-fortran case).
if test "$ompi_cv_fortran_external_symbol" = "double underscore" ; then
ompi_fortran_double_underscore=1
elif test "$ompi_cv_fortran_external_symbol" = "single underscore" ; then
ompi_fortran_single_underscore=1
elif test "$ompi_cv_fortran_external_symbol" = "mixed case" ; then
ompi_fortran_caps=1
elif test "$ompi_cv_fortran_external_symbol" = "no underscore" ; then
ompi_fortran_plain=1
elif test "$ompi_cv_fortran_external_symbol" = "upper case" ; then
ompi_fortran_caps=1
elif test "$ompi_cv_fortran_external_symbol" != "skipped" ; then
AC_MSG_ERROR([unknown naming convention: $ompi_cv_fortran_external_symbol])
fi
OPAL_VAR_SCOPE_POP
rm -rf conftest.*
])dnl
AC_DEFUN([OMPI_FORTRAN_MAKE_C_FUNCTION], [
if test "$ompi_cv_fortran_external_symbol" = "double underscore" ; then
# so the general rule is that if there is an _ in the function
# name, then there are two trailing underscores. Otherwise,
# there is only one trailing underscore. Any idea how to do
# that with m4_translit?
if echo $2 | $GREP _ >/dev/null 2>&1 ; then
$1[=]m4_translit([$2], [A-Z], [a-z])[__]
else
$1[=]m4_translit([$2], [A-Z], [a-z])[_]
fi
elif test "$ompi_cv_fortran_external_symbol" = "single underscore" ; then
$1[=]m4_translit([$2], [A-Z], [a-z])[_]
elif test "$ompi_cv_fortran_external_symbol" = "mixed case" ; then
$1[=]$2
elif test "$ompi_cv_fortran_external_symbol" = "no underscore" ; then
$1[=]m4_translit([$2], [A-Z], [a-z])
elif test "$ompi_cv_fortran_external_symbol" = "upper case" ; then
$1[=]m4_translit([$2], [a-z], [A-Z])
else
AC_MSG_ERROR([unknown naming convention: $ompi_cv_fortran_external_symbol])
fi
])

Просмотреть файл

@ -0,0 +1,83 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
#
# Sets and AC_SUBST's OMPI_FC_MODULE_FLAG.
#
# OMPI_FORTRAN_FIND_MODULE_INCLUDE_FLAG([action if found], [action if not found]
AC_DEFUN([OMPI_FORTRAN_FIND_MODULE_INCLUDE_FLAG],[
AS_VAR_PUSHDEF([fortran_inc_var], [ompi_cv_fortran_module_include_flag])
OMPI_FC_MODULE_FLAG=
AC_CACHE_CHECK([for Fortran compiler module include flag],
fortran_inc_var,
[ofi_possible_flags="-I -p -M"
mkdir conftest.$$
cd conftest.$$
# Try to compile a Fortran module
mkdir subdir
cd subdir
cat > conftest-module.f90 <<EOF
module OMPI_MOD_FLAG
type OMPI_MOD_FLAG_TYPE
integer :: i
end type OMPI_MOD_FLAG_TYPE
end module OMPI_MOD_FLAG
EOF
OPAL_LOG_COMMAND([$FC $FCFLAGS $FCFLAGS_f90 -c conftest-module.f90 $LDFLAGS $LIBS], ,
[cd ..
rm -rf conftest.$$
AC_MSG_RESULT([Whoops!])
AC_MSG_WARN([*** Cannot seem to compile a Fortran module])
AC_MSG_ERROR([Cannot continue])])
cd ..
#
# Now try to compile a simple program usinng that module, iterating
# through the possible flags that the compiler might use
#
cat > conftest.f90 <<EOF
program fortranusemodule
use OMPI_MOD_FLAG
end program fortranusemodule
EOF
ofi_module_flag=
for flag in $ofi_possible_flags; do
if test "$ofi_module_flag" = ""; then
OPAL_LOG_COMMAND([$FC $FCFLAGS $FCFLAGS_f90 conftest.f90 ${flag}subdir $LDFLAGS $LIBS],
[AS_VAR_SET(fortran_inc_var, [$flag])
ofi_module_flag="$flag"])
fi
done
cd ..
rm -rf conftest.$$
])
AS_VAR_COPY([OMPI_FC_MODULE_FLAG], [fortran_inc_var])
AC_SUBST(OMPI_FC_MODULE_FLAG)
AS_VAR_POPDEF([fortran_inc_var])
AS_IF([test "$OMPI_FC_MODULE_FLAG" != ""],
[$1], [$2])
])dnl

179
config/ompi_fortran_get_alignment.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,179 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# This is a long, sordid tale.
# We have been unable to devise a F90 test that will result in a
# consistent alignment answer. Specifically, our prior tests have
# been similar to the prior f77 test -- have a small chunk of f90 code
# compiled with the C code to actually compute the offsets. The f90
# code was a struct-like entity (a "type") with multiple members -- on
# a character and the other of the target type. The C code measured
# the distance between them. But even if you use the keyword to
# ensure that the F90 compiler does not re-order this struct, you may
# still get a different alignment answer than the F77 test (!). This
# is apparently because F90 allows compilers to align types
# differently according to use (in common blocks, as standalone
# variables, and as a member of a struct). Hence, the alignment can
# be different depending on how to measure (and use) it. This was
# confirmed by various members of the Fortran committee and several
# Fortran compiler vendors.
# We use to check the F77 alignment based on common block usage, but
# this is only one of the available types for F90. Hence, we may
# actually get a different answer between f77 and f90 in the same
# compiler series (and some compilers do! E.g., g95 gives different
# answers even when "g95" itself is used as both the f77 and f90
# compiler).
# So we gave up -- the only thing we can do (and has worked for years)
# is to check Fortran alignment in common blocks when compiled with .f
# files (not .f90).
# Indeed, just because data is coming from the mpif.h bindings doesn't
# mean it wasn't compiled with the f90 (or later) compiler. So
# there's no way to tell -- just hope that common block alignment is
# good enough. :-(
# OMPI_FORTRAN_GET_ALIGNMENT(type, shell variable to set)
# ----------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_GET_ALIGNMENT],[
unset happy
OPAL_VAR_SCOPE_PUSH([happy ompi_conftest_h])
# Use of m4_translit suggested by Eric Blake:
# http://lists.gnu.org/archive/html/bug-autoconf/2010-10/msg00016.html
AS_VAR_PUSHDEF([type_var],
m4_translit([[ompi_cv_fortran_alignment_$1]], [*], [p]))
AC_CACHE_CHECK([alignment of Fortran $1], type_var,
[OMPI_FORTRAN_MAKE_C_FUNCTION([ompi_ac_align_fn], [align])
# Fortran module. Make sure it's .f, not .f90.
cat > conftestf.f <<EOF
program falign
external align
$1 w,x,y,z
CHARACTER a,b,c
common /foo/a,w,b,x,y,c,z
call align(w,x,y,z)
end
EOF
# C module
if test -f conftest.h; then
ompi_conftest_h="#include \"conftest.h\""
else
ompi_conftest_h=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
$ompi_conftest_h
#ifdef __cplusplus
extern "C" {
#endif
void $ompi_ac_align_fn(char *w, char *x, char *y, char *z)
{ unsigned long aw, ax, ay, az;
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
aw = (unsigned long) w;
ax = (unsigned long) x;
ay = (unsigned long) y;
az = (unsigned long) z;
if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) fprintf(f, "%d\n", 16);
else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) fprintf(f, "%d\n", 12);
else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) fprintf(f, "%d\n", 8);
else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) fprintf(f, "%d\n", 4);
else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) fprintf(f, "%d\n", 2);
else fprintf(f, "%d\n", 1);
fclose(f);
}
#ifdef __cplusplus
}
#endif
EOF
OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
[OPAL_LOG_COMMAND([$FC $FCFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
[happy="yes"], [happy="no"])], [happy="no"])
if test "$happy" = "no" ; then
AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Could not determine alignment of $1])
fi
AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Can not determine alignment of $1 when cross-compiling])],
[OPAL_LOG_COMMAND([./conftest],
[AS_VAR_SET(type_var, [`cat conftestval`])],
[AC_MSG_RESULT([Error!])
AC_MSG_ERROR([Could not determine alignment of $1])])])
rm -rf conftest*])
AS_VAR_COPY([$2], [type_var])
AS_VAR_POPDEF([type_var])dnl
OPAL_VAR_SCOPE_POP
])
# OMPI_FORTRAN_F08_GET_HANDLE_ALIGNMENT(type, variable to set)
# ------------------------------------------
AC_DEFUN([OMPI_FORTRAN_F08_GET_HANDLE_ALIGNMENT],[
# Use of m4_translit suggested by Eric Blake:
# http://lists.gnu.org/archive/html/bug-autoconf/2010-10/msg00016.html
AS_VAR_PUSHDEF([type_var],
m4_translit([[ompi_cv_fortran_alignment_$1]], [*], [p]))
AC_CACHE_CHECK([alignment of Fortran $1], type_var,
[AC_LANG_PUSH([Fortran])
AC_LINK_IFELSE([AC_LANG_SOURCE([[module alignment_mod
type, BIND(C) :: test_mpi_handle
integer :: MPI_VAL
end type test_mpi_handle
type(test_mpi_handle) :: t1
type(test_mpi_handle) :: t2
end module
program falignment
use alignment_mod
OPEN(UNIT=10, FILE="conftestval")
if (LOC(t1) > LOC(t2)) then
write (10,'(I5)') LOC(t1)-LOC(t2)
else
write (10,'(I5)') LOC(t2)-LOC(t1)
endif
CLOSE(10)
end program]])],
[AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_ERROR([Can not determine alignment of $1 when cross-compiling])],
[OPAL_LOG_COMMAND([./conftest],
[AS_VAR_SET(type_var, [`cat conftestval`])],
[AC_MSG_ERROR([Could not determine alignment of $1])])])],
[AC_MSG_WARN([Could not determine alignment of $1])
AC_MSG_WARN([See config.log for details])
AC_MSG_ERROR([Cannot continue])])
rm -rf conftest* *.mod 2> /dev/null
AC_LANG_POP([Fortran])])
AS_VAR_COPY([$2], [type_var])
AS_VAR_POPDEF([type_var])dnl
])dnl

86
config/ompi_fortran_get_handle_max.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,86 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_GET_HANDLE_MAX()
# ---------------------------------------------------------------
# Find the maximum value of fortran integers, then calculate
# min(INT_MAX, max fortran INTEGER). This represents the maximum
# number of fortran MPI handle index.
AC_DEFUN([OMPI_FORTRAN_GET_HANDLE_MAX],[
AS_VAR_PUSHDEF([fortran_handle_max_var],
[ompi_cv_fortran_handle_max])
AC_CACHE_CHECK([for max Fortran MPI handle index],
fortran_handle_max_var,
[ # Find max fortran INTEGER value. Set to sentinel value if we don't
# have a Fortran compiler (e.g., if --disable-fortran was given).
if test $ompi_fortran_happy -eq 0; then
ompi_fint_max=0
else
OPAL_COMPUTE_MAX_VALUE([$OMPI_SIZEOF_FORTRAN_INTEGER], [ompi_fint_max])
fi
# Get INT_MAX. Compute a SWAG if we are cross compiling or something
# goes wrong.
rm -f conftest.out >/dev/null 2>&1
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <limits.h>
]],[[FILE *fp = fopen("conftest.out", "w");
long cint = INT_MAX;
fprintf(fp, "%ld", cint);
fclose(fp);]])],
[ompi_cint_max=`cat conftest.out`],
[ompi_cint_max=0],
[ #cross compiling is fun. compute INT_MAX same as INTEGER max
OPAL_COMPUTE_MAX_VALUE([$ac_cv_sizeof_int], [ompi_cint_max])])
# Use string comparisons with "test"; see comment above for
# rationale.
if test "$ompi_cint_max" = "0" ; then
# wow - something went really wrong. Be conservative
value=32767
elif test "$ompi_fint_max" = "0" ; then
# we aren't compiling Fortran - just set it to C INT_MAX
value=$ompi_cint_max
else
# Take the lesser of C INT_MAX and Fortran INTEGER max.
# The resulting value will then be storable in either
# type. Use expr (instead of "test -lt"), because it can
# handle 8-byte integer values.
value=$ompi_fint_max
if test "`expr $ompi_cint_max \< $value`" = "1"; then
value=$ompi_cint_max
fi
fi
AS_VAR_SET(fortran_handle_max_var, [$value])
rm -f conftest.out > /dev/null 2>&1
unset value])
AS_VAR_COPY([ompi_fortran_handle_max], [fortran_handle_max_var])
# sanity check; OMPI gets very unhappy if this value is negative...
if test 0 -ne `expr $ompi_fortran_handle_max \< 0` ; then
AC_MSG_ERROR([Detected negative max handle size.])
fi
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HANDLE_MAX],
[$ompi_fortran_handle_max],
[Max handle value for fortran MPI handles, effectively min(INT_MAX, max fortran INTEGER value)])
AS_VAR_POPDEF([fortran_handle_max_var])
])dnl

101
config/ompi_fortran_get_kind_value.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,101 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_GET_KIND_VALUE(kind, decimal range, variable to set)
# -----------------------------------------------------------------
AC_DEFUN([OMPI_FORTRAN_GET_KIND_VALUE],[
# Use of m4_translit suggested by Eric Blake:
# http://lists.gnu.org/archive/html/bug-autoconf/2010-10/msg00016.html
AS_VAR_PUSHDEF([kind_value_var],
m4_translit([[ompi_cv_fortran_kind_value_$1]], [*], [p]))
rm -f conftest.out
AC_CACHE_CHECK([KIND value of Fortran $1], kind_value_var,
[if test $OMPI_TRY_FORTRAN_BINDINGS -eq $OMPI_FORTRAN_NO_BINDINGS || \
test $ompi_fortran_happy -eq 0; then
value=skipped
else
AC_LANG_PUSH([Fortran])
value=
AC_RUN_IFELSE(AC_LANG_PROGRAM(, [[
use, intrinsic :: ISO_C_BINDING
open(unit = 7, file = "conftest.out")
write(7, *) $1
close(7)
]]), [value=`cat conftest.out | awk '{print [$]1}'`], [value=no], [value=cross])
rm -f conftest.out
fi
# If the compiler is ancient enough to not support the
# ISO_C_BINDING stuff, then we have to fall back to older
# tests. Yuck.
AS_IF([test "$value" = "no"],
[AC_MSG_RESULT([no ISO_C_BINDING -- fallback])
_OMPI_FORTRAN_SELECTED_INT_KIND($2, value)])
AS_IF([test "$value" = "no"],
[AC_MSG_WARN([Could not determine KIND value of $1])
AC_MSG_WARN([See config.log for more details])
AC_MSG_ERROR([Cannot continue])])
AS_IF([test "$value" = "cross"],
[AC_MSG_ERROR([Can not determine KIND value of $1 when cross-compiling])])
AS_VAR_SET(kind_value_var, [$value])
AC_LANG_POP([Fortran])
unset value
])
AS_VAR_COPY([$3], [kind_value_var])
AS_VAR_POPDEF([kind_value_var])
])dnl
# _OMPI_FORTRAN_SELECTED_INT_KIND(decimal range, variable to set)
# -----------------------------------------------------------------
AC_DEFUN([_OMPI_FORTRAN_SELECTED_INT_KIND],[
AS_VAR_PUSHDEF([sel_int_kind_var], [ompi_cv_fortran_int_kind_$1])
AC_CACHE_CHECK([Fortran value of selected_int_kind($1)], sel_int_kind_var,
[outval=no
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS && \
test $ompi_fortran_happy -eq 1],
[rm -f conftest.out
AC_LANG_PUSH([Fortran])
AC_RUN_IFELSE(AC_LANG_PROGRAM(, [[
open(8, file="conftest.out")
write(8, fmt="(I5)") selected_int_kind($1)
close(8)
]]), [outval=`cat conftest.out | awk '{print [$]1}'`], [outval=no], [outval=cross])
rm -f conftest.out
AC_LANG_POP([Fortran])
])
AS_VAR_SET(sel_int_kind_var, [$outval])
unset outval
])
# All analysis of $value is done in the upper-level / calling
# macro
AS_VAR_COPY([$2], [sel_int_kind_var])
AS_VAR_POPDEF([sel_int_kind_var])dnl
])

90
config/ompi_fortran_get_sizeof.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,90 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_GET_SIZEOF(prologue, type, variable to set)
# ------------------------------------------
AC_DEFUN([OMPI_FORTRAN_GET_SIZEOF],[
# Use of m4_translit suggested by Eric Blake:
# http://lists.gnu.org/archive/html/bug-autoconf/2010-10/msg00016.html
AS_VAR_PUSHDEF([type_var],
m4_translit([[ompi_cv_fortran_sizeof_$2]], [*], [p]))
AC_CACHE_CHECK([size of Fortran $2], type_var,
[OMPI_FORTRAN_MAKE_C_FUNCTION([ompi_ac_size_fn], [size])
# Fortran module
cat > conftestf.f90 <<EOF
program fsize
$1
external size
$2 :: x(2)
call size(x(1),x(2))
end program
EOF
# C module
if test -f conftest.h; then
ompi_conftest_h="#include \"conftest.h\""
else
ompi_conftest_h=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
$ompi_conftest_h
#ifdef __cplusplus
extern "C" {
#endif
void $ompi_ac_size_fn(char *a, char *b)
{
int diff = (int) (b - a);
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", diff);
}
#ifdef __cplusplus
}
#endif
EOF
OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
[OPAL_LOG_COMMAND([$FC $FCFLAGS $FCFLAGS_f90 conftestf.f90 conftest.o -o conftest $LDFLAGS $LIBS],
[happy="yes"], [happy="no"])], [happy="no"])
if test "$happy" = "no" ; then
OPAL_LOG_MSG([here is the Fortran program:], 1)
OPAL_LOG_FILE([conftestf.f90])
AC_MSG_WARN([Could not determine size of $2])
AC_MSG_WARN([See config.log for details])
AC_MSG_ERROR([Cannot continue])
fi
AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_ERROR([Can not determine size of $2 when cross-compiling])],
[OPAL_LOG_COMMAND([./conftest],
[AS_VAR_SET(type_var, [`cat conftestval`])],
[AC_MSG_ERROR([Could not determine size of $2])])])
unset happy ompi_conftest_h
rm -rf conftest*])
AS_VAR_COPY([$3], [type_var])
AS_VAR_POPDEF([type_var])dnl
])dnl

134
config/ompi_fortran_get_value_true.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,134 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University.
dnl All rights reserved.
dnl Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
dnl All rights reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# OMPI_FORTRAN_GET_VALUE_TRUE()
# -------------------------------------------------------
# Determine the value of .TRUE. of this Fortran compiler.
AC_DEFUN([OMPI_FORTRAN_GET_VALUE_TRUE],[
# invalidate cache if result came from a run where FORTRAN was disabled
if test "$ompi_cv_fortran_true_value" = "0" ; then
unset ompi_cv_fortran_true_value
fi
AS_VAR_PUSHDEF([fortran_true_var],
[ompi_cv_fortran_true_value])
AC_CACHE_CHECK([Fortran value for .TRUE. logical type],
fortran_true_var,
[if test "$1" = "none" || \
test $OMPI_TRY_FORTRAN_BINDINGS -eq $OMPI_FORTRAN_NO_BINDINGS || \
test $ompi_fortran_happy -eq 0 ; then
value=77
else
#
# C module
# We really need the confdefs.h Header file for
# the ompi_fortran_logical_t definition
#
if test \! -f confdefs.h ; then
AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** Cannot find confdefs.h file for config test])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])
fi
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include "confdefs.h"
#ifdef __cplusplus
extern "C" {
#endif
void ompi_print_f(ompi_fortran_logical_t * logical)
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
if( SIZEOF_INT >= sizeof(ompi_fortran_logical_t) ) {
fprintf(f, "%d\n", (int)*logical);
} else if (SIZEOF_LONG >= sizeof(ompi_fortran_logical_t) ) {
fprintf(f, "%ld\n", (long) *logical);
#ifdef HAVE_LONG_LONG
} else if (SIZEOF_LONG_LONG >= sizeof(ompi_fortran_logical_t) ) {
fprintf(f, "%lld\n", (long long) *logical);
#endif
} else {
exit(1);
}
}
void ompi_print(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void ompi_print_(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void ompi_print__(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
void OMPI_PRINT(ompi_fortran_logical_t *logical)
{ ompi_print_f(logical); }
#ifdef __cplusplus
}
#endif
EOF
cat > conftestf.f <<EOF
program main
logical value
value=.TRUE.
CALL ompi_print(value)
end
EOF
#
# Try the compilation and run.
#
OPAL_LOG_COMMAND([$CC $CFLAGS -I. -c conftest.c],
[OPAL_LOG_COMMAND([$FC $FCFLAGS -o conftest conftest.o conftestf.f $LDFLAGS $LIBS],
[happy=1], [happy=0])],
[happy=0])
AS_IF([test $happy -eq 0 && test $ompi_fortran_happy -eq 1],
[AC_MSG_ERROR([Could not compile Fortran .TRUE. test. Aborting.])
])
AS_IF([test "$cross_compiling" = "yes"],
[AC_MSG_ERROR([Can not determine value of .TRUE. when cross-compiling])],
[OPAL_LOG_COMMAND([./conftest],
[value=`sed 's/ *//' conftestval`],
[AC_MSG_ERROR([Could not determine value of Fotran .TRUE.. Aborting.])])])
fi
AS_VAR_SET(fortran_true_var, [$value])
unset value
])
AS_VAR_COPY([ompi_fortran_true_value], [fortran_true_var])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_VALUE_TRUE],
[$ompi_fortran_true_value],
[Fortran value for LOGICAL .TRUE. value])
AS_VAR_POPDEF([fortran_true_var])
unset happy ompi_print_logical_fn
rm -rf conftest*
])dnl

56
config/ompi_interix.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,56 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2008 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
######################################################################
#
# OMPI_INTERIX
#
# Detect if the environment is SUA/SFU (i.e. Interix) and modify
# the compiling environment accordingly.
#
# USAGE:
# OMPI_INTERIX()
#
######################################################################
AC_DEFUN([OMPI_INTERIX],[
AC_MSG_CHECKING(for Interix environment)
AC_TRY_COMPILE([],
[#if !defined(__INTERIX)
#error Normal Unix environment
#endif],
is_interix=yes,
is_interix=no)
AC_MSG_RESULT([$is_interix])
if test "$is_interix" = "yes"; then
opal_show_subtitle "Interix detection"
if ! test -d /usr/include/port; then
AC_MSG_WARN([Compiling Open MPI under Interix require an up-to-date])
AC_MSG_WARN([version of libport. Please ask your system administrator])
AC_MSG_WARN([to install it (pkg_update -L libport).])
AC_MSG_ERROR([*** Cannot continue])
fi
#
# These are the minimum requirements for Interix ...
#
AC_MSG_WARN([ -lport was added to the linking flags])
LDFLAGS="-lport $LDFLAGS"
AC_MSG_WARN([ -D_ALL_SOURCE -D_USE_LIBPORT was added to the compilation flags])
CFLAGS="-D_ALL_SOURCE -D_USE_LIBPORT -I/usr/include/port $CFLAGS"
CPPFLAGS="-D_ALL_SOURCE -D_USE_LIBPORT -I/usr/include/port $CPPFLAGS"
CXXFLAGS="-D_ALL_SOURCE -D_USE_LIBPORT -I/usr/include/port $CXXFLAGS"
fi
])

118
config/ompi_microsoft.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,118 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2007 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
######################################################################
#
# OMPI_MICROSOFT_COMPILER
#
# Keep all the Windows checks in one place.
#
# USAGE:
# OMPI_MICROSOFT_COMPILER()
#
######################################################################
AC_DEFUN([OMPI_MICROSOFT_COMPILER],[
# If we are using one of the Microsoft compilers check that we are
# able to include windows.h. Most of the types that follow are defined
# in this file. If we check for it here it will get included in the
# default list of header files.
if test "x$opal_cv_c_compiler_vendor" = "xmicrosoft" ; then
opal_show_subtitle "Microsoft specific detection"
#
# These 2 libraries are a minimum ...
SAVE_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS Ws2_32.lib Advapi32.lib"
AC_CHECK_HEADERS([windows.h winsock2.h wdm.h])
# The atomic functions are defined in a very unuasual manner.
# Some of them are intrinsic defined in windows.h others are
# exported by kernel32.dll. If we force the usage of AC_TRY_RUN
# here we will check for both in same time: compilation and run.
AC_MSG_CHECKING(for working InterlockedCompareExchange)
AC_TRY_RUN( [#include <windows.h>
int main() {
LONG dest = 1, exchange = 0, comperand = 1;
SetErrorMode(SEM_FAILCRITICALERRORS);
InterlockedCompareExchange( &dest, exchange, comperand );
return (int)dest;
}],
[AC_MSG_RESULT(yes)
ompi_windows_have_support_for_32_bits_atomic=1],
[AC_MSG_RESULT(no)
ompi_windows_have_support_for_32_bits_atomic=0])
AC_DEFINE_UNQUOTED(HAVE_INTERLOCKEDCOMPAREEXCHANGE,
$ompi_windows_have_support_for_32_bits_atomic,
[Whether we support 32 bits atomic operations on Windows])
AC_MSG_CHECKING(for working InterlockedCompareExchangeAcquire)
AC_TRY_RUN( [#include <windows.h>
int main() {
LONG dest = 1, exchange = 0, comperand = 1;
SetErrorMode(SEM_FAILCRITICALERRORS);
InterlockedCompareExchangeAcquire( &dest, exchange, comperand );
return (int)dest;
}],
[AC_MSG_RESULT(yes)
ompi_windows_have_support_for_32_bits_atomic=1],
[AC_MSG_RESULT(no)
ompi_windows_have_support_for_32_bits_atomic=0])
AC_DEFINE_UNQUOTED(HAVE_INTERLOCKEDCOMPAREEXCHANGEACQUIRE,
$ompi_windows_have_support_for_32_bits_atomic,
[Whether we support 32 bits atomic operations on Windows])
AC_MSG_CHECKING(for working InterlockedCompareExchangeRelease)
AC_TRY_RUN( [#include <windows.h>
int main() {
LONG dest = 1, exchange = 0, comperand = 1;
SetErrorMode(SEM_FAILCRITICALERRORS);
InterlockedCompareExchangeRelease( &dest, exchange, comperand );
return (int)dest;
}],
[AC_MSG_RESULT(yes)
ompi_windows_have_support_for_32_bits_atomic=1],
[AC_MSG_RESULT(no)
ompi_windows_have_support_for_32_bits_atomic=0])
AC_DEFINE_UNQUOTED(HAVE_INTERLOCKEDCOMPAREEXCHANGERELEASE,
$ompi_windows_have_support_for_32_bits_atomic,
[Whether we support 32 bits atomic operations on Windows])
AC_MSG_CHECKING(for working InterlockedCompareExchange64)
AC_TRY_RUN( [#include <windows.h>
int main() {
LONGLONG dest = 1, exchange = 0, comperand = 1;
SetErrorMode(SEM_FAILCRITICALERRORS);
InterlockedCompareExchange64( &dest, exchange, comperand );
return (int)dest;
}],
[AC_MSG_RESULT(yes)
ompi_windows_have_support_for_64_bits_atomic=1],
[AC_MSG_RESULT(no)
ompi_windows_have_support_for_64_bits_atomic=0])
AC_DEFINE_UNQUOTED(HAVE_INTERLOCKEDCOMPAREEXCHANGE64,
$ompi_windows_have_support_for_64_bits_atomic,
[Whether we support 64 bits atomic operations on Windows])
opal_show_title "Windows Type tests"
AC_DEFINE([pid_t], [intptr_t], [Windows pid_t type is a pointer])
AC_DEFINE_UNQUOTED([SIZEOF_PID_T], $ac_cv_sizeof_int,
[and here is it's size])
LDFLAGS="$SAVE_LDFLAGS"
fi
])

29
config/ompi_setup_contrib.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,29 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_DEFUN([OMPI_SETUP_CONTRIB],[
opal_show_title "Contributed software setup"
OMPI_CONTRIB
])

454
config/ompi_setup_cxx.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,454 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2006 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015-2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# This macro is necessary to get the title to be displayed first. :-)
AC_DEFUN([OMPI_SETUP_CXX_BANNER],[
opal_show_subtitle "C++ compiler and preprocessor"
])
# This macro is necessary because PROG_CXX* is REQUIREd by multiple
# places in SETUP_CXX.
AC_DEFUN([OMPI_PROG_CXX],[
OPAL_VAR_SCOPE_PUSH([ompi_cxxflags_save])
ompi_cxxflags_save="$CXXFLAGS"
AC_PROG_CXX
AC_PROG_CXXCPP
CXXFLAGS="$ompi_cxxflags_save"
OPAL_VAR_SCOPE_POP
])
# OMPI_SETUP_CXX()
# ----------------
# Do everything required to setup the C++ compiler. Safe to AC_REQUIRE
# this macro.
AC_DEFUN([OMPI_SETUP_CXX],[
AC_REQUIRE([OMPI_SETUP_CXX_BANNER])
_OMPI_SETUP_CXX_COMPILER
_OMPI_CXX_CHECK_EXCEPTIONS
AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "1"],
[OMPI_CXX_FIND_TEMPLATE_REPOSITORY
OMPI_CXX_FIND_TEMPLATE_PARAMETERS
OPAL_CHECK_IDENT([CXX], [CXXFLAGS], [cc], [C++])])
_OMPI_CXX_CHECK_BUILTIN
_OMPI_CXX_CHECK_2D_CONST_CAST
AM_CONDITIONAL(OMPI_BUILD_MPI_CXX_BINDINGS, [test "$WANT_MPI_CXX_SUPPORT" = 1])
AC_DEFINE_UNQUOTED(OMPI_BUILD_CXX_BINDINGS, $WANT_MPI_CXX_SUPPORT,
[Whether we want MPI C++ support or not])
])
# _OMPI_SETUP_CXX_COMPILER()
# --------------------------
# Setup the CXX compiler
AC_DEFUN([_OMPI_SETUP_CXX_COMPILER],[
OPAL_VAR_SCOPE_PUSH(ompi_cxx_compiler_works)
# There's a few cases here:
#
# 1. --enable-mpi-cxx was supplied: error if we don't find a C++
# compiler
# 2. --disable-mpi-cxx was supplied: check for a C++ compiler anyway
# (so we can have a functional mpic++ wrapper compiler), but
# don't error if we don't find one.
# 3. neither was specified: same was #2
#
# Then only proceed to do all the rest of the C++ checks if we
# both found a c++ compiler and want the C++ bindings (i.e., either
# case #1 or #3)
# Must REQUIRE the PROG_CXX macro and not call it directly here for
# reasons well-described in the AC2.64 (and beyond) docs.
AC_REQUIRE([OMPI_PROG_CXX])
BASECXX="`basename $CXX`"
AS_IF([test "x$CXX" = "x"], [CXX=none])
set dummy $CXX
ompi_cxx_argv0=[$]2
OPAL_WHICH([$ompi_cxx_argv0], [OMPI_CXX_ABSOLUTE])
AS_IF([test "x$OMPI_CXX_ABSOLUTE" = "x"], [OMPI_CXX_ABSOLUTE=none])
AC_DEFINE_UNQUOTED(OMPI_CXX, "$CXX", [OMPI underlying C++ compiler])
AC_SUBST(OMPI_CXX_ABSOLUTE)
# Make sure that the C++ compiler both works and is actually a C++
# compiler (if not cross-compiling). Don't just use the AC macro
# so that we can have a pretty message. Do something here that
# should force the linking of C++-specific things (e.g., STL
# strings) so that we can force a hard check of compiling,
# linking, and running a C++ application. Note that some C
# compilers, such as at least some versions of the GNU and Intel
# compilers, will detect that the file extension is ".cc" and
# therefore switch into a pseudo-C++ personality which works for
# *compiling*, but does not work for *linking*. So in this test,
# we want to cover the entire spectrum (compiling, linking,
# running). Note that it is not a fatal error if the C++ compiler
# does not work unless the user specifically requested the C++
# bindings.
AS_IF([test "$CXX" = "none"],
[ompi_cxx_compiler_works=no],
[AS_IF([test "$ompi_cv_cxx_compiler_vendor" = "microsoft" ],
[ompi_cxx_compiler_works=yes],
[OPAL_CHECK_COMPILER_WORKS([C++], [#include <string>
],
[std::string foo = "Hello, world"],
[ompi_cxx_compiler_works=yes],
[ompi_cxx_compiler_works=no])])])
AS_IF([test "$ompi_cxx_compiler_works" = "yes"],
[_OMPI_SETUP_CXX_COMPILER_BACKEND],
[AS_IF([test "$enable_mpi_cxx" = "yes"],
[AC_MSG_WARN([Could not find functional C++ compiler, but])
AC_MSG_WARN([support for the C++ MPI bindings was requested.])
AC_MSG_ERROR([Cannot continue])],
[WANT_MPI_CXX_SUPPORT=0])])
AC_MSG_CHECKING([if able to build the MPI C++ bindings])
AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "1"],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AS_IF([test "$enable_mpi_cxx" = "yes"],
[AC_MSG_WARN([MPI C++ binding support requested but not delivered])
AC_MSG_ERROR([Cannot continue])])])
AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "1"],
[OPAL_CXX_COMPILER_VENDOR([ompi_cxx_vendor])])
OPAL_VAR_SCOPE_POP
])
# _OMPI_SETUP_CXX_COMPILER_BACKEND()
# ----------------------------------
# Back end of _OMPI_SETUP_CXX_COMPILER_BACKEND()
AC_DEFUN([_OMPI_SETUP_CXX_COMPILER_BACKEND],[
# Do we want code coverage
if test "$WANT_COVERAGE" = "1" && test "$WANT_MPI_CXX_SUPPORT" = "1"; then
if test "$ompi_cxx_vendor" = "gnu" ; then
AC_MSG_WARN([$OMPI_COVERAGE_FLAGS has been added to CFLAGS (--enable-coverage)])
WANT_DEBUG=1
CXXFLAGS="${CXXFLAGS} $OMPI_COVERAGE_FLAGS"
OPAL_WRAPPER_FLAGS_ADD([CXXFLAGS], [$OMPI_COVERAGE_FLAGS])
else
AC_MSG_WARN([Code coverage functionality is currently available only with GCC suite])
AC_MSG_ERROR([Configure: cannot continue])
fi
fi
# Do we want debugging?
if test "$WANT_DEBUG" = "1" && test "$enable_debug_symbols" != "no" ; then
CXXFLAGS="$CXXFLAGS -g"
OPAL_FLAGS_UNIQ(CXXFLAGS)
AC_MSG_WARN([-g has been added to CXXFLAGS (--enable-debug)])
fi
# These flags are generally g++-specific; even the g++-impersonating
# compilers won't accept them.
OMPI_CXXFLAGS_BEFORE_PICKY="$CXXFLAGS"
if test "$WANT_PICKY_COMPILER" = 1 && test "$ompi_cxx_vendor" = "gnu"; then
add="-Wall -Wundef -Wno-long-long"
# see if -Wno-long-double works...
AC_LANG_PUSH(C++)
CXXFLAGS_orig="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $add -Wno-long-double -fstrict-prototype"
AC_CACHE_CHECK([if $CXX supports -Wno-long-double],
[ompi_cv_cxx_wno_long_double],
[AC_TRY_COMPILE([], [],
[dnl Alright, the -Wno-long-double did not produce any errors...
dnl Well well, try to extract a warning regarding unrecognized or ignored options
AC_TRY_COMPILE([], [long double test;],
[
ompi_cv_cxx_wno_long_double="yes"
if test -s conftest.err ; then
dnl Yes, it should be "ignor", in order to catch ignoring and ignore
for i in invalid ignor unrecognized ; do
$GREP -iq $i conftest.err
if test "$?" = "0" ; then
ompi_cv_cxx_wno_long_double="no",
break;
fi
done
fi
],
[ompi_cv_cxx_wno_long_double="no"])],
[ompi_cv_cxx_wno_long_double="no"])])
CXXFLAGS="$CXXFLAGS_orig"
AC_LANG_POP(C++)
if test "$ompi_cv_cxx_wno_long_double" = "yes" ; then
add="$add -Wno-long-double"
fi
CXXFLAGS="$CXXFLAGS $add"
OPAL_FLAGS_UNIQ(CXXFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CXXFLAGS (--enable-picky)])
fi
unset add
fi
# See if this version of g++ allows -finline-functions
if test "$GXX" = "yes"; then
CXXFLAGS_orig="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -finline-functions"
add=
AC_LANG_PUSH(C++)
AC_CACHE_CHECK([if $CXX supports -finline-functions],
[ompi_cv_cxx_finline_functions],
[AC_TRY_COMPILE([], [],
[ompi_cv_cxx_finline_functions="yes"],
[ompi_cv_cxx_finline_functions="no"])])
AC_LANG_POP(C++)
if test "$ompi_cv_cxx_finline_functions" = "yes" ; then
add=" -finline-functions"
fi
CXXFLAGS="$CXXFLAGS_orig$add"
OPAL_FLAGS_UNIQ(CXXFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CXXFLAGS])
fi
unset add
fi
# Make sure we can link with the C compiler
if test "$ompi_cv_cxx_compiler_vendor" != "microsoft"; then
OPAL_LANG_LINK_WITH_C([C++], [],
[cat <<EOF >&2
**********************************************************************
* It appears that your C++ compiler is unable to link against object
* files created by your C compiler. This generally indicates either
* a conflict between the options specified in CFLAGS and CXXFLAGS
* or a problem with the local compiler installation. More
* information (including exactly what command was given to the
* compilers and what error resulted when the commands were executed) is
* available in the config.log file in this directory.
**********************************************************************
EOF
AC_MSG_ERROR([C and C++ compilers are not link compatible. Can not continue.])])
fi
# If we are on HP-UX, ensure that we're using aCC
case "$host" in
*hpux*)
if test "$BASECXX" = "CC"; then
AC_MSG_WARN([*** You will probably have problems compiling the MPI 2])
AC_MSG_WARN([*** C++ bindings with the HP-UX CC compiler. You should])
AC_MSG_WARN([*** probably be using the aCC compiler. Re-run configure])
AC_MSG_WARN([*** with the environment variable "CXX=aCC".])
fi
;;
esac
# Note: gcc-imperonating compilers accept -O3
if test "$WANT_DEBUG" = "1"; then
OPTFLAGS=
else
if test "$GXX" = yes; then
OPTFLAGS="-O3"
else
OPTFLAGS="-O"
fi
fi
# config/ompi_ensure_contains_optflags.m4
OPAL_ENSURE_CONTAINS_OPTFLAGS(["$CXXFLAGS"])
AC_MSG_CHECKING([for C++ optimization flags])
AC_MSG_RESULT([$co_result])
CXXFLAGS="$co_result"
# bool type size and alignment
AC_LANG_PUSH(C++)
AC_CHECK_SIZEOF(bool)
OPAL_C_GET_ALIGNMENT(bool, OPAL_ALIGNMENT_CXX_BOOL)
AC_LANG_POP(C++)
])
# _OMPI_CXX_CHECK_EXCEPTIONS()
# ----------------------------
# Check for exceptions, skipping the test if we don't want the C++
# bindings
AC_DEFUN([_OMPI_CXX_CHECK_EXCEPTIONS],[
# Check for special things due to C++ exceptions
ENABLE_CXX_EXCEPTIONS=no
HAVE_CXX_EXCEPTIONS=0
AC_ARG_ENABLE([cxx-exceptions],
[AC_HELP_STRING([--enable-cxx-exceptions],
[enable support for C++ exceptions (default: disabled)])],
[ENABLE_CXX_EXCEPTIONS="$enableval"])
AC_MSG_CHECKING([if want C++ exception handling])
AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "0"],
[AS_IF([test "$$enable_cxx_exceptions" = "yes"],
[AC_MSG_RESULT([error])
AC_MSG_WARN([--enable-cxx-exceptions was specified, but the MPI C++ bindings were disabled])
AC_MSG_ERROR([Cannot continue])],
[AC_MSG_RESULT([skipped])])],
[_OMPI_CXX_CHECK_EXCEPTIONS_BACKEND])
AC_DEFINE_UNQUOTED(OMPI_HAVE_CXX_EXCEPTION_SUPPORT, $HAVE_CXX_EXCEPTIONS,
[Whether or not we have compiled with C++ exceptions support])
])
# _OMPI_CXX_CHECK_EXCEPTIONS_BACKEND()
# ------------------------------------
# Back end of _OMPI_CXX_CHECK_EXCEPTIONS
AC_DEFUN([_OMPI_CXX_CHECK_EXCEPTIONS_BACKEND],[
AC_MSG_RESULT([$ENABLE_CXX_EXCEPTIONS])
if test "$ENABLE_CXX_EXCEPTIONS" = "yes"; then
# config/cxx_have_exceptions.m4
OMPI_CXX_HAVE_EXCEPTIONS
# config/cxx_find_exception_flags.m4
OMPI_CXX_FIND_EXCEPTION_FLAGS
if test "$OMPI_CXX_EXCEPTIONS" = "1"; then
HAVE_CXX_EXCEPTIONS=1
# Test to see if the C compiler likes these flags
AC_MSG_CHECKING([to see if C compiler likes the exception flags])
CFLAGS="$CFLAGS $OMPI_CXX_EXCEPTIONS_CXXFLAGS"
AC_LANG_SAVE
AC_LANG_C
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int i = 0;]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_WARN([C++ exception flags are different between the C and C++ compilers; this configure script cannot currently handle this scenario. Either disable C++ exception support or send mail to the Open MPI users list.])
AC_MSG_ERROR([*** Cannot continue])])
AC_LANG_RESTORE
# We can't test the F77 and F90 compilers now because we
# haven't found/set the up yet. So just save the flags
# and test them later (in ompi_setup_f77.m4 and
# ompi_setup_f90.m4).
CXXFLAGS="$CXXFLAGS $OMPI_CXX_EXCEPTIONS_CXXFLAGS"
LDFLAGS="$LDFLAGS $OMPI_CXX_EXCEPTIONS_LDFLAGS"
OPAL_WRAPPER_FLAGS_ADD([CFLAGS], [$OMPI_CXX_EXCEPTIONS_CXXFLAGS])
OPAL_WRAPPER_FLAGS_ADD([CXXFLAGS], [$OMPI_CXX_EXCEPTIONS_CXXFLAGS])
OPAL_WRAPPER_FLAGS_ADD([FCFLAGS], [$OMPI_CXX_EXCEPTIONS_CXXFLAGS])
fi
fi
])
# _OMPI_CXX_CHECK_BUILTIN
# -----------------------
# Check for __builtin_* stuff
AC_DEFUN([_OMPI_CXX_CHECK_BUILTIN],[
OPAL_VAR_SCOPE_PUSH([have_cxx_builtin_expect have_cxx_builtin_prefetch])
have_cxx_builtin_expect=0
have_cxx_builtin_prefetch=0
AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "1"],
[_OMPI_CXX_CHECK_BUILTIN_BACKEND])
AC_DEFINE_UNQUOTED([OMPI_CXX_HAVE_BUILTIN_EXPECT],
[$have_cxx_builtin_expect],
[Whether C++ compiler supports __builtin_expect])
AC_DEFINE_UNQUOTED([OMPI_CXX_HAVE_BUILTIN_PREFETCH],
[$have_cxx_builtin_prefetch],
[Whether C++ compiler supports __builtin_prefetch])
OPAL_VAR_SCOPE_POP
])
# _OMPI_CXX_CHECK_BUILTIN_BACKEND
# -------------------------------
# Back end of _OMPI_CXX_CHECK_BUILTIN
AC_DEFUN([_OMPI_CXX_CHECK_BUILTIN_BACKEND],[
# see if the C++ compiler supports __builtin_expect
AC_LANG_PUSH(C++)
AC_CACHE_CHECK([if $CXX supports __builtin_expect],
[ompi_cv_cxx_supports___builtin_expect],
[AC_TRY_LINK([],
[void *ptr = (void*) 0;
if (__builtin_expect (ptr != (void*) 0, 1)) return 0;],
[ompi_cv_cxx_supports___builtin_expect="yes"],
[ompi_cv_cxx_supports___builtin_expect="no"])])
if test "$ompi_cv_cxx_supports___builtin_expect" = "yes" ; then
have_cxx_builtin_expect=1
else
have_cxx_builtin_expect=0
fi
AC_LANG_POP(C++)
# see if the C compiler supports __builtin_prefetch
AC_LANG_PUSH(C++)
AC_CACHE_CHECK([if $CXX supports __builtin_prefetch],
[ompi_cv_cxx_supports___builtin_prefetch],
[AC_TRY_LINK([],
[int ptr;
__builtin_prefetch(&ptr,0,0);],
[ompi_cv_cxx_supports___builtin_prefetch="yes"],
[ompi_cv_cxx_supports___builtin_prefetch="no"])])
if test "$ompi_cv_cxx_supports___builtin_prefetch" = "yes" ; then
have_cxx_builtin_prefetch=1
else
have_cxx_builtin_prefetch=0
fi
AC_LANG_POP(C++)
])
# _OMPI_CXX_CHECK_2D_CONST_CAST
# -----------------------------
# Check for compiler support of 2D const casts
AC_DEFUN([_OMPI_CXX_CHECK_2D_CONST_CAST],[
OPAL_VAR_SCOPE_PUSH([use_2d_const_cast])
use_2d_const_cast=0
AS_IF([test "$WANT_MPI_CXX_SUPPORT" = "1"],
[_OMPI_CXX_CHECK_2D_CONST_CAST_BACKEND])
AC_DEFINE_UNQUOTED([OMPI_CXX_SUPPORTS_2D_CONST_CAST],
[$use_2d_const_cast],
[Whether a const_cast on a 2-d array will work with the C++ compiler])
OPAL_VAR_SCOPE_POP
])
# _OMPI_CXX_CHECK_2D_CONST_CAST_BACKEND
# ---------------------------------
# Back end of _OMPI_CHECK_2D_CONST_CAST
AC_DEFUN([_OMPI_CXX_CHECK_2D_CONST_CAST_BACKEND],[
# see if the compiler supports const_cast of 2-dimensional arrays
AC_LANG_PUSH(C++)
AC_CACHE_CHECK([if $CXX supports const_cast<> properly],
[ompi_cv_cxx_supports_2d_const_cast],
[AC_TRY_COMPILE([int non_const_func(int ranges[][3]);
int cast_test(const int ranges[][3]) {
return non_const_func(const_cast<int(*)[3]>(ranges));
}],
[],
[ompi_cv_cxx_supports_2d_const_cast="yes"],
[ompi_cv_cxx_supports_2d_const_cast="no"])])
if test "$ompi_cv_cxx_supports_2d_const_cast" = "yes" ; then
use_2d_const_cast=1
fi
AC_LANG_POP(C++)
])

253
config/ompi_setup_fc.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,253 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015-2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
dnl OMPI_SETUP_FC
dnl
# This is REQUIREd, below.
AC_DEFUN_ONCE([_OMPI_SETUP_FC_BANNER],[
opal_show_subtitle "Fortran compiler"
])
#############################################################################
# This is REQUIREd, below.
AC_DEFUN_ONCE([_OMPI_SETUP_FC_COMPILER],[
OPAL_VAR_SCOPE_PUSH([ompi_fcflags_save])
ompi_fcflags_save="$FCFLAGS"
# Note that AC_PROG_FC will look for *any* fortran compiler, and
# we don't want it to find an F77-only compiler. The AC docs
# don't recommend using the "dialect" feature of AC_PROG_FC, so
# instead use the optional first parameter and steal the list of
# Fortran compilers (excluding the f77 compiler names) from AC's
# default list of compilers and use it here. This is the main
# reason we have an OMPI-ized version of the PROG_FC macro.
AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90 nagfor])
FCFLAGS="$ompi_fcflags_save"
OPAL_VAR_SCOPE_POP
])
#############################################################################
# General Fortran compiler setup
AC_DEFUN([OMPI_SETUP_FC],[
OPAL_VAR_SCOPE_PUSH([ompi_fc_happy LDFLAGS_save fc_version])
# Force the intro banner to be displayed first
AC_REQUIRE([_OMPI_SETUP_FC_BANNER])
# Unfortunately, we must REQUIRE this for the reasons cited in the
# Autoconf (version >= 2.64) docs.
AC_REQUIRE([_OMPI_SETUP_FC_COMPILER])
AS_IF([test -z "$FC"],
[AC_MSG_WARN([*** All Fortran MPI bindings disabled (could not find compiler)])
ompi_fc_happy=0],
[ompi_fc_happy=1])
AS_IF([test $ompi_fc_happy -eq 1 && test "$WANT_DEBUG" = "1" && test "$enable_debug_symbols" != "no"],
[FCFLAGS="$FCFLAGS -g"
OPAL_FLAGS_UNIQ(FCFLAGS)
AC_MSG_WARN([-g has been added to FCFLAGS (--enable-debug)])
])
# Make sure the compiler actually works, if not cross-compiling.
# Don't just use the AC macro so that we can have a pretty
# message.
AS_IF([test $ompi_fc_happy -eq 1],
[OPAL_CHECK_COMPILER_WORKS([Fortran], [], [], [],
[AC_MSG_ERROR([Could not run a simple Fortran program. Aborting.])])])
# OS X before 10.3 (deployment target) does not allow undefined common
# symbols in shared libraries. Because we can't figure out how to
# implement MPI_STATUSES_IGNORE and friends wihtout common symbols, on
# OS X we can't build the F90 bindings as a shared library.
OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS=
AS_IF([test $ompi_fc_happy -eq 1],
[AC_MSG_CHECKING([for extra arguments to build a shared library])
case "$host" in
*apple-darwin*)
if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
AC_MSG_RESULT([impossible -- -static])
OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS="-static"
else
case ${MACOSX_DEPLOYMENT_TARGET} in
10.[012])
AC_MSG_RESULT([impossible -- -static])
OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS="-static"
;;
10.*)
AC_MSG_RESULT([-Wl,-single_module])
OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS="-Wl,-single_module"
esac
fi
;;
*)
AC_MSG_RESULT([none needed])
OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS=""
;;
esac])
AC_SUBST(OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS)
# The Absoft compiler does not like the fact that we use lots of
# "ignore TKR" comment pragmas that it doesn't understand, and
# will warn about them. From Tony Goetz at Absoft, we can use the
# -Z790 flag to quell these warnings.
# The NAG compiler is too picky about naming conventions, so use the
# -mismatch flag to keep it happy
AC_MSG_CHECKING([for $FC warnings flags])
fc_version=`$FC --version 2>&1`
case "$fc_version" in
*Absoft*)
AC_MSG_RESULT([-Z790])
FCFLAGS="$FCFLAGS -Z790"
;;
*NAG*)
AC_MSG_RESULT([-mismatch])
FCFLAGS="$FCFLAGS -mismatch"
;;
*)
AC_MSG_RESULT([none])
;;
esac
# If we're still good, then save the extra file types. Do this last
# because it implies tests that should be invoked by the above tests
# (e.g., running the fortran compiler).
AS_IF([test $ompi_fc_happy -eq 1],
[AC_FC_SRCEXT(f)
AC_FC_SRCEXT(f90)])
# Per trac #1982, on OS X, we may need some esoteric linker flags
# in the wrapper compilers. However, per
# https://github.com/open-mpi/ompi/issues/259, we need to use
# -Wl,-flat_namespace when *building* the library (and
# -Wl,-commons,use_dylibs isn't quite sufficient).
AS_IF([test $ompi_fc_happy -eq 1],
[AC_MSG_CHECKING([to see if Fortran compilers need additional linker flags])
case "$host" in
*apple-darwin*)
# Test whether -Wl,-flat_namespace works; if it does,
# both use it to build the libraries, and also put it
# in the wrapper compiler LDFLAGS.
LDFLAGS_save=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-flat_namespace"
AC_LANG_PUSH([Fortran])
AC_LINK_IFELSE([AC_LANG_SOURCE([[program test
integer :: i
end program]])],
[LDFLAGS_save=$LDFLAGS
OMPI_FORTRAN_WRAPPER_FLAGS="-Wl,-flat_namespace"
OPAL_WRAPPER_FLAGS_ADD([FCFLAGS], [$OMPI_FORTRAN_WRAPPER_FLAGS])],
[OMPI_FORTRAN_WRAPPER_FLAGS=none])
AC_LANG_POP([Fortran])
LDFLAGS=$LDFLAGS_save
AC_MSG_RESULT([$OMPI_FORTRAN_WRAPPER_FLAGS])
;;
*)
AC_MSG_RESULT([none])
;;
esac
])
# Get our Fortran symbol mangling scheme
AS_IF([test $ompi_fc_happy -eq 1],
[OMPI_FORTRAN_FIND_EXT_SYMBOL_CONVENTION])
# Make sure we can link with C code.
AS_IF([test $ompi_fc_happy -eq 1],
[OPAL_LANG_LINK_WITH_C([Fortran], [],
[cat <<EOF
**********************************************************************
It appears that your Fortran compiler is unable to link against
object files created by your C compiler. This typically indicates
one of a few possibilities:
- A conflict between CFLAGS and FCFLAGS
- A problem with your compiler installation(s)
- Different default build options between compilers (e.g., C
building for 32 bit and Fortran building for 64 bit)
- Incompatible compilers
Such problems can usually be solved by picking compatible compilers
and/or CFLAGS and FCFLAGS. More information (including exactly what
command was given to the compilers and what error resulted when the
commands were executed) is available in the config.log file in this
directory.
**********************************************************************
EOF
AC_MSG_ERROR([C and Fortran compilers are not link compatible. Can not continue.])])])
# Test to see if the Fortran compilers likes the C++ exceptions
# flags. If it doesn't, just abort. We *could* handle this
# scenario (e.g., probe the Fortran compiler for what flags would
# be necessary), but we're kinda assuming that no one will care.
# If they do, they'll e-mail us.
AS_IF([test $ompi_fc_happy -eq 1],
[AC_MSG_CHECKING([to see if Fortran compiler likes the C++ exception flags])
AS_IF([test "$OMPI_CXX_EXCEPTIONS_CXXFLAGS" = ""],
[AC_MSG_RESULT([skipped (no C++ exceptions flags)])],
[FCFLAGS="$FCFLAGS $OMPI_CXX_EXCEPTIONS_CXXFLAGS"
AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
INTEGER I
I = 3]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_WARN([C++ exception flags are different between the C and Fortran compilers; this configure script cannot currently handle this scenario. Either disable C++ exception support or send mail to the Open MPI users list.])
AC_MSG_ERROR([*** Cannot continue])])
AC_LANG_POP
])
])
# Per #1982, on OS X, we may need some esoteric linker flags in the
# Fortran wrapper compiler.
AC_MSG_CHECKING([to see if mpifort compiler needs additional linker flags])
case "$host" in
*apple-darwin*)
# Test whether -Wl,-commons,use_dylibs works; if it does, use it.
LDFLAGS_save=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-commons,use_dylibs"
AC_LANG_PUSH([Fortran])
AC_LINK_IFELSE([AC_LANG_SOURCE([[program test
integer :: i
end program]])],
[OMPI_FORTRAN_WRAPPER_FLAGS="-Wl,-commons,use_dylibs"
OPAL_WRAPPER_FLAGS_ADD([FCFLAGS], [$OMPI_FORTRAN_WRAPPER_FLAGS])],
[OMPI_FORTRAN_WRAPPER_FLAGS=none])
AC_LANG_POP([Fortran])
LDFLAGS=$LDFLAGS_save
AC_MSG_RESULT([$OMPI_FORTRAN_WRAPPER_FLAGS])
;;
*)
AC_MSG_RESULT([none])
;;
esac
# All done
AS_IF([test $ompi_fc_happy -eq 1],
[$1], [$2])
OPAL_VAR_SCOPE_POP
])dnl

104
config/ompi_setup_java.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,104 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2006 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2012 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007-2012 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# This macro is necessary to get the title to be displayed first. :-)
AC_DEFUN([OMPI_SETUP_JAVA_BINDINGS_BANNER],[
opal_show_subtitle "Java MPI bindings"
])
# OMPI_SETUP_JAVA_BINDINGS()
# ----------------
# Do everything required to setup the Java MPI bindings. Safe to AC_REQUIRE
# this macro.
AC_DEFUN([OMPI_SETUP_JAVA_BINDINGS],[
# must have Java setup
AC_REQUIRE([OPAL_SETUP_JAVA])
AC_REQUIRE([OMPI_SETUP_JAVA_BINDINGS_BANNER])
AC_MSG_CHECKING([if want Java bindings])
AC_ARG_ENABLE(mpi-java,
AC_HELP_STRING([--enable-mpi-java],
[enable Java MPI bindings (default: disabled)]))
# check for required support
if test "$opal_java_happy" = "no" && test "$enable_mpi_java" = "yes"; then
AC_MSG_RESULT([yes])
AC_MSG_WARN([Java bindings requested but no Java support found])
AC_MSG_ERROR([cannot continue])
fi
# Only build the Java bindings if requested
if test "$opal_java_happy" = "yes" && test "$enable_mpi_java" = "yes"; then
AC_MSG_RESULT([yes])
WANT_MPI_JAVA_SUPPORT=1
AC_MSG_CHECKING([if shared libraries are enabled])
AS_IF([test "$enable_shared" != "yes"],
[AC_MSG_RESULT([no])
AC_MSG_WARN([Java bindings cannot be built without shared libraries])
AC_MSG_WARN([Please reconfigure with --enable-shared])
AC_MSG_ERROR([Cannot continue])],
[AC_MSG_RESULT([yes])])
# must have Java support
AC_MSG_CHECKING([if Java support was found])
AS_IF([test "$opal_java_happy" = "yes"],
[AC_MSG_RESULT([yes])],
[AC_MSG_WARN([Java MPI bindings requested, but Java support was not found])
AC_MSG_WARN([Please reconfigure the --with-jdk options to where Java])
AC_MSG_WARN([support can be found])
AC_MSG_ERROR([Cannot continue])])
# Mac Java requires this file (i.e., some other Java-related
# header file needs this file, so we need to check for
# it/include it in our sources when compiling on Mac).
AC_CHECK_HEADERS([TargetConditionals.h])
# dladdr and Dl_info are required to build the full path to libmpi on OS X 10.11 aka El Capitan
AC_CHECK_TYPES([Dl_info], [], [], [[#include <dlfcn.h>]])
else
AC_MSG_RESULT([no])
WANT_MPI_JAVA_SUPPORT=0
fi
AC_DEFINE_UNQUOTED([OMPI_WANT_JAVA_BINDINGS], [$WANT_MPI_JAVA_SUPPORT],
[do we want java mpi bindings])
AM_CONDITIONAL(OMPI_WANT_JAVA_BINDINGS, test "$WANT_MPI_JAVA_SUPPORT" = "1")
# Are we happy?
AS_IF([test "$WANT_MPI_JAVA_SUPPORT" = "1"],
[AC_MSG_WARN([******************************************************])
AC_MSG_WARN([*** Java MPI bindings are provided on a provisional])
AC_MSG_WARN([*** basis. They are NOT part of the current or])
AC_MSG_WARN([*** proposed MPI standard. Continued inclusion of])
AC_MSG_WARN([*** the Java MPI bindings in Open MPI is contingent])
AC_MSG_WARN([*** upon user interest and developer support.])
AC_MSG_WARN([******************************************************])
])
AC_CONFIG_FILES([
ompi/mpi/java/Makefile
ompi/mpi/java/java/Makefile
ompi/mpi/java/c/Makefile
])
])

29
config/ompi_setup_mpi_ext.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,29 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_DEFUN([OMPI_SETUP_MPI_EXT],[
opal_show_title "Extended MPI interfaces setup"
OMPI_EXT
])

823
config/ompi_setup_mpi_fortran.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,823 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2014-2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2016 IBM Corporation. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
# Default to building nothing
OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
OMPI_FORTRAN_BUILD_SIZEOF=0
OMPI_FORTRAN_USEMPI_DIR=
OMPI_FORTRAN_USEMPI_LIB=
OMPI_FORTRAN_USEMPIF08_DIR=
OMPI_FORTRAN_USEMPIF08_LIB=
OMPI_FORTRAN_MAX_ARRAY_RANK=0
OMPI_FORTRAN_HAVE_INTERFACE=0
OMPI_FORTRAN_HAVE_IGNORE_TKR=0
OMPI_FORTRAN_HAVE_OPTIONAL_ARGS=0
OMPI_FORTRAN_HAVE_BIND_C=0
OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV=0
OMPI_FORTRAN_HAVE_STORAGE_SIZE=0
OMPI_FORTRAN_HAVE_ISO_C_BINDING=0
OMPI_FORTRAN_HAVE_BIND_C_SUB=0
OMPI_FORTRAN_HAVE_BIND_C_TYPE=0
OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME=0
OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK=0
OMPI_FORTRAN_HAVE_PRIVATE=0
OMPI_FORTRAN_SUBARRAYS_SUPPORTED=.FALSE.
# These macros control symbol names for Fortran/C interoperability
#
OMPI_F08_SUFFIX="_f08"
OMPI_F_SUFFIX="_f"
OMPI_MPI_PREFIX="MPI_"
OMPI_MPI_BIND_PREFIX="mpi_"
# Open MPI now treats $F77 and $FC the same, meaning that we
# expect them to be the same back-end compiler. If they're not,
# results are undefined. We do a cursory check to see that FC and
# F77 are the same string value (if they're defined). If they're
# not, we'll issue a warning, but keep going on the assumption
# that they're the same back-end compiler (e.g., pgf77 and pgf90).
# Open MPI only uses $FC and $FCFLAGS -- $F77 and $FFLAGS are now
# ignored.
AS_IF([test "$F77" != "" || test "$FFLAGS" != ""],
[AC_MSG_WARN([Open MPI now ignores the F77 and FFLAGS environment variables; only the FC and FCFLAGS environment variables are used.])
sleep 5])
#-----------------------------------------------------------------------
# If we want any of the Fortran MPI bindings, setup the Fortran compiler
#-----------------------------------------------------------------------
ompi_fortran_happy=0
# $LN_S is used below
AC_PROG_LN_S
ompi_fortran_double_underscore=0
ompi_fortran_single_underscore=0
ompi_fortran_caps=0
ompi_fortran_plain=0
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_MPIFH_BINDINGS],
[$OMPI_FORTRAN_MPIFH_BINDINGS],
[Whether we are building support for the mpif.h bindings or not])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_USEMPI_BINDINGS],
[$OMPI_FORTRAN_USEMPI_BINDINGS],
[Whether we are building support for the "use mpi" bindings or not])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_USEMPIF08_BINDINGS],
[$OMPI_FORTRAN_USEMPIF08_BINDINGS],
[Whether we are building support for the "use mpif08" bindings or not])
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS],
[OMPI_SETUP_FC([ompi_fortran_happy=1])])
# These values will be determined by SETUP_FC. We must always
# AC_DEFINE these results, even in the --disable-mpi-fortran case,
# for ompi_info.
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
# Fortran compiler properly, it's an error.
AS_IF([test $ompi_fortran_happy -eq 0 && \
test $OMPI_MIN_REQUIRED_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS],
[AC_MSG_WARN([MPI Fortran bindings requested, but no suitable Fortran compiler found])
AC_MSG_ERROR([Cannot continue])])
# This allows us to mark bogus types, but still have them be a valid
# [sentinel] value
AC_DEFINE([ompi_fortran_bogus_type_t], [int],
[A bogus type that allows us to have sentinel type values that are still valid])
# These get filled in as we check for each type
OMPI_FORTRAN_IKINDS=
OMPI_FORTRAN_RKINDS=
OMPI_FORTRAN_CKINDS=
# We want to set the #define's for all of these, so invoke the macros
# regardless of whether we have F77 support or not.
OMPI_FORTRAN_CHECK([CHARACTER], [yes],
[char, int32_t, int, int64_t, long long, long], [-1], [yes])
OMPI_FORTRAN_CHECK([LOGICAL], [yes],
[char, int32_t, int, int64_t, long long, long], [-1], [yes])
OMPI_FORTRAN_CHECK([LOGICAL*1], [yes],
[char, int8_t, short, int32_t, int, int64_t, long long, long], [1], [yes])
OMPI_FORTRAN_CHECK([LOGICAL*2], [yes],
[short, int16_t, int32_t, int, int64_t, long long, long], [2], [yes])
OMPI_FORTRAN_CHECK([LOGICAL*4], [yes],
[int32_t, int, int64_t, long long, long], [4], [yes])
OMPI_FORTRAN_CHECK([LOGICAL*8], [yes],
[int, int64_t, long long, long], [8], [yes])
OMPI_FORTRAN_CHECK([INTEGER], [yes],
[int32_t, int, int64_t, long long, long], [-1], [yes])
OMPI_FORTRAN_CHECK([INTEGER*1], [no],
[char, int8_t, short, int, int64_t, long long, long], [1], [yes])
OMPI_FORTRAN_CHECK([INTEGER*2], [no],
[short, int16_t, int32_t, int, int64_t, long long, long], [2], [yes])
OMPI_FORTRAN_CHECK([INTEGER*4], [no],
[int32_t, int, int64_t, long long, long], [4], [yes])
OMPI_FORTRAN_CHECK([INTEGER*8], [no],
[int, int64_t, long long, long], [8], [yes])
OMPI_FORTRAN_CHECK([INTEGER*16], [no],
[int, int64_t, long long, long], [16], [yes])
OMPI_FORTRAN_CHECK([REAL], [yes],
[float, double, long double], [-1], [yes])
OMPI_FORTRAN_CHECK([REAL*2], [no],
[float, double, long double], [2], [yes])
OMPI_FORTRAN_CHECK([REAL*4], [no],
[float, double, long double], [4], [yes])
OMPI_FORTRAN_CHECK([REAL*8], [no],
[float, double, long double], [8], [yes])
OMPI_FORTRAN_CHECK([REAL*16], [no],
[float, double, long double], [16], [yes])
# In some compilers, the bit representation of REAL*16 is not the same
# as the C counterpart that we found. If this is the case, then we
# want to disable reduction support for MPI_REAL16 (per ticket #1603).
OMPI_FORTRAN_CHECK_REAL16_C_EQUIV
OMPI_FORTRAN_CHECK([DOUBLE PRECISION], [yes],
[float, double, long double], [-1], [yes])
OMPI_FORTRAN_CHECK([COMPLEX], [yes], [float _Complex, double _Complex], [-1], [no])
# The complex*N tests are a bit different (note: the complex tests are
# the same as all the rest, because complex is a composite of two
# reals, which we *have* to have. It's only the complex*N tests that
# are different). The fortran complex types are composites of the
# real*(N/2) types. So for us to support complex*N, two conditions
# must be true:
#
# a) we must support real*(N/2) (i.e., compiler supports it and we
# have a back-end C type for it)
# b) compiler supports complex*N
OMPI_FORTRAN_CHECK([COMPLEX*4], [no], [float _Complex], [4], [no])
OMPI_FORTRAN_CHECK([COMPLEX*8], [no],
[float _Complex, double _Complex, long double _Complex],
[8], [no])
OMPI_FORTRAN_CHECK([COMPLEX*16], [no],
[float _Complex, double _Complex, long double _Complex],
[16], [no])
OMPI_FORTRAN_CHECK([COMPLEX*32], [no],
[float _Complex, double _Complex, long double _Complex],
[32], [no])
# Double precision complex types are not standard, but many
# compilers support it. Code should be wrapped with #ifdef
# OMPI_HAVE_FORTRAN_DOUBLE_COMPLEX
OMPI_FORTRAN_CHECK([DOUBLE COMPLEX], [no],
[float _Complex, double _Complex, long double _Complex],
[-1], [no])
# Regardless of whether we have fortran bindings, or even a
# fortran compiler, get the max value for a fortran MPI handle
# (this macro handles the case where we don't have a fortran
# compiler).
OMPI_FORTRAN_GET_HANDLE_MAX
# Check for Fortran compilers value of TRUE and for the correct
# assumption on LOGICAL for conversion into what C considers to be
# a true value.
OMPI_FORTRAN_GET_VALUE_TRUE
OMPI_FORTRAN_CHECK_LOGICAL_ARRAY
# Find out how many array ranks this compiler supports.
OMPI_FORTRAN_CHECK_MAX_ARRAY_RANK
# How big should MPI_STATUS_SIZE be? (i.e., the size of
# MPI_STATUS, expressed in units of Fortran INTEGERs). The C
# equivalent of MPI_Status contains 4 C ints and a size_t.
OMPI_FORTRAN_STATUS_SIZE=0
AC_MSG_CHECKING([for the value of MPI_STATUS_SIZE])
bytes=`expr 4 \* $ac_cv_sizeof_int + $ac_cv_sizeof_size_t`
num_integers=`expr $bytes / $ac_cv_sizeof_int`
sanity=`expr $num_integers \* $ac_cv_sizeof_int`
AS_IF([test "$sanity" != "$bytes"],
[AC_MSG_RESULT([unknown!])
AC_MSG_WARN([WARNING: Size of C int: $ac_cv_sizeof_int])
AC_MSG_WARN([WARNING: Size of C size_t: $ac_cv_sizeof_size_t])
AC_MSG_WARN([WARNING: Size of Fortran INTEGER: $OMPI_SIZEOF_FORTRAN_INTEGER])
AC_MSG_WARN([Could not make this work out evenly...!])
AC_MSG_ERROR([Cannot continue])])
OMPI_FORTRAN_STATUS_SIZE=$num_integers
AC_MSG_RESULT([$OMPI_FORTRAN_STATUS_SIZE Fortran INTEGERs])
AC_SUBST(OMPI_FORTRAN_STATUS_SIZE)
# Setup for the compilers that don't support ignore TKR functionality
OPAL_UNIQ(OMPI_FORTRAN_IKINDS)
AC_SUBST(OMPI_FORTRAN_IKINDS)
OPAL_UNIQ(OMPI_FORTRAN_RKINDS)
AC_SUBST(OMPI_FORTRAN_RKINDS)
OPAL_UNIQ(OMPI_FORTRAN_CKINDS)
AC_SUBST(OMPI_FORTRAN_CKINDS)
# We can't use C_INTxx_T KIND values in mpif.h because many
# existing MPI Fortran applications are of the form:
#
# program main
# implicit none
# include 'mpif.h'
#
# ...and you can't have a "use..." statement before that (to get
# the Fortran/C interop C_INTxx_T KIND values). So figure out
# those KIND values here and just substitue them in via
# AC_DEFINE's. Kinda gross, but there you are. :-\
OMPI_FORTRAN_GET_KIND_VALUE([C_INT16_T], 4, [OMPI_FORTRAN_C_INT16_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT32_T], 9, [OMPI_FORTRAN_C_INT32_T_KIND])
OMPI_FORTRAN_GET_KIND_VALUE([C_INT64_T], 18, [OMPI_FORTRAN_C_INT64_T_KIND])
#--------------------------------------------------------
# Fortran mpif.h MPI bindings
#--------------------------------------------------------
AC_MSG_CHECKING([if building Fortran mpif.h bindings])
AS_IF([test $ompi_fortran_happy -eq 1],
[OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS
AC_MSG_RESULT([yes])],
[OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
AC_MSG_RESULT([no])])
# "INTERFACE" is needed for MPI_SIZEOF
AS_IF([test $ompi_fortran_happy -eq 1],
[OMPI_FORTRAN_CHECK_INTERFACE(
[OMPI_FORTRAN_HAVE_INTERFACE=1],
[OMPI_FORTRAN_HAVE_INTERFACE=0])])
AC_SUBST(OMPI_FORTRAN_HAVE_INTERFACE)
# The iso_fortran_env module is needed for MPI_SIZEOF
AS_IF([test $ompi_fortran_happy -eq 1],
[OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV(
[OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV=1],
[OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV=0])])
AC_SUBST(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV)
# Ensure that the fortran compiler supports STORAGE_SIZE for
# enough relevant types.
AS_IF([test $ompi_fortran_happy -eq 1],
[OMPI_FORTRAN_CHECK_STORAGE_SIZE(
[OMPI_FORTRAN_HAVE_STORAGE_SIZE=1],
[OMPI_FORTRAN_HAVE_STORAGE_SIZE=0])])
AC_SUBST(OMPI_FORTRAN_HAVE_STORAGE_SIZE)
# We need INTERFACE, ISO_FORTRAN_ENV, and STORAGE_SIZE() support
# to build MPI_SIZEOF support
AS_IF([test $ompi_fortran_happy -eq 1 && \
test $OMPI_FORTRAN_HAVE_INTERFACE -eq 1 && \
test $OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV -eq 1 && \
test $OMPI_FORTRAN_HAVE_STORAGE_SIZE -eq 1],
[OMPI_FORTRAN_BUILD_SIZEOF=1],
[OMPI_FORTRAN_BUILD_SIZEOF=0])
AC_SUBST(OMPI_FORTRAN_BUILD_SIZEOF)
#--------------------------------------------
# Fortran use mpi or use mpi_f08 MPI bindings
#--------------------------------------------
AS_IF([test $ompi_fortran_happy -eq 1 && \
test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS],
[ # Look for the fortran module compiler flag
OMPI_FORTRAN_FIND_MODULE_INCLUDE_FLAG([],
[AC_MSG_WARN([*** Could not determine the fortran compiler flag to indicate where modules reside])
AC_MSG_ERROR([*** Cannot continue])])
# Look for ignore TKR syntax
OMPI_FORTRAN_CHECK_IGNORE_TKR([OMPI_FORTRAN_HAVE_IGNORE_TKR=1])
])
# If we got here, we can build the mpi module if it was requested.
# Decide whether to build the ignore TKR version or the
# non-ignore-TKR/legacy version.
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
test $ompi_fortran_happy -eq 1],
[OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS
AS_IF([test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1],
[OMPI_FORTRAN_USEMPI_DIR=mpi/fortran/use-mpi-ignore-tkr
OMPI_FORTRAN_USEMPI_LIB=-l${with_libmpi_name}_usempi_ignore_tkr],
[OMPI_FORTRAN_USEMPI_DIR=mpi/fortran/use-mpi-tkr
OMPI_FORTRAN_USEMPI_LIB=-l${with_libmpi_name}_usempi])
])
OMPI_FORTRAN_HAVE_ISO_C_BINDING=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
test $ompi_fortran_happy -eq 1],
[OMPI_FORTRAN_CHECK_ISO_C_BINDING(
[OMPI_FORTRAN_HAVE_ISO_C_BINDING=1],
[OMPI_FORTRAN_HAVE_ISO_C_BINDING=0])])
AC_MSG_CHECKING([if building Fortran 'use mpi' bindings])
AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS],
[AC_MSG_RESULT([yes])],
[OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS
AC_MSG_RESULT([no])])
#---------------------------------
# Fortran use mpi_f08 MPI bindings
#---------------------------------
# If we got all the stuff from above, then also look for the new
# F08 syntax that we can use for the use_mpif08 module.
# We need to have ignore TKR functionality to build the mpi_f08
# module
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1],
[OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPIF08_BINDINGS
OMPI_FORTRAN_F08_PREDECL=$OMPI_FORTRAN_IGNORE_TKR_PREDECL
OMPI_FORTRAN_F08_TYPE=$OMPI_FORTRAN_IGNORE_TKR_TYPE
])
# The overall "_BIND_C" variable will be set to 1 if we have all
# the necessary forms of BIND(C)
OMPI_FORTRAN_HAVE_BIND_C=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # If we don't have ISO C bindings, we won't build mpi_f08 at all
AS_IF([test "$OMPI_FORTRAN_HAVE_ISO_C_BINDING" -eq 0],
[OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
OMPI_FORTRAN_HAVE_BIND_C_SUB=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # If we don't have SUBROUTINE BIND(C), we won't build mpi_f08 at all
OMPI_FORTRAN_CHECK_BIND_C_SUB(
[OMPI_FORTRAN_HAVE_BIND_C_SUB=1],
[OMPI_FORTRAN_HAVE_BIND_C_SUB=0
OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
OMPI_FORTRAN_HAVE_BIND_C_TYPE=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # If we don't have TYPE, BIND(C), we won't build mpi_f08 at all
OMPI_FORTRAN_CHECK_BIND_C_TYPE(
[OMPI_FORTRAN_HAVE_BIND_C_TYPE=1],
[OMPI_FORTRAN_HAVE_BIND_C_TYPE=0
OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
# Per discussion on the devel list starting here:
# http://www.open-mpi.org/community/lists/devel/2014/01/13799.php
# we need a new litmus test to disqualify older Fortran compilers
# (e.g., Pathscale 4.0.12) that *seem* to support all the Right
# Things, but a) do not support BIND(C, name="super_long_name") or
# b) run into an internal error when compiling our mpi_f08 module.
# Testing for b) is sketchy at best. But OMPI has some BIND(C)
# names that are >32 characters, and the same compilers that
# exhibit b) also seem to not support BIND(C) names that are >32
# characters (i.e., a)). Hence, the following BIND(C) test checks
# to ensure that BIND(C, name="foo") works, where "foo" is
# actually a name >32 characters.
OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # If we don't have TYPE, BIND(C, name="foo"), we won't build mpi_f08 at all
OMPI_FORTRAN_CHECK_BIND_C_TYPE_NAME(
[ # If we got here, we have all the required forms of
# BIND(C), so set the top-level _BIND_C variable to 1.
OMPI_FORTRAN_HAVE_BIND_C=1
OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME=1],
[OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME=0
OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
# Per https://svn.open-mpi.org/trac/ompi/ticket/4590, if the
# Fortran compiler doesn't support PROCEDURE in the way we
# want/need, disable the mpi_f08 module.
OMPI_FORTRAN_HAVE_PROCEDURE=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Does the compiler support "procedure"
OMPI_FORTRAN_CHECK_PROCEDURE(
[OMPI_FORTRAN_HAVE_PROCEDURE=1],
[OMPI_FORTRAN_HAVE_PROCEDURE=0
OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
# Per https://github.com/open-mpi/ompi/issues/857, if the Fortran
# compiler doesn't properly support "USE ... ONLY" notation,
# disable the mpi_f08 module.
OMPI_FORTRAN_HAVE_USE_ONLY=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Does the compiler support "USE ... ONLY"
OMPI_FORTRAN_CHECK_USE_ONLY(
[OMPI_FORTRAN_HAVE_USE_ONLY=1],
[OMPI_FORTRAN_HAVE_USE_ONLY=0
OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
OMPI_FORTRAN_HAVE_OPTIONAL_ARGS=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Does the compiler have optional arguments?
OMPI_FORTRAN_CHECK_OPTIONAL_ARGS(
[OMPI_FORTRAN_HAVE_OPTIONAL_ARGS=1],
[OMPI_FORTRAN_HAVE_OPTIONAL_ARGS=0
OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
OMPI_FORTRAN_HAVE_C_FUNLOC=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Does the compiler supports c_funloc per
# TS 29113 subclause 8.1 ?
OMPI_FORTRAN_CHECK_C_FUNLOC(
[OMPI_FORTRAN_HAVE_C_FUNLOC=1],
[OMPI_FORTRAN_HAVE_C_FUNLOC=0
OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
OMPI_FORTRAN_HAVE_PRIVATE=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Does the compiler support "private"
OMPI_FORTRAN_CHECK_PRIVATE(
[OMPI_FORTRAN_HAVE_PRIVATE=1],
[OMPI_FORTRAN_HAVE_PRIVATE=0])])
OMPI_FORTRAN_HAVE_PROTECTED=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Does the compiler support "protected"
OMPI_FORTRAN_CHECK_PROTECTED(
[OMPI_FORTRAN_HAVE_PROTECTED=1],
[OMPI_FORTRAN_HAVE_PROTECTED=0])])
OMPI_FORTRAN_HAVE_ABSTRACT=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Does the compiler support "abstract"
OMPI_FORTRAN_CHECK_ABSTRACT(
[OMPI_FORTRAN_HAVE_ABSTRACT=1],
[OMPI_FORTRAN_HAVE_ABSTRACT=0])])
OMPI_FORTRAN_HAVE_ASYNCHRONOUS=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Does the compiler support "asynchronous"
OMPI_FORTRAN_CHECK_ASYNCHRONOUS(
[OMPI_FORTRAN_HAVE_ASYNCHRONOUS=1],
[OMPI_FORTRAN_HAVE_ASYNCHRONOUS=0])])
OMPI_FORTRAN_F08_HANDLE_SIZE=4
OMPI_FORTRAN_F08_HANDLE_ALIGNMENT=4
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # How big are derived types with a single INTEGER?
OMPI_FORTRAN_GET_SIZEOF([type, BIND(C) :: test_mpi_handle
integer :: MPI_VAL
end type test_mpi_handle],
[type(test_mpi_handle)],
[OMPI_FORTRAN_F08_HANDLE_SIZE])
OMPI_FORTRAN_F08_GET_HANDLE_ALIGNMENT(
[type(test_mpi_handle)],
[OMPI_FORTRAN_F08_HANDLE_ALIGNMENT])
])
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=1
OMPI_FORTRAN_F08_PREDECL='!'
OMPI_FORTRAN_F08_TYPE=real
OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK=0
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[ # Look for Fortran 2008 assumed rank syntax
OMPI_FORTRAN_CHECK_F08_ASSUMED_RANK(
[ # If we have assumed rank, we can build the use
# mpi_f08 module "better"
OMPI_FORTRAN_F08_PREDECL='!'
OMPI_FORTRAN_F08_TYPE='type(*), dimension(..)'
OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK=1])
# Which mpi_f08 implementation are we using?
# a) partial, proof-of-concept that supports array
# subsections (Intel compiler only)
# b) compiler supports BIND(C) and optional arguments
# ("good" compilers)
# c) compiler that does not support the items listed
# in b) ("bad" compilers)
AC_MSG_CHECKING([which mpi_f08 implementation to build])
AS_IF([test $OMPI_BUILD_FORTRAN_F08_SUBARRAYS -eq 1],
[ # Case a) partial/prototype implementation
OMPI_FORTRAN_USEMPIF08_DIR=mpi/fortran/use-mpi-f08-desc
OMPI_FORTRAN_SUBARRAYS_SUPPORTED=.TRUE.
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=0
AC_MSG_RESULT([array subsections (partial/experimental)])
],
[ # Both cases b) and c)
OMPI_FORTRAN_USEMPIF08_DIR=mpi/fortran/use-mpi-f08
OMPI_FORTRAN_SUBARRAYS_SUPPORTED=.FALSE.
AS_IF([test $OMPI_FORTRAN_HAVE_OPTIONAL_ARGS -eq 1],
[ # Case b) "good compiler"
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=0
AC_MSG_RESULT(["good" compiler, no array subsections])
],
[ # Case c) "bad compiler"
OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=1
AC_MSG_RESULT(["bad" compiler, no array subsections])
])
])
])
# Note: the current implementation *only* has wrappers;
# there is no optimized implementation for a "good"
# compiler. I'm leaving the above logic in place for
# if we ever do the optimized/no-wrapper
# implementation, but for now, I'm just hard-wiring
# OMPI_FORTRAN_NEED_WRAPPER_ROUTINES to 1 when we're
# building the F08 wrappers.
AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=1],
[OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=0])
AC_MSG_CHECKING([if building Fortran 'use mpi_f08' bindings])
AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
[OMPI_FORTRAN_USEMPIF08_LIB=-l${with_libmpi_name}_usempif08
AC_MSG_RESULT([yes])],
[OMPI_TRY_FORTRAN_BINDIGS=$OMPI_FORTRAN_USEMPI_BINDINGS
AC_MSG_RESULT([no])])
# If Fortran bindings is requested, make sure at least one can be built
AS_IF([test $OMPI_MIN_REQUIRED_FORTRAN_BINDINGS -gt $OMPI_BUILD_FORTRAN_BINDINGS],
[AC_MSG_ERROR([Cannot build requested Fortran bindings, aborting])])
# -------------------
# mpif.h final setup
# -------------------
# A preprocessor header file just for Fortran. We cannot use AC
# CONFIG_HEADER because it adds a /* */-style comment at the top,
# and this header file must be usable in .F90 files. :-(
AC_CONFIG_FILES([ompi/mpi/fortran/configure-fortran-output.h])
# Values for wrapper compilers
OMPI_FC=$FC
set dummy $OMPI_FC
OMPI_FC_ARGV0=[$]2
AS_IF([test -n "$OMPI_FC_ARGV0"],
[BASEFC="`basename $OMPI_FC_ARGV0`"
OPAL_WHICH([$OMPI_FC_ARGV0], [OMPI_FC_ABSOLUTE])],
[OMPI_FC=none
BASEFC=none
OMPI_FC_ABSOLUTE=none])
AC_SUBST(OMPI_FC)
AC_SUBST(OMPI_FC_ABSOLUTE)
AC_DEFINE_UNQUOTED(OMPI_FC, ["$OMPI_FC"], [Underlying Fortran compiler])
AC_DEFINE_UNQUOTED(OMPI_FC_ABSOLUTE, ["$OMPI_FC_ABSOLUTE"],
[Absolutey path to the underlying Fortran compiler found by configure])
# These go into ompi/info/param.c
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_BUILD_SIZEOF],
[$OMPI_FORTRAN_BUILD_SIZEOF],
[Whether the mpif.h interface supports the MPI_SIZEOF interface or not])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_INTERFACE],
[$OMPI_FORTRAN_HAVE_INTERFACE],
[Whether the compiler supports INTERFACE or not])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV],
[$OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV],
[Whether the compiler supports ISO_FORTRAN_ENV or not])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_STORAGE_SIZE],
[$OMPI_FORTRAN_HAVE_STORAGE_SIZE],
[Whether the compiler supports STORAGE_SIZE on relevant types])
# This conditional is used to determine whether we compile the
# various .f90 files that contain MPI_SIZEOF implementations.
AM_CONDITIONAL([BUILD_FORTRAN_SIZEOF],
[test $OMPI_FORTRAN_BUILD_SIZEOF -eq 1])
# There are 2 layers to the MPI mpif.h layer. The only extra thing
# that determine mpif.h bindings is that fortran can be disabled
# by user. In such cases, we need to not build the target at all.
# One layer generates MPI_<foo> bindings. The other layer
# generates PMPI_<foo> bindings. The following conditions
# determine whether each (or both) these layers are built.
#
# Superceeding clause:
# - Fortran bindings should be enabled, else everything is
# disabled
# 1. MPI_<foo> bindings are needed if:
# - Profiling is not required
# - Profiling is required but weak symbols are not supported
# 2. PMPI_<foo> bindings are needed if profiling is required.
#
# Hence we define 2 conditionals which tell us whether each of
# these layers need to be built or NOT
AM_CONDITIONAL(BUILD_MPI_FORTRAN_MPIFH_BINDINGS_LAYER,
[test $OMPI_PROFILING_COMPILE_SEPARATELY -eq 1 && \
test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS])
AM_CONDITIONAL(BUILD_PMPI_FORTRAN_MPIFH_BINDINGS_LAYER,
[test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS])
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_MPIFH_BINDINGS,
[test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS])
# -------------------
# use mpi final setup
# -------------------
# This goes into ompi/Makefile.am
AC_SUBST(OMPI_FORTRAN_USEMPI_DIR)
# This goes into mpifort-wrapper-data.txt
AC_SUBST(OMPI_FORTRAN_USEMPI_LIB)
# These go into mpi-ignore-tkr-interfaces.h / mpi-ignore-tkr-file-interfaces.h
AC_SUBST(OMPI_FORTRAN_IGNORE_TKR_PREDECL)
AC_SUBST(OMPI_FORTRAN_IGNORE_TKR_TYPE)
# These go into ompi/info/param.c
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_IGNORE_TKR_PREDECL],
["$OMPI_FORTRAN_IGNORE_TKR_PREDECL"],
[Pre declaration for FORTRAN ignore parameter TKR behavior])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_IGNORE_TKR_TYPE],
[$type],
[Type declaration for FORTRAN ignore parameter TKR behavior])
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_IGNORE_TKR,
[$OMPI_FORTRAN_HAVE_IGNORE_TKR],
[Whether the Fortran compiler supports ignore TKR functionality or not])
# Somewhat redundant because ompi/Makefile.am won't traverse into
# the unused "use mpi" directory, but we might as well have the
# ompi/mpi/fortran/use-mpi*/Makefile.ams be safe, too.
# True if we're building either "use mpi" bindings
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_BINDINGS,
[test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS || \
test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1])
# True if we're building the old TKR-style bindings
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS,
[test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 0])
# True if we're building the new ignore-TKR-style bindings
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS,
[test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1])
# -------------------
# use mpi_f08 final setup
# -------------------
# This goes into ompi/Makefile.am
AC_SUBST(OMPI_FORTRAN_USEMPIF08_DIR)
# This goes into mpifort-wrapper-data.txt
AC_SUBST(OMPI_FORTRAN_USEMPIF08_LIB)
# These go into interfaces/mpi-f08-interfaces-[no]bind.h (and
# mpi-f*-interfaces*.h files)
AC_SUBST(OMPI_FORTRAN_F08_PREDECL)
AC_SUBST(OMPI_FORTRAN_F08_TYPE)
AC_SUBST(OMPI_MPI_PREFIX)
AC_SUBST(OMPI_MPI_BIND_PREFIX)
AC_SUBST(OMPI_F08_SUFFIX)
AC_SUBST(OMPI_F_SUFFIX)
# This goes into ompi/mpi/fortran/configure-fortran-output.h
AC_SUBST(OMPI_FORTRAN_SUBARRAYS_SUPPORTED)
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_SUBARRAYS_SUPPORTED,
[$OMPI_FORTRAN_SUBARRAYS_SUPPORTED],
[Value to load to the MPI_SUBARRAYS_SUPPORTED compile-time constant])
# This is used to generate weak symbols (or not) in
# ompi/mpi/fortran/mpif-h/<foo>_f.c, and
# ompi/mpi/fortran/configure-fortran-output.h.
AC_SUBST(OMPI_FORTRAN_NEED_WRAPPER_ROUTINES)
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_NEED_WRAPPER_ROUTINES,
[$OMPI_FORTRAN_NEED_WRAPPER_ROUTINES],
[Whether the mpi_f08 implementation is using wrapper routines ("bad" Fortran compiler) or weak symbols ("good" Fortran compiler) for the F08 interface definition implementations])
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_F08_HANDLE_SIZE,
$OMPI_FORTRAN_F08_HANDLE_SIZE,
[How many bytes the mpi_f08 TYPE(MPI_<foo>) handles will be])
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_F08_HANDLE_ALIGNMENT,
$OMPI_FORTRAN_F08_HANDLE_ALIGNMENT,
[How many bytes the mpi_f08 TYPE(MPI_<foo>) handles will be aligned to])
# These go into ompi/info/param.c
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK,
[$OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK],
[For ompi_info: Whether the Fortran compiler supports the Fortran 2008 "assumed rank" syntax or not])
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C,
[$OMPI_FORTRAN_HAVE_BIND_C],
[For ompi_info: Whether the compiler supports all forms of BIND(C) that we need])
AC_SUBST(OMPI_FORTRAN_HAVE_ISO_C_BINDING)
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_ISO_C_BINDING,
[$OMPI_FORTRAN_HAVE_ISO_C_BINDING],
[For ompi_info: Whether the compiler supports ISO_C_BINDING or not])
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_SUB,
[$OMPI_FORTRAN_HAVE_BIND_C_SUB],
[For ompi_info: Whether the compiler supports SUBROUTINE ... BIND(C) or not])
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE,
[$OMPI_FORTRAN_HAVE_BIND_C_TYPE],
[For ompi_info: Whether the compiler supports TYPE, BIND(C) or not])
AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME,
[$OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME],
[For ompi_info: Whether the compiler supports TYPE, BIND(C, NAME="name") or not])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_OPTIONAL_ARGS],
[$OMPI_FORTRAN_HAVE_OPTIONAL_ARGS],
[For ompi_info: whether the Fortran compiler supports optional arguments or not])
# For configure-fortran-output.h, mpi-f08-types.F90 (and ompi_info)
AC_SUBST([OMPI_FORTRAN_HAVE_PRIVATE])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PRIVATE],
[$OMPI_FORTRAN_HAVE_PRIVATE],
[For mpi-f08-types.f90 and ompi_info: whether the compiler supports the "private" keyword or not (used in MPI_Status)])
# For configure-fortran-output.h, mpi-f08-types.F90 (and ompi_info)
AC_SUBST([OMPI_FORTRAN_HAVE_PROTECTED])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PROTECTED],
[$OMPI_FORTRAN_HAVE_PROTECTED],
[For mpi-f08-types.f90 and .F90 and ompi_info: whether the compiler supports the "protected" keyword or not])
# For configure-fortran-output.h, mpi-f08-interfaces-callbacks.F90
# (and ompi_info)
AC_SUBST([OMPI_FORTRAN_HAVE_ABSTRACT])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_ABSTRACT],
[$OMPI_FORTRAN_HAVE_ABSTRACT],
[For mpi-f08-interfaces-callbacks.f90 and ompi_info: whether the compiler supports the "abstract" keyword or not])
# For configure-fortran-output.h, various files in
# ompi/mpi/fortran/use-mpi-f08/*.F90 and *.h files (and ompi_info)
AC_SUBST([OMPI_FORTRAN_HAVE_ASYNCHRONOUS])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_ASYNCHRONOUS],
[$OMPI_FORTRAN_HAVE_ASYNCHRONOUS],
[For ompi/mpi/fortran/use-mpi-f08/blah.F90 and blah.h and ompi_info: whether the compiler supports the "asynchronous" keyword or not])
# For configure-fortran-output.h, various files in
# ompi/mpi/fortran/use-mpi-f08/*.F90 and *.h files (and ompi_info)
AC_SUBST([OMPI_FORTRAN_HAVE_PROCEDURE])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PROCEDURE],
[$OMPI_FORTRAN_HAVE_PROCEDURE],
[For ompi/mpi/fortran/use-mpi-f08/blah.F90 and blah.h and ompi_info: whether the compiler supports the "procedure" keyword or not])
# For configure-fortran-output.h, various files in
# ompi/mpi/fortran/use-mpi-f08/*.F90 and *.h files (and ompi_info)
AC_SUBST([OMPI_FORTRAN_HAVE_USE_ONLY])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_USE_ONLY],
[$OMPI_FORTRAN_HAVE_USE_ONLY],
[For ompi/mpi/fortran/use-mpi-f08/blah.F90 and blah.h and ompi_info: whether the compiler supports "USE ... ONLY" notation properly or not])
# For configure-fortran-output.h, various files in
# ompi/mpi/fortran/use-mpi-f08/*.F90 and *.h files (and ompi_info)
AC_SUBST([OMPI_FORTRAN_HAVE_C_FUNLOC])
AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_C_FUNLOC],
[$OMPI_FORTRAN_HAVE_C_FUNLOC],
[For ompi/mpi/fortran/use-mpi-f08/blah.F90 and blah.h and ompi_info: whether the compiler supports c_funloc or not])
# For configure-fortran-output.h
AC_SUBST(OMPI_FORTRAN_HAVE_BIND_C)
# Somewhat redundant because ompi/Makefile.am won't traverse into
# ompi/mpi/fortran/use-mpi-f08 if it's not to be built, but we
# might as well have ompi/mpi/fortran/use-mpi-f08/Makefile.am be
# safe, too.
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS,
[test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS])
AC_DEFINE_UNQUOTED(OMPI_BUILD_FORTRAN_BINDINGS,
$OMPI_BUILD_FORTRAN_BINDINGS,
[The level of fortran bindings to be built])
])

50
config/ompi_setup_mpi_profiling.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,50 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
# 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-2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# OMPI-specific configuration
AC_DEFUN([OMPI_SETUP_MPI_PROFILING],[
# There are 2 layers to the MPI Language binidings One layer
# generates MPI_* bindings. The other layer generates PMPI_*
# bindings. The following conditions determine whether each (or
# both) these layers are built.
# 1. MPI_* bindings are needed if:
# - Profiling is not required
# - Profiling is required but weak symbols are not
# supported
# 2. PMPI_* bindings are needed if profiling is required. Hence we
# define 2 conditionals which tell us whether each of these layers
# need to be built or NOT
#
AM_CONDITIONAL(BUILD_MPI_BINDINGS_LAYER,
test "$OMPI_PROFILING_COMPILE_SEPARATELY" = 1)
AM_CONDITIONAL(COMPILE_PROFILING_SEPARATELY,
test "$OMPI_PROFILING_COMPILE_SEPARATELY" = 1)
AC_DEFINE_UNQUOTED(OPAL_HAVE_WEAK_SYMBOLS, $OPAL_C_HAVE_WEAK_SYMBOLS,
[Whether we have weak symbols or not])
])

Просмотреть файл

@ -1,7 +1,6 @@
# -*- shell-script -*- # -*- shell-script -*-
# #
# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2016 Intel, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -25,5 +24,7 @@ AC_DEFUN([OPAL_CONFIG_FILES],[
opal/tools/wrappers/opalcc-wrapper-data.txt opal/tools/wrappers/opalcc-wrapper-data.txt
opal/tools/wrappers/opalc++-wrapper-data.txt opal/tools/wrappers/opalc++-wrapper-data.txt
opal/tools/wrappers/opal.pc opal/tools/wrappers/opal.pc
opal/tools/opal-checkpoint/Makefile
opal/tools/opal-restart/Makefile
]) ])
]) ])

Просмотреть файл

@ -25,6 +25,12 @@ AC_DEFUN([ORTE_CONFIG_FILES],[
orte/tools/wrappers/Makefile orte/tools/wrappers/Makefile
orte/tools/wrappers/ortecc-wrapper-data.txt orte/tools/wrappers/ortecc-wrapper-data.txt
orte/tools/wrappers/orte.pc orte/tools/wrappers/orte.pc
orte/tools/orte-checkpoint/Makefile
orte/tools/orte-restart/Makefile
orte/tools/orte-ps/Makefile
orte/tools/orte-clean/Makefile
orte/tools/orte-top/Makefile
orte/tools/orte-migrate/Makefile
orte/tools/orte-info/Makefile orte/tools/orte-info/Makefile
orte/tools/orte-server/Makefile orte/tools/orte-server/Makefile
orte/tools/orte-dvm/Makefile orte/tools/orte-dvm/Makefile

28
config/oshmem_config_files.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,28 @@
# -*- shell-script -*-
#
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
# Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_DEFUN([OSHMEM_CONFIG_FILES],[
AC_CONFIG_FILES([
oshmem/Makefile
oshmem/include/Makefile
oshmem/shmem/c/Makefile
oshmem/shmem/c/profile/Makefile
oshmem/shmem/fortran/Makefile
oshmem/shmem/fortran/profile/Makefile
oshmem/tools/oshmem_info/Makefile
oshmem/tools/wrappers/Makefile
oshmem/tools/wrappers/shmemcc-wrapper-data.txt
oshmem/tools/wrappers/shmemfort-wrapper-data.txt
])
])

159
config/oshmem_configure_options.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,159 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2013 Mellanox Technologies, Inc.
dnl All rights reserved.
dnl Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2014 Intel, Inc. All rights reserved
dnl Copyright (c) 2014-2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OSHMEM_CONFIGURE_OPTIONS],[
opal_show_subtitle "OSHMEM Configuration options"
AC_SUBST(OSHMEM_LIBSHMEM_EXTRA_LIBS)
AC_SUBST(OSHMEM_LIBSHMEM_EXTRA_LDFLAGS)
#
# Disable Open SHMEM?
#
AC_MSG_CHECKING([if want oshmem])
AC_ARG_ENABLE([oshmem],
[AC_HELP_STRING([--enable-oshmem],
[Enable building the OpenSHMEM interface (available on Linux only, where it is enabled by default)])],
[oshmem_arg_given=yes],
[oshmem_arg_given=no])
if test "$oshmem_arg_given" = "yes"; then
if test "$enable_oshmem" = "yes"; then
AC_MSG_RESULT([yes])
if test "$opal_found_linux" != "yes"; then
AC_MSG_WARN([OpenSHMEM support was requested, but currently])
AC_MSG_WARN([only supports Linux.])
AC_MSG_ERROR([Cannot continue])
fi
else
AC_MSG_RESULT([no])
fi
else
if test "$opal_found_linux" = "yes"; then
enable_oshmem=yes
AC_MSG_RESULT([yes])
else
enable_oshmem=no
AC_MSG_RESULT([not supported on this platform])
fi
fi
#
# Enable compatibility mode
#
AC_MSG_CHECKING([if want SGI/Quadrics compatibility mode])
AC_ARG_ENABLE(oshmem-compat,
AC_HELP_STRING([--enable-oshmem-compat],
[enable compatibility mode (default: enabled)]))
if test "$enable_oshmem" != "no" && test "$enable_oshmem_compat" != "no"; then
AC_MSG_RESULT([yes])
OSHMEM_SPEC_COMPAT=1
else
AC_MSG_RESULT([no])
OSHMEM_SPEC_COMPAT=0
fi
AC_DEFINE_UNQUOTED([OSHMEM_SPEC_COMPAT], [$OSHMEM_SPEC_COMPAT],
[Whether user wants OSHMEM in compatibility mode or not])
#
# Do we want to disable OSHMEM parameter checking at run-time?
#
AC_MSG_CHECKING([if want OSHMEM API parameter checking])
AC_ARG_WITH(oshmem-param-check,
AC_HELP_STRING([--with-oshmem-param-check(=VALUE)],
[behavior of OSHMEM API function parameter checking. Valid values are: always, never. If --with-oshmem-param-check is specified with no VALUE argument, it is equivalent to a VALUE of "always"; --without-oshmem-param-check is equivalent to "never" (default: always).]))
if test "$enable_oshmem" != "no"; then
if test "$with_oshmem_param_check" = "no" || \
test "$with_oshmem_param_check" = "never"; then
shmem_param_check=0
AC_MSG_RESULT([never])
elif test "$with_oshmem_param_check" = "yes" || \
test "$with_oshmem_param_check" = "always" || \
test -z "$with_oshmem_param_check"; then
shmem_param_check=1
AC_MSG_RESULT([always])
else
shmem_param_check=1
AC_MSG_RESULT([unknown])
AC_MSG_WARN([*** Unrecognized --with-oshmem-param-check value])
AC_MSG_WARN([*** See "configure --help" output])
AC_MSG_WARN([*** Defaulting to "always"])
fi
else
shmem_param_check=0
AC_MSG_RESULT([no])
fi
AC_DEFINE_UNQUOTED(OSHMEM_PARAM_CHECK, $shmem_param_check,
[Whether we want to check OSHMEM parameters always or never])
#
# check for on_exit
#
AC_CHECK_FUNCS([on_exit])
#
# OSHMEM profiling support
#
AC_ARG_ENABLE(oshmem-profile,
AC_HELP_STRING([--enable-oshmem-profile],
[enable OSHMEM profiling (default: enabled)]))
AC_MSG_CHECKING([if want pshmem])
AS_IF([test "$enable_oshmem_profile" != "no"],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
# Bozo check
AS_IF([test "$enable_oshmem" = "no" && \
test "$enable_oshmem_profile" = "yes"],
[AC_MSG_WARN([OpenSHMEM profiling was requested, but OpenSHMEM has been explicitly disabled])
AC_MSG_ERROR([Cannot continue])])
# Cannot check if we can enable profiling because it is not yet
# known whether the compiler supports weak symbols.
#
# Fortran bindings
#
AC_MSG_CHECKING([if want to build OSHMEM fortran bindings])
AC_ARG_ENABLE(oshmem-fortran,
AC_HELP_STRING([--enable-oshmem-fortran],
[enable OSHMEM Fortran bindings (default: enabled if Fortran compiler found)]))
if test "$enable_oshmem" != "no" && test "$enable_oshmem_fortran" != "no"; then
# If no OMPI FORTRAN, bail
AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -eq $OMPI_FORTRAN_NO_BINDINGS && \
test "$enable_oshmem_fortran" = "yes"],
[AC_MSG_RESULT([bad value OMPI_TRY_FORTRAN_BINDINGS: ($OMPI_TRY_FORTRAN_BINDINGS)])
AC_MSG_WARN([Your request to --enable-oshmem-fortran can only be satisfied if fortran support is enabled in OMPI.
You see this message because OMPI fortran support has been explicitly disabled via --disable-mpi-fortran and OSHMEM fortran support was explicitly enabled with --enable-oshmem-fortran.
Configure will abort because you, a human, have asked for something that cannot be provided.])
AC_MSG_ERROR([Cannot continue])])
if test $OMPI_TRY_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
else
enable_oshmem_fortran=no
AC_MSG_RESULT([no])
fi
#
# We can't set am_conditional here since it's yet unknown if there is
# valid Fortran compiler avaliable
#
]) dnl

47
config/oshmem_setup_profiling.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
# -*- shell-script -*-
#
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2014 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_DEFUN([OSHMEM_SETUP_PROFILING],[
opal_show_subtitle "OpenSHMEM profiling"
AC_MSG_CHECKING([if pshmem will be enabled])
AS_IF([test "$enable_oshmem" != "no" && \
test "$enable_oshmem_profile" != "no"],
[AS_IF([test "$OPAL_C_HAVE_WEAK_SYMBOLS" -eq 1 && \
test "$OPAL_C_HAVE_MACRO_WEAK_SYMBOLS" -eq 1],
[ # We want OSHMEM and we have all the required weak
# symbol support
oshmem_profiling_support=1
AC_MSG_RESULT([yes (weak symbols supported)])],
[ # We want OSHMEM, but we do NOT have all the
# required weak symbol support
oshmem_profiling_support=0
AC_MSG_RESULT([no (weak symbols not supported)])
AS_IF([test "$OPAL_C_HAVE_WEAK_SYMBOLS" -eq 0],
[AC_MSG_WARN([Weak symbols not supported by compiler])])
AS_IF([test "$OPAL_C_HAVE_MACRO_WEAK_SYMBOLS" -eq 0],
[AC_MSG_WARN([Macro weak symbols not supported by compiler])])
AC_MSG_WARN([OpenSHMEM profiling is disabled.])
AS_IF([test "$enable_oshmem_profile" = "yes" && \
test "$oshmem_profiling_support" -eq 0],
[AC_MSG_WARN([OpenSHMEM profiling requested but cannot be enabled])
AC_MSG_ERROR([Cannot continue])])
])
],[
# We do not want OSHMEM, so disable profiling
oshmem_profiling_support=0
AC_MSG_RESULT([no (OpenSHMEM disabled)])
])
AM_CONDITIONAL([OSHMEM_PROFILING], [test $oshmem_profiling_support -eq 1])
]) dnl

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -14,7 +14,7 @@
# Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved. # Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2013-2016 Los Alamos National Security, Inc. All rights # Copyright (c) 2013-2016 Los Alamos National Security, Inc. All rights
# reserved. # reserved.
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved. # Copyright (c) 2013 Intel Corporation. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -25,6 +25,12 @@
amca_paramdir = $(AMCA_PARAM_SETS_DIR) amca_paramdir = $(AMCA_PARAM_SETS_DIR)
dist_amca_param_DATA = amca-param-sets/example.conf dist_amca_param_DATA = amca-param-sets/example.conf
if WANT_FT_CR
dist_amca_param_DATA += \
amca-param-sets/ft-enable-cr \
amca-param-sets/ft-enable-cr-recovery
endif # WANT_FT_CR
EXTRA_DIST = \ EXTRA_DIST = \
completion/mpirun.sh \ completion/mpirun.sh \
completion/mpirun.zsh \ completion/mpirun.zsh \

212
ompi/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,212 @@
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2009 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2010-2011 Sandia National Laboratories. All rights reserved.
# Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2015 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# We always have C bindings, but do we have profiling?
if BUILD_MPI_BINDINGS_LAYER
c_mpi_lib = mpi/c/libmpi_c_mpi.la mpi/tool/libmpi_mpit.la
else
c_mpi_lib =
endif
c_pmpi_lib = mpi/c/profile/libmpi_c_pmpi.la mpi/tool/profile/libmpi_pmpit.la
# See if we have Fortran mpif.h MPI bindings
if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS
mpi_fortran_base_lib = mpi/fortran/base/libmpi_fortran_base.la
else
mpi_fortran_base_lib =
endif
# Note that the ordering of "." in SUBDIRS is important: the C++,
# Fortran mpif.h, and use mpi/use mpi_f08 bindings are all in
# standalone .la files that depend on libmpi.la. So we must fully
# build libmpi.la first.
# NOTE: A handful of files in mpi/fortran/base must be included in
# libmpi.la. But we wanted to keep all the Fortran sources together
# in the same tree, so we moved those sources to a separate
# subdirectory with its own Makefile.include that is included in this
# Makefile.am (NOTE: it did *not* work to put all the files -- base
# and non-base -- into mpi/fortran/mpif-h and have both a regular
# Makefile.am for building the mpif.h bindings library and a separate
# Makefile.include that was included in this top-level Makefile.am;
# problems occurred with "make distclean" and files in the
# ompi/mpi/fortran/mpif-h/.deps directory -- it's not clear whether
# this is an AM bug or whether this behavior is simply not supported).
# This ompi/mpi/fortran/base/Makefile.include file makes a convenience
# LT library that is then sucked into libmpi.la (the
# ompi/mpi/fortran/base sources must be compiled with special
# CPPFLAGS; we can't just add the raw sources to libmpi_la_SOURCES,
# unfortunately).
# The end of the result is that libmpi.la -- including a few sources
# from mpi/fortran/base -- is fully built before the C++, mpif.h, and
# use mpi/use mpi_f08 bindings are built. Therefore, the C++, mpif.h
# and use mpi/use mpi_f08 bindings libraries can all link against
# libmpi.la.
# NOTE: The ordering of this list is VERY CAREFULLY CRAFTED! Do not
# change the ordering unless you really know what you're doing. :-)
SUBDIRS = \
include \
datatype \
debuggers \
etc \
mpi/c \
mpi/tool \
$(OMPI_MPIEXT_C_DIRS) \
mpi/fortran/base/ \
$(MCA_ompi_FRAMEWORKS_SUBDIRS) \
$(MCA_ompi_FRAMEWORK_COMPONENT_STATIC_SUBDIRS) \
. \
mpi/cxx \
$(OMPI_MPIEXT_MPIFH_DIRS) \
mpi/fortran/mpif-h \
$(OMPI_MPIEXT_USEMPI_DIR) \
$(OMPI_FORTRAN_USEMPI_DIR) \
$(OMPI_MPIEXT_USEMPIF08_DIRS) \
$(OMPI_FORTRAN_USEMPIF08_DIR) \
mpi/fortran/mpiext \
$(MCA_ompi_FRAMEWORK_COMPONENT_DSO_SUBDIRS) \
$(OMPI_CONTRIB_SUBDIRS)
if OMPI_WANT_JAVA_BINDINGS
SUBDIRS += \
mpi/java
endif
# The ordering of the DIST_SUBDIRS isn't as important, but note that
# its contents *are* different than SUBDIRS. In particular, the
# MPIEXT subdirs has a different value that is *not* equivalent to the
# union of the various $(OMPI_MPIEXT_*_DIRS) variables from SUBDIRS!
DIST_SUBDIRS = \
include \
datatype \
debuggers \
etc \
mpi/c \
mpi/tool \
mpi/cxx \
mpi/fortran/base \
mpi/fortran/mpif-h \
mpi/fortran/use-mpi-tkr \
mpi/fortran/use-mpi-ignore-tkr \
mpi/fortran/use-mpi-f08 \
mpi/fortran/use-mpi-f08-desc \
mpi/fortran/mpiext \
mpi/java \
$(OMPI_MPIEXT_ALL_SUBDIRS) \
$(MCA_ompi_FRAMEWORKS_SUBDIRS) \
$(MCA_ompi_FRAMEWORK_COMPONENT_ALL_SUBDIRS) \
$(OMPI_CONTRIB_DIST_SUBDIRS)
# Build the main MPI library
lib_LTLIBRARIES = lib@OMPI_LIBMPI_NAME@.la
lib@OMPI_LIBMPI_NAME@_la_SOURCES =
lib@OMPI_LIBMPI_NAME@_la_LIBADD = \
datatype/libdatatype.la \
debuggers/libdebuggers.la \
mpi/c/libmpi_c.la \
mpi/tool/libmpi_mpit_common.la \
$(c_mpi_lib) \
$(c_pmpi_lib) \
$(mpi_fortran_base_lib) \
$(MCA_ompi_FRAMEWORK_LIBS) \
$(OMPI_MPIEXT_C_LIBS) \
$(OMPI_LIBMPI_EXTRA_LIBS)
if OMPI_RTE_ORTE
lib@OMPI_LIBMPI_NAME@_la_LIBADD += \
$(OMPI_TOP_BUILDDIR)/orte/lib@ORTE_LIB_PREFIX@open-rte.la
endif
lib@OMPI_LIBMPI_NAME@_la_LIBADD += \
$(OMPI_TOP_BUILDDIR)/opal/lib@OPAL_LIB_PREFIX@open-pal.la
lib@OMPI_LIBMPI_NAME@_la_DEPENDENCIES = $(lib@OMPI_LIBMPI_NAME@_la_LIBADD)
lib@OMPI_LIBMPI_NAME@_la_LDFLAGS = \
-version-info $(libmpi_so_version) \
$(OMPI_LIBMPI_EXTRA_LDFLAGS)
# included subdirectory Makefile.am's and appended-to variables
headers =
noinst_LTLIBRARIES =
include_HEADERS =
dist_ompidata_DATA =
lib@OMPI_LIBMPI_NAME@_la_SOURCES += $(headers)
nodist_man_MANS =
# Conditionally install the header files
if WANT_INSTALL_HEADERS
ompidir = $(ompiincludedir)/$(subdir)
nobase_ompi_HEADERS = $(headers)
endif
include class/Makefile.am
include attribute/Makefile.am
include communicator/Makefile.am
include dpm/Makefile.am
include errhandler/Makefile.am
include file/Makefile.am
include group/Makefile.am
include info/Makefile.am
include message/Makefile.am
include op/Makefile.am
include peruse/Makefile.am
include proc/Makefile.am
include request/Makefile.am
include runtime/Makefile.am
include win/Makefile.am
include tools/Makefile.am
include mpi/Makefile.am
include mpi/man/man3/Makefile.extra
include mpiext/Makefile.am
include patterns/net/Makefile.am
include patterns/comm/Makefile.am
include mca/Makefile.am
# Ensure that the man page directory exists before we try to make man
# page files (because ompi/mpi/man/man3 has no config.status-generated
# Makefile)
dir_stamp = $(top_builddir)/$(subdir)/mpi/man/man3/.dir-stamp
# Also ensure that the man pages are rebuilt if the opal_config.h file
# changes (e.g., configure was run again, meaning that the release
# date or version may have changed)
$(nodist_man_MANS): $(dir_stamp) $(top_builddir)/opal/include/opal_config.h
$(dir_stamp):
$(MKDIR_P) `dirname $@`
touch "$@"
# Remove the generated man pages
distclean-local:
rm -f $(nodist_man_MANS) $(dir_stamp) mpiext/static-components.h

27
ompi/attribute/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,27 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This makefile.am does not stand on its own - it is included from ompi/Makefile.am
headers += \
attribute/attribute.h
lib@OMPI_LIBMPI_NAME@_la_SOURCES += \
attribute/attribute.c \
attribute/attribute_predefined.c

1329
ompi/attribute/attribute.c Обычный файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

526
ompi/attribute/attribute.h Обычный файл
Просмотреть файл

@ -0,0 +1,526 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/** @file
*
* Implementation for taking care of the attribute that can hang off a comm,
* win or datatype.
*/
#ifndef OMPI_ATTRIBUTE_H
#define OMPI_ATTRIBUTE_H
#include <string.h>
#include "mpi.h"
#include "ompi_config.h"
#include "ompi/constants.h"
#include "opal/class/opal_object.h"
#include "opal/class/opal_hash_table.h"
#define ATTR_HASH_SIZE 10
/*
* Flags for keyvals
*/
#define OMPI_KEYVAL_PREDEFINED 0x0001
#define OMPI_KEYVAL_F77 0x0002
#define OMPI_KEYVAL_F77_MPI1 0x0004
BEGIN_C_DECLS
enum ompi_attribute_type_t {
UNUSED_ATTR = 0, /**< Make the compilers happy when we have to construct
* an attribute */
COMM_ATTR, /**< The attribute belongs to a comm object. Starts
* with 1 so that we can have it initialized to 0
* using memset in the constructor */
TYPE_ATTR, /**< The attribute belongs to datatype object */
WIN_ATTR /**< The attribute belongs to a win object */
};
typedef enum ompi_attribute_type_t ompi_attribute_type_t;
/* Old-style MPI-1 Fortran function pointer declarations for copy and
delete. These will only be used here and not in the front end
functions. */
typedef void (ompi_mpi1_fortran_copy_attr_function)(MPI_Fint *oldobj,
MPI_Fint *keyval,
MPI_Fint *extra_state,
MPI_Fint *attr_in,
MPI_Fint *attr_out,
ompi_fortran_logical_t *flag,
MPI_Fint *ierr);
typedef void (ompi_mpi1_fortran_delete_attr_function)(MPI_Fint *obj,
MPI_Fint *keyval,
MPI_Fint *attr_in,
MPI_Fint *extra_state,
MPI_Fint *ierr);
/* New-style MPI-2 Fortran function pointer declarations for copy and
delete. These will only be used here and not in the front end
functions. */
typedef void (ompi_mpi2_fortran_copy_attr_function)(MPI_Fint *oldobj,
MPI_Fint *keyval,
void *extra_state,
void *attr_in,
void *attr_out,
ompi_fortran_logical_t *flag,
MPI_Fint *ierr);
typedef void (ompi_mpi2_fortran_delete_attr_function)(MPI_Fint *obj,
MPI_Fint *keyval,
void *attr_in,
void *extra_state,
MPI_Fint *ierr);
/*
* Internally the copy function for all kinds of MPI objects has one more
* argument, the pointer to the new object. Therefore, we can do on the
* flight modifications of the new communicator based on attributes stored
* on the main communicator.
*/
typedef int (MPI_Comm_internal_copy_attr_function)(MPI_Comm, int, void *,
void *, void *, int *,
MPI_Comm);
typedef int (MPI_Type_internal_copy_attr_function)(MPI_Datatype, int, void *,
void *, void *, int *,
MPI_Datatype);
typedef int (MPI_Win_internal_copy_attr_function)(MPI_Win, int, void *,
void *, void *, int *,
MPI_Win);
typedef void (ompi_attribute_keyval_destructor_fn_t)(int);
/* Union to take care of proper casting of the function pointers
passed from the front end functions depending on the type. This
will avoid casting function pointers to void* */
union ompi_attribute_fn_ptr_union_t {
MPI_Comm_delete_attr_function *attr_communicator_delete_fn;
MPI_Type_delete_attr_function *attr_datatype_delete_fn;
MPI_Win_delete_attr_function *attr_win_delete_fn;
MPI_Comm_internal_copy_attr_function *attr_communicator_copy_fn;
MPI_Type_internal_copy_attr_function *attr_datatype_copy_fn;
MPI_Win_internal_copy_attr_function *attr_win_copy_fn;
/* For Fortran old MPI-1 callback functions */
ompi_mpi1_fortran_delete_attr_function *attr_mpi1_fortran_delete_fn;
ompi_mpi1_fortran_copy_attr_function *attr_mpi1_fortran_copy_fn;
/* For Fortran new MPI-2 callback functions */
ompi_mpi2_fortran_delete_attr_function *attr_mpi2_fortran_delete_fn;
ompi_mpi2_fortran_copy_attr_function *attr_mpi2_fortran_copy_fn;
};
typedef union ompi_attribute_fn_ptr_union_t ompi_attribute_fn_ptr_union_t;
/**
* Union to help convert between Fortran attributes (which must be
* stored by value) and C pointers (which is the back-end storage of
* all attributes).
*/
union ompi_attribute_fortran_ptr_t {
void *c_ptr;
MPI_Fint f_integer;
MPI_Aint f_address;
};
/**
* Convenience typedef
*/
typedef union ompi_attribute_fortran_ptr_t ompi_attribute_fortran_ptr_t;
struct ompi_attribute_keyval_t {
opal_object_t super;
ompi_attribute_type_t attr_type; /**< One of COMM/WIN/DTYPE. This
will be used to cast the
copy/delete attribute functions
properly and error checking */
int attr_flag; /**< flag field: contains "OMPI_KEYVAL_PREDEFINED",
"OMPI_KEYVAL_F77" */
ompi_attribute_fn_ptr_union_t copy_attr_fn; /**< Copy function for the
attribute */
ompi_attribute_fn_ptr_union_t delete_attr_fn; /**< Delete function for the
attribute */
ompi_attribute_fortran_ptr_t extra_state; /**< Extra state of the attribute */
int key; /**< Keep a track of which key this item belongs to, so that
the key can be deleted when this object is destroyed */
/** Extra state for bindings to hang data on. If non-NULL, will be
freed by the C base when the keyval is destroyed. */
void *bindings_extra_state;
};
typedef struct ompi_attribute_keyval_t ompi_attribute_keyval_t;
/* Functions */
/**
* Convenient way to initialize the attribute hash table per MPI-Object
*/
static inline
int ompi_attr_hash_init(opal_hash_table_t **hash)
{
*hash = OBJ_NEW(opal_hash_table_t);
if (NULL == *hash) {
fprintf(stderr, "Error while creating the local attribute list\n");
return OMPI_ERR_OUT_OF_RESOURCE;
}
if (OMPI_SUCCESS != opal_hash_table_init(*hash, ATTR_HASH_SIZE)) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
return MPI_SUCCESS;
}
/**
* Initialize the main attribute hash that stores the keyvals and meta data
*
* @return OMPI return code
*/
int ompi_attr_init(void);
/**
* Destroy the main attribute hash that stores the keyvals and meta data
*/
int ompi_attr_finalize(void);
/**
* Create a new key for use by attribute of Comm/Win/Datatype
*
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
* @param copy_attr_fn Union variable containing the function pointer
* to be used in order to copy the attribute (IN)
* @param delete_attr_fn Function pointer to be used for deleting the
* attribute (IN)
* @param key The newly created key is returned here (OUT)
* @param extra_state Extra state to hang off/do some special things (IN)
* @param flags Flags for the key -- flags contain OMPI_KEYVAL_F77,
* OMPI_KEYVAL_PREDEFINED
* @param bindings_extra_state Extra state that, if non-NULL, will
* automatically be free()'ed by the C base when
* the keyval is destroyed.
*
* NOTE: I have taken the assumption that user cannot modify/delete
* any predefined keys or the attributes attached. To accomplish this,
* all MPI* calls will have OMPI_KEYVAL_PREDEFINED set as 0. MPI
* implementors who will need to play with the predefined keys and
* attributes would call the ompi* functions here and not the MPI*
* functions, with OMPI_KEYVAL_PREDEFINED set to 1.
* END OF NOTE
*
* NOTE: For the function pointers, you need to create a variable of the
* union type "ompi_attribute_fn_ptr_union_t" and assign the proper field.
* to be passed into this function
* END OF NOTE
*
* @return OMPI return code
*
*/
OMPI_DECLSPEC int ompi_attr_create_keyval(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key, void *extra_state, int flags,
void *bindings_extra_state);
/**
* Same as ompi_attr_create_keyval, but extra_state is a Fortran default integer.
*/
OMPI_DECLSPEC int ompi_attr_create_keyval_fint(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key, MPI_Fint extra_state, int flags,
void *bindings_extra_state);
/**
* Same as ompi_attr_create_keyval, but extra_state is a Fortran address integer.
*/
OMPI_DECLSPEC int ompi_attr_create_keyval_aint(ompi_attribute_type_t type,
ompi_attribute_fn_ptr_union_t copy_attr_fn,
ompi_attribute_fn_ptr_union_t delete_attr_fn,
int *key, MPI_Aint extra_state, int flags,
void *bindings_extra_state);
/**
* Free an attribute keyval
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
* @param key key, which is set to MPI_KEY_INVALID (IN/OUT)
* @return OMPI error code
*/
int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key,
bool predefined);
/**
* Set an attribute on the comm/win/datatype in a form valid for C.
*
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
* @param object The actual Comm/Win/Datatype object (IN)
* @param attr_hash The attribute hash table hanging on the object(IN/OUT)
* @param key Key val for the attribute (IN)
* @param attribute The actual attribute pointer (IN)
* @param predefined Whether the key is predefined or not 0/1 (IN)
* @return OMPI error code
*
* If (*attr_hash) == NULL, a new hash will be created and
* initialized.
*
* All three of these functions (ompi_attr_set_c(),
* ompi_attr_set_fortran_mpi1(), and ompi_attr_set_fortran_mpi2())
* could have been combined into one function that took some kind of
* (void*) and an enum to indicate which way to translate the final
* representation, but that just seemed to make an already complicated
* situation more complicated through yet another layer of
* indirection.
*
* So yes, this is more code, but it's clearer and less error-prone
* (read: better) this way.
*/
int ompi_attr_set_c(ompi_attribute_type_t type, void *object,
opal_hash_table_t **attr_hash,
int key, void *attribute, bool predefined);
/**
* Set an attribute on the comm/win/datatype in a form valid for
* Fortran MPI-1.
*
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
* @param object The actual Comm/Win/Datatype object (IN)
* @param attr_hash The attribute hash table hanging on the object(IN/OUT)
* @param key Key val for the attribute (IN)
* @param attribute The actual attribute pointer (IN)
* @param predefined Whether the key is predefined or not 0/1 (IN)
* @return OMPI error code
*
* If (*attr_hash) == NULL, a new hash will be created and
* initialized.
*
* All three of these functions (ompi_attr_set_c(),
* ompi_attr_set_fortran_mpi1(), and ompi_attr_set_fortran_mpi2())
* could have been combined into one function that took some kind of
* (void*) and an enum to indicate which way to translate the final
* representation, but that just seemed to make an already complicated
* situation more complicated through yet another layer of
* indirection.
*
* So yes, this is more code, but it's clearer and less error-prone
* (read: better) this way.
*/
OMPI_DECLSPEC int ompi_attr_set_fortran_mpi1(ompi_attribute_type_t type, void *object,
opal_hash_table_t **attr_hash,
int key, MPI_Fint attribute,
bool predefined);
/**
* Set an attribute on the comm/win/datatype in a form valid for
* Fortran MPI-2.
*
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
* @param object The actual Comm/Win/Datatype object (IN)
* @param attr_hash The attribute hash table hanging on the object(IN/OUT)
* @param key Key val for the attribute (IN)
* @param attribute The actual attribute pointer (IN)
* @param predefined Whether the key is predefined or not 0/1 (IN)
* @return OMPI error code
*
* If (*attr_hash) == NULL, a new hash will be created and
* initialized.
*
* All three of these functions (ompi_attr_set_c(),
* ompi_attr_set_fortran_mpi1(), and ompi_attr_set_fortran_mpi2())
* could have been combined into one function that took some kind of
* (void*) and an enum to indicate which way to translate the final
* representation, but that just seemed to make an already complicated
* situation more complicated through yet another layer of
* indirection.
*
* So yes, this is more code, but it's clearer and less error-prone
* (read: better) this way.
*/
OMPI_DECLSPEC int ompi_attr_set_fortran_mpi2(ompi_attribute_type_t type, void *object,
opal_hash_table_t **attr_hash,
int key, MPI_Aint attribute,
bool predefined);
/**
* Get an attribute on the comm/win/datatype in a form valid for C.
*
* @param attr_hash The attribute hash table hanging on the object(IN)
* @param key Key val for the attribute (IN)
* @param attribute The actual attribute pointer (OUT)
* @param flag Flag whether an attribute is associated
* with the key (OUT)
* @return OMPI error code
*
* All three of these functions (ompi_attr_get_c(),
* ompi_attr_get_fortran_mpi1(), and ompi_attr_get_fortran_mpi2())
* could have been combined into one function that took some kind of
* (void*) and an enum to indicate which way to translate the final
* representation, but that just seemed to make an already complicated
* situation more complicated through yet another layer of
* indirection.
*
* So yes, this is more code, but it's clearer and less error-prone
* (read: better) this way.
*/
int ompi_attr_get_c(opal_hash_table_t *attr_hash, int key,
void **attribute, int *flag);
/**
* Get an attribute on the comm/win/datatype in a form valid for
* Fortran MPI-1.
*
* @param attr_hash The attribute hash table hanging on the object(IN)
* @param key Key val for the attribute (IN)
* @param attribute The actual attribute pointer (OUT)
* @param flag Flag whether an attribute is associated
* with the key (OUT)
* @return OMPI error code
*
* All three of these functions (ompi_attr_get_c(),
* ompi_attr_get_fortran_mpi1(), and ompi_attr_get_fortran_mpi2())
* could have been combined into one function that took some kind of
* (void*) and an enum to indicate which way to translate the final
* representation, but that just seemed to make an already complicated
* situation more complicated through yet another layer of
* indirection.
*
* So yes, this is more code, but it's clearer and less error-prone
* (read: better) this way.
*/
OMPI_DECLSPEC int ompi_attr_get_fortran_mpi1(opal_hash_table_t *attr_hash, int key,
MPI_Fint *attribute, int *flag);
/**
* Get an attribute on the comm/win/datatype in a form valid for
* Fortran MPI-2.
*
* @param attr_hash The attribute hash table hanging on the object(IN)
* @param key Key val for the attribute (IN)
* @param attribute The actual attribute pointer (OUT)
* @param flag Flag whether an attribute is associated
* with the key (OUT)
* @return OMPI error code
*
* All three of these functions (ompi_attr_get_c(),
* ompi_attr_get_fortran_mpi1(), and ompi_attr_get_fortran_mpi2())
* could have been combined into one function that took some kind of
* (void*) and an enum to indicate which way to translate the final
* representation, but that just seemed to make an already complicated
* situation more complicated through yet another layer of
* indirection.
*
* So yes, this is more code, but it's clearer and less error-prone
* (read: better) this way.
*/
OMPI_DECLSPEC int ompi_attr_get_fortran_mpi2(opal_hash_table_t *attr_hash, int key,
MPI_Aint *attribute, int *flag);
/**
* Delete an attribute on the comm/win/datatype
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
* @param object The actual Comm/Win/Datatype object (IN)
* @param attr_hash The attribute hash table hanging on the object(IN)
* @param key Key val for the attribute (IN)
* @param predefined Whether the key is predefined or not 0/1 (IN)
* @return OMPI error code
*
*/
int ompi_attr_delete(ompi_attribute_type_t type, void *object,
opal_hash_table_t *attr_hash , int key,
bool predefined);
/**
* This to be used from functions like MPI_*_DUP in order to copy all
* the attributes from the old Comm/Win/Dtype object to a new
* object.
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
* @param old_object The old COMM/WIN/DTYPE object (IN)
* @param new_object The new COMM/WIN/DTYPE object (IN)
* @param oldattr_hash The attribute hash table hanging on old object(IN)
* @param newattr_hash The attribute hash table hanging on new object(IN)
* @return OMPI error code
*
*/
int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
void *new_object, opal_hash_table_t *oldattr_hash,
opal_hash_table_t *newattr_hash);
/**
* This to be used to delete all the attributes from the Comm/Win/Dtype
* object in one shot
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
* @param object The COMM/WIN/DTYPE object (IN)
* @param attr_hash The attribute hash table hanging on the object(IN)
* @return OMPI error code
*
*/
int ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
opal_hash_table_t *attr_hash);
/**
* \internal
*
* Create all the predefined attributes
*
* @returns OMPI_SUCCESS
*/
int ompi_attr_create_predefined(void);
/**
* \internal
*
* Free all the predefined attributes
*
* @returns OMPI_SUCCESS
*/
int ompi_attr_free_predefined(void);
END_C_DECLS
#endif /* OMPI_ATTRIBUTE_H */

277
ompi/attribute/attribute_predefined.c Обычный файл
Просмотреть файл

@ -0,0 +1,277 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 University of Houston. All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
/**
* @file
*
* Setup the predefined attributes in MPI.
*
* A number of pre-defined attributes are created here, most of which
* are exactly what one would expect, but there are a few exceptions
* -- so they're documented here.
*
* Predefined attributes are integer-valued or address-valued (per
* MPI-2; see section 4.12.7, keeping in mind that Example 4.13 is
* totally wrong -- see src/attribute/attribute.h for a lengthy
* explanation of this).
*
* The only address-valued attribute is MPI_WIN_BASE. We treat it as
* if it were set from C. All other attributes are integer-valued.
* We treat them as if they were set from Fortran MPI-1 (i.e.,
* MPI_ATTR_PUT) or Fortran MPI-2 (i.e., MPI_xxx_ATTR_SET). Most
* attributes are MPI-1 integer-valued, meaning that they are the size
* of MPI_Fint (INTEGER). But MPI_WIN_SIZE and MPI_WIN_DISP_UNIT are
* MPI-2 integer-valued, meaning that they are the size of MPI_Aint
* (INTEGER(KIND=MPI_ADDRESS_KIND)).
*
* MPI_TAG_UB is set to a fixed upper limit.
*
* MPI_HOST is set to MPI_PROC_NULL (per MPI-1, see 7.1.1, p192).
*
* MPI_IO is set to MPI_ANY_SOURCE. We may need to revist this.
*
* MPI_WTIME_IS_GLOBAL is set to 0 (a conservative answer).
*
* MPI_APPNUM is set as the result of a GPR subscription.
*
* MPI_LASTUSEDCODE is set to an initial value and is reset every time
* MPI_ADD_ERROR_CLASS or MPI_ADD_ERROR_CODE is invoked.
* Its copy function is set to
* MPI_COMM_NULL_COPY_FN, meaning that *only* MPI_COMM_WORLD will have
* this attribute value. As such, we only have to update
* MPI_COMM_WORLD when this value changes (i.e., since this is an
* integer-valued attribute, we have to update this attribute on every
* communicator -- using NULL_COPY_FN ensures that only MPI_COMM_WORLD
* has this attribute value set).
*
* MPI_UNIVERSE_SIZE is set as the result of a GPR subscription.
*
* MPI_WIN_BASE is an address-valued attribute, and is set directly
* from MPI_WIN_CREATE. MPI_WIN_SIZE and MPI_WIN_DISP_UNIT are both
* integer-valued attributes, *BUT* at least the MPI_WIN_SIZE is an
* MPI_Aint, so in terms of consistency, both should be the same --
* hence, we treat them as MPI-2 Fortran integer-valued attributes.
* All three of these atrributes have NULL_COPY_FN copy functions; it
* doesn't make sense to copy them to new windows (because they're
* values specific and unique to each window) -- especially when
* WIN_CREATE will explicitly set them on new windows anyway.
*
* These are not supported yet, but are included here for consistency:
*
* MPI_IMPI_CLIENT_SIZE, MPI_IMPI_CLIENT_COLOR, MPI_IMPI_HOST_SIZE,
* and MPI_IMPI_HOST_COLOR are integer-valued attributes.
*/
#include "ompi_config.h"
#include <stdlib.h>
#include "mpi.h"
#include "ompi/attribute/attribute.h"
#include "ompi/errhandler/errcode.h"
#include "ompi/communicator/communicator.h"
#include "ompi/mca/pml/pml.h"
/*
* Private functions
*/
static int create_comm(int target_keyval, bool want_inherit);
static int free_comm(int keyval);
static int create_win(int target_keyval);
static int free_win(int keyval);
static int set_f(int keyval, MPI_Fint value);
int ompi_attr_create_predefined(void)
{
int ret;
char *univ_size;
int usize;
/* Create all the keyvals */
/* DO NOT CHANGE THE ORDER OF CREATING THESE KEYVALS! This order
strictly adheres to the order in mpi.h. If you change the
order here, you must change the order in mpi.h as well! */
if (OMPI_SUCCESS != (ret = create_comm(MPI_TAG_UB, true)) ||
OMPI_SUCCESS != (ret = create_comm(MPI_HOST, true)) ||
OMPI_SUCCESS != (ret = create_comm(MPI_IO, true)) ||
OMPI_SUCCESS != (ret = create_comm(MPI_WTIME_IS_GLOBAL, true)) ||
OMPI_SUCCESS != (ret = create_comm(MPI_APPNUM, true)) ||
OMPI_SUCCESS != (ret = create_comm(MPI_LASTUSEDCODE, false)) ||
OMPI_SUCCESS != (ret = create_comm(MPI_UNIVERSE_SIZE, true)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_BASE)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_SIZE)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_DISP_UNIT)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_CREATE_FLAVOR)) ||
OMPI_SUCCESS != (ret = create_win(MPI_WIN_MODEL)) ||
#if 0
/* JMS For when we implement IMPI */
OMPI_SUCCESS != (ret = create_comm(IMPI_CLIENT_SIZE, true)) ||
OMPI_SUCCESS != (ret = create_comm(IMPI_CLIENT_COLOR, true)) ||
OMPI_SUCCESS != (ret = create_comm(IMPI_HOST_SIZE, true)) ||
OMPI_SUCCESS != (ret = create_comm(IMPI_HOST_COLOR, true)) ||
#endif
0) {
return ret;
}
/* Set default values for everything except MPI_UNIVERSE_SIZE */
if (OMPI_SUCCESS != (ret = set_f(MPI_TAG_UB, mca_pml.pml_max_tag)) ||
OMPI_SUCCESS != (ret = set_f(MPI_HOST, MPI_PROC_NULL)) ||
OMPI_SUCCESS != (ret = set_f(MPI_IO, MPI_ANY_SOURCE)) ||
OMPI_SUCCESS != (ret = set_f(MPI_WTIME_IS_GLOBAL, 0)) ||
OMPI_SUCCESS != (ret = set_f(MPI_LASTUSEDCODE,
ompi_mpi_errcode_lastused)) ||
#if 0
/* JMS For when we implement IMPI */
OMPI_SUCCESS != (ret = set(IMPI_CLIENT_SIZE,
&attr_impi_client_size)) ||
OMPI_SUCCESS != (ret = set(IMPI_CLIENT_COLOR,
&attr_impi_client_color)) ||
OMPI_SUCCESS != (ret = set(IMPI_HOST_SIZE,
&attr_impi_host_size)) ||
OMPI_SUCCESS != (ret = set(IMPI_HOST_COLOR,
&attr_impi_host_color)) ||
#endif
0) {
return ret;
}
/* If the universe size is set, then use it. Otherwise default
* to the size of MPI_COMM_WORLD */
univ_size = getenv("OMPI_UNIVERSE_SIZE");
if (NULL == univ_size || (usize = strtol(univ_size, NULL, 0)) <= 0) {
ret = set_f(MPI_UNIVERSE_SIZE, ompi_comm_size(MPI_COMM_WORLD));
} else {
ret = set_f(MPI_UNIVERSE_SIZE, usize);
}
if (OMPI_SUCCESS != ret) {
return ret;
}
ret = set_f(MPI_APPNUM, ompi_process_info.app_num);
return ret;
}
int ompi_attr_free_predefined(void)
{
int ret;
if (OMPI_SUCCESS != (ret = free_comm(MPI_TAG_UB)) ||
OMPI_SUCCESS != (ret = free_comm(MPI_HOST)) ||
OMPI_SUCCESS != (ret = free_comm(MPI_IO)) ||
OMPI_SUCCESS != (ret = free_comm(MPI_WTIME_IS_GLOBAL)) ||
OMPI_SUCCESS != (ret = free_comm(MPI_APPNUM)) ||
OMPI_SUCCESS != (ret = free_comm(MPI_LASTUSEDCODE)) ||
OMPI_SUCCESS != (ret = free_comm(MPI_UNIVERSE_SIZE)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_BASE)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_SIZE)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_DISP_UNIT)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_CREATE_FLAVOR)) ||
OMPI_SUCCESS != (ret = free_win(MPI_WIN_MODEL)) ||
#if 0
/* JMS For when we implement IMPI */
OMPI_SUCCESS != (ret = free_comm(IMPI_CLIENT_SIZE)) ||
OMPI_SUCCESS != (ret = free_comm(IMPI_CLIENT_COLOR)) ||
OMPI_SUCCESS != (ret = free_comm(IMPI_HOST_SIZE)) ||
OMPI_SUCCESS != (ret = free_comm(IMPI_HOST_COLOR)) ||
#endif
0) {
return ret;
}
return OMPI_SUCCESS;
}
static int create_comm(int target_keyval, bool want_inherit)
{
int err;
int keyval;
ompi_attribute_fn_ptr_union_t copy;
ompi_attribute_fn_ptr_union_t del;
keyval = -1;
copy.attr_communicator_copy_fn = (MPI_Comm_internal_copy_attr_function*)
(want_inherit ? MPI_COMM_DUP_FN : MPI_COMM_NULL_COPY_FN);
del.attr_communicator_delete_fn = MPI_COMM_NULL_DELETE_FN;
err = ompi_attr_create_keyval(COMM_ATTR, copy, del,
&keyval, NULL, OMPI_KEYVAL_PREDEFINED, NULL);
if (MPI_SUCCESS != err) {
return err;
}
if (target_keyval != keyval) {
return OMPI_ERR_BAD_PARAM;
}
return OMPI_SUCCESS;
}
static int free_comm(int keyval)
{
int key = keyval;
return ompi_attr_free_keyval (COMM_ATTR, &key, true);
}
static int create_win(int target_keyval)
{
int err;
int keyval;
ompi_attribute_fn_ptr_union_t copy;
ompi_attribute_fn_ptr_union_t del;
keyval = -1;
copy.attr_win_copy_fn = (MPI_Win_internal_copy_attr_function*)MPI_WIN_NULL_COPY_FN;
del.attr_win_delete_fn = MPI_WIN_NULL_DELETE_FN;
err = ompi_attr_create_keyval(WIN_ATTR, copy, del,
&keyval, NULL, OMPI_KEYVAL_PREDEFINED, NULL);
if (MPI_SUCCESS != err) {
return err;
}
if (target_keyval != keyval) {
return OMPI_ERR_BAD_PARAM;
}
return OMPI_SUCCESS;
}
static int free_win(int keyval)
{
int key = keyval;
return ompi_attr_free_keyval (WIN_ATTR, &key, true);
}
static int set_f(int keyval, MPI_Fint value)
{
return ompi_attr_set_fortran_mpi1(COMM_ATTR, MPI_COMM_WORLD,
&MPI_COMM_WORLD->c_keyhash,
keyval, value,
true);
}

28
ompi/class/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,28 @@
# -*- makefile -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2007 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This makefile.am does not stand on its own - it is included from ompi/Makefile.am
headers += \
class/ompi_seq_tracker.h
lib@OMPI_LIBMPI_NAME@_la_SOURCES += \
class/ompi_seq_tracker.c

198
ompi/class/ompi_seq_tracker.c Обычный файл
Просмотреть файл

@ -0,0 +1,198 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include "ompi/class/ompi_seq_tracker.h"
OBJ_CLASS_INSTANCE(ompi_seq_tracker_range_t,
opal_list_item_t,
NULL,
NULL);
static void ompi_seq_tracker_construct(ompi_seq_tracker_t* seq_tracker) {
OBJ_CONSTRUCT(&seq_tracker->seq_ids, opal_list_t);
seq_tracker->seq_ids_current = (ompi_seq_tracker_range_t*)opal_list_get_end(&seq_tracker->seq_ids);
}
static void ompi_seq_tracker_destruct(ompi_seq_tracker_t* seq_tracker)
{
opal_list_item_t* item;
while(NULL != (item = opal_list_remove_first(&seq_tracker->seq_ids)))
OBJ_RELEASE(item);
OBJ_DESTRUCT(&seq_tracker->seq_ids);
}
OBJ_CLASS_INSTANCE(
ompi_seq_tracker_t,
opal_object_t,
ompi_seq_tracker_construct,
ompi_seq_tracker_destruct);
/**
* Look for duplicate sequence number in current range.
* Must be called w/ matching lock held.
*/
bool ompi_seq_tracker_check_duplicate(
ompi_seq_tracker_t* seq_tracker,
uint32_t seq_id)
{
ompi_seq_tracker_range_t* item;
const ompi_seq_tracker_range_t* sentinel = (ompi_seq_tracker_range_t*)opal_list_get_end(&seq_tracker->seq_ids);
int8_t direction = 0; /* 1 is next, -1 is previous */
item = seq_tracker->seq_ids_current;
while(true) {
if(sentinel == item) {
return false;
} else if(item->seq_id_high >= seq_id && item->seq_id_low <= seq_id) {
seq_tracker->seq_ids_current = (ompi_seq_tracker_range_t*) item;
return true;
} else if(seq_id > item->seq_id_high && direction != -1) {
direction = 1;
item = (ompi_seq_tracker_range_t*) opal_list_get_next(item);
} else if(seq_id < item->seq_id_low && direction != 1) {
direction = -1;
item = (ompi_seq_tracker_range_t*) opal_list_get_prev(item);
} else {
return false;
}
}
}
/*
* insert item into sequence tracking list,
* compacts continuous regions into a single entry
* GMS::: Use a free list for the items (don't do OBJ_NEW)!
*/
void ompi_seq_tracker_insert(ompi_seq_tracker_t* seq_tracker,
uint32_t seq_id)
{
opal_list_t* seq_ids = &seq_tracker->seq_ids;
ompi_seq_tracker_range_t* item = seq_tracker->seq_ids_current;
int8_t direction = 0; /* 1 is next, -1 is previous */
ompi_seq_tracker_range_t *new_item, *next_item, *prev_item;
const ompi_seq_tracker_range_t* sentinel = (ompi_seq_tracker_range_t*)opal_list_get_end(seq_ids);
while( true ) {
if( item == sentinel ) {
new_item = OBJ_NEW(ompi_seq_tracker_range_t);
new_item->seq_id_low = new_item->seq_id_high = seq_id;
if( -1 == direction ) {
opal_list_prepend(seq_ids, (opal_list_item_t*) new_item);
} else {
opal_list_append(seq_ids, (opal_list_item_t*) new_item);
}
seq_tracker->seq_ids_current = (ompi_seq_tracker_range_t*) new_item;
return;
} else if(item->seq_id_high >= seq_id && item->seq_id_low <= seq_id ) {
seq_tracker->seq_ids_current = (ompi_seq_tracker_range_t*) item;
return;
} else if((item->seq_id_high + 1) == seq_id) {
next_item = (ompi_seq_tracker_range_t*) opal_list_get_next(item);
/* try to consolidate */
if( (sentinel != next_item) && next_item->seq_id_low == (seq_id+1)) {
item->seq_id_high = next_item->seq_id_high;
opal_list_remove_item(seq_ids, (opal_list_item_t*) next_item);
OBJ_RELEASE(next_item);
} else {
item->seq_id_high = seq_id;
}
seq_tracker->seq_ids_current = (ompi_seq_tracker_range_t*) item;
return;
} else if((item->seq_id_low - 1) == seq_id) {
prev_item = (ompi_seq_tracker_range_t*) opal_list_get_prev(item);
/* try to consolidate */
if( (sentinel != prev_item) && prev_item->seq_id_high == (seq_id-1)) {
item->seq_id_low = prev_item->seq_id_low;
opal_list_remove_item(seq_ids, (opal_list_item_t*) prev_item);
OBJ_RELEASE(prev_item);
} else {
item->seq_id_low = seq_id;
}
seq_tracker->seq_ids_current = (ompi_seq_tracker_range_t*) item;
return;
} else if(seq_id > item->seq_id_high ) {
if(direction == -1) {
/* we have gone back in the list, and we went one item too far */
new_item = OBJ_NEW(ompi_seq_tracker_range_t);
new_item->seq_id_low = new_item->seq_id_high = seq_id;
next_item = (ompi_seq_tracker_range_t*) opal_list_get_next(item);
/* insert new_item directly before item */
opal_list_insert_pos(seq_ids,
(opal_list_item_t*) next_item,
(opal_list_item_t*) new_item);
seq_tracker->seq_ids_current = (ompi_seq_tracker_range_t*) new_item;
return;
} else {
direction = 1;
item = (ompi_seq_tracker_range_t*) opal_list_get_next(item);
}
} else if(seq_id < item->seq_id_low) {
if(direction == 1) {
/* we have gone forward in the list, and we went one item too far */
new_item = OBJ_NEW(ompi_seq_tracker_range_t);
new_item->seq_id_low = new_item->seq_id_high = seq_id;
opal_list_insert_pos(seq_ids,
(opal_list_item_t*) item,
(opal_list_item_t*) new_item);
seq_tracker->seq_ids_current = (ompi_seq_tracker_range_t*) new_item;
return;
} else {
direction = -1;
item = (ompi_seq_tracker_range_t*) opal_list_get_prev(item);
}
} else {
return;
}
}
}
void ompi_seq_tracker_copy(ompi_seq_tracker_t* dst, ompi_seq_tracker_t* src)
{
opal_list_item_t* item;
for( item = opal_list_get_first(&src->seq_ids);
item != opal_list_get_end(&src->seq_ids);
item = opal_list_get_next(item)) {
ompi_seq_tracker_range_t* src_item = (ompi_seq_tracker_range_t*)item;
ompi_seq_tracker_range_t* dst_item = OBJ_NEW(ompi_seq_tracker_range_t);
dst_item->seq_id_high = src_item->seq_id_high;
dst_item->seq_id_low = src_item->seq_id_low;
opal_list_append(&dst->seq_ids, &dst_item->super);
if(src->seq_ids_current == src_item) {
dst->seq_ids_current = dst_item;
}
}
}

70
ompi/class/ompi_seq_tracker.h Обычный файл
Просмотреть файл

@ -0,0 +1,70 @@
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OMPI_SEQ_TRACKER_H
#define OMPI_SEQ_TRACKER_H
#include "ompi_config.h"
#include "opal/class/opal_list.h"
#include "ompi/constants.h"
BEGIN_C_DECLS
struct ompi_seq_tracker_range_t{
opal_list_item_t super;
uint32_t seq_id_high;
uint32_t seq_id_low;
};
typedef struct ompi_seq_tracker_range_t ompi_seq_tracker_range_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_seq_tracker_range_t);
struct ompi_seq_tracker_t{
opal_list_t seq_ids; /**< list of seqs id's that have been seen */
ompi_seq_tracker_range_t* seq_ids_current; /**< a pointer to the last place we were in the list */
};
typedef struct ompi_seq_tracker_t ompi_seq_tracker_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_seq_tracker_t);
/**
* Look for duplicate sequence number in current range.
* Must be called w/ matching lock held.
*/
OMPI_DECLSPEC bool ompi_seq_tracker_check_duplicate(
ompi_seq_tracker_t* seq_tracker,
uint32_t seq_id);
/*
* insert item into sequence tracking list,
* compacts continuous regions into a single entry
*/
OMPI_DECLSPEC void ompi_seq_tracker_insert(ompi_seq_tracker_t* seq_tracker, uint32_t seq_i);
/*
* Copy state from one sequence tracker list into another.
*/
OMPI_DECLSPEC void ompi_seq_tracker_copy(ompi_seq_tracker_t* dst, ompi_seq_tracker_t* src);
END_C_DECLS
#endif

38
ompi/communicator/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,38 @@
# -*- makefile -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2014 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This makefile.am does not stand on its own - it is included from ompi/Makefile.am
headers += \
communicator/communicator.h \
communicator/comm_request.h \
communicator/comm_helpers.h
lib@OMPI_LIBMPI_NAME@_la_SOURCES += \
communicator/comm_init.c \
communicator/comm.c \
communicator/comm_cid.c \
communicator/comm_request.c \
communicator/comm_helpers.c

1977
ompi/communicator/comm.c Обычный файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1084
ompi/communicator/comm_cid.c Обычный файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

92
ompi/communicator/comm_helpers.c Обычный файл
Просмотреть файл

@ -0,0 +1,92 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2006 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2006 The Technical University of Chemnitz. All
* rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
*
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
*
*/
#include "comm_helpers.h"
int ompi_comm_neighbors_count(MPI_Comm comm, int *indegree, int *outdegree, int *weighted) {
int res;
if (OMPI_COMM_IS_CART(comm)) {
int ndims;
res = MPI_Cartdim_get(comm, &ndims) ;
if (MPI_SUCCESS != res) {
return res;
}
/* outdegree is always 2*ndims because we need to iterate over empty buffers for MPI_PROC_NULL */
*outdegree = *indegree = 2*ndims;
*weighted = 0;
} else if (OMPI_COMM_IS_GRAPH(comm)) {
int rank, nneighbors;
rank = ompi_comm_rank ((ompi_communicator_t *) comm);
res = MPI_Graph_neighbors_count(comm, rank, &nneighbors);
if (MPI_SUCCESS != res) {
return res;
}
*outdegree = *indegree = nneighbors;
*weighted = 0;
} else if (OMPI_COMM_IS_DIST_GRAPH(comm)) {
res = MPI_Dist_graph_neighbors_count(comm, indegree, outdegree, weighted);
} else {
return MPI_ERR_ARG;
}
return MPI_SUCCESS;
}
int ompi_comm_neighbors(MPI_Comm comm, int maxindegree, int sources[], int sourceweights[], int maxoutdegree, int destinations[], int destweights[]) {
int res;
int index = 0;
int indeg, outdeg, wgtd;
res = ompi_comm_neighbors_count(comm, &indeg, &outdeg, &wgtd);
if (MPI_SUCCESS != res) {
return res;
}
if(indeg > maxindegree && outdeg > maxoutdegree) return MPI_ERR_TRUNCATE; /* we want to return *all* neighbors */
if (OMPI_COMM_IS_CART(comm)) {
int ndims, i, rpeer, speer;
res = MPI_Cartdim_get(comm, &ndims);
if (MPI_SUCCESS != res) {
return res;
}
for(i = 0; i<ndims; i++) {
res = MPI_Cart_shift(comm, i, 1, &rpeer, &speer);
if (MPI_SUCCESS != res) {
return res;
}
sources[index] = destinations[index] = rpeer; index++;
sources[index] = destinations[index] = speer; index++;
}
} else if (OMPI_COMM_IS_GRAPH(comm)) {
int rank = ompi_comm_rank ((ompi_communicator_t *) comm);
res = MPI_Graph_neighbors(comm, rank, maxindegree, sources);
if (MPI_SUCCESS != res) {
return res;
}
for(int i=0; i<maxindegree; i++) destinations[i] = sources[i];
} else if (OMPI_COMM_IS_DIST_GRAPH(comm)) {
res = MPI_Dist_graph_neighbors(comm, maxindegree, sources, sourceweights, maxoutdegree, destinations, destweights);
if (MPI_SUCCESS != res) {
return res;
}
} else {
return MPI_ERR_ARG;
}
return MPI_SUCCESS;
}

41
ompi/communicator/comm_helpers.h Обычный файл
Просмотреть файл

@ -0,0 +1,41 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* Author(s): Torsten Hoefler <htor@cs.indiana.edu>
*
* $HEADER$
*/
#ifndef __TOPO_HELPERS_H__
#define __TOPO_HELPERS_H__
#include "ompi_config.h"
#include "mpi.h"
#include "ompi/include/ompi/constants.h"
#include "ompi/communicator/communicator.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
int ompi_comm_neighbors_count(MPI_Comm comm, int *indegree, int *outdegree, int *weighted);
int ompi_comm_neighbors(MPI_Comm comm, int maxindegree, int sources[], int sourceweights[], int maxoutdegree, int destinations[], int destweights[]);
#ifdef __cplusplus
}
#endif
#endif

448
ompi/communicator/comm_init.c Обычный файл
Просмотреть файл

@ -0,0 +1,448 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2010 University of Houston. All rights reserved.
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2011-2013 Inria. All rights reserved.
* Copyright (c) 2011-2013 Universite Bordeaux 1
* All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal/util/bit_ops.h"
#include "ompi/constants.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/coll/base/base.h"
#include "ompi/mca/topo/base/base.h"
#include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h"
#include "ompi/attribute/attribute.h"
#include "ompi/dpm/dpm.h"
#include "ompi/memchecker.h"
/*
** Table for Fortran <-> C communicator handle conversion
** Also used by P2P code to lookup communicator based
** on cid.
**
*/
opal_pointer_array_t ompi_mpi_communicators = {{0}};
opal_pointer_array_t ompi_comm_f_to_c_table = {{0}};
ompi_predefined_communicator_t ompi_mpi_comm_world = {{{0}}};
ompi_predefined_communicator_t ompi_mpi_comm_self = {{{0}}};
ompi_predefined_communicator_t ompi_mpi_comm_null = {{{0}}};
ompi_communicator_t *ompi_mpi_comm_parent = NULL;
ompi_predefined_communicator_t *ompi_mpi_comm_world_addr =
&ompi_mpi_comm_world;
ompi_predefined_communicator_t *ompi_mpi_comm_self_addr =
&ompi_mpi_comm_self;
ompi_predefined_communicator_t *ompi_mpi_comm_null_addr =
&ompi_mpi_comm_null;
static void ompi_comm_construct(ompi_communicator_t* comm);
static void ompi_comm_destruct(ompi_communicator_t* comm);
OBJ_CLASS_INSTANCE(ompi_communicator_t, opal_object_t,
ompi_comm_construct,
ompi_comm_destruct);
/* This is the counter for the number of communicators, which contain
process with more than one jobid. This counter is a usefull
shortcut for finalize and abort. */
int ompi_comm_num_dyncomm=0;
/*
* Initialize comm world/self/null/parent.
*/
int ompi_comm_init(void)
{
ompi_group_t *group;
size_t size;
/* Setup communicator array */
OBJ_CONSTRUCT(&ompi_mpi_communicators, opal_pointer_array_t);
if( OPAL_SUCCESS != opal_pointer_array_init(&ompi_mpi_communicators, 0,
OMPI_FORTRAN_HANDLE_MAX, 64) ) {
return OMPI_ERROR;
}
/* Setup f to c table (we can no longer use the cid as the fortran handle) */
OBJ_CONSTRUCT(&ompi_comm_f_to_c_table, opal_pointer_array_t);
if( OPAL_SUCCESS != opal_pointer_array_init(&ompi_comm_f_to_c_table, 0,
OMPI_FORTRAN_HANDLE_MAX, 64) ) {
return OMPI_ERROR;
}
/* Setup MPI_COMM_WORLD */
OBJ_CONSTRUCT(&ompi_mpi_comm_world, ompi_communicator_t);
assert(ompi_mpi_comm_world.comm.c_f_to_c_index == 0);
group = OBJ_NEW(ompi_group_t);
size = ompi_process_info.num_procs;
group->grp_proc_pointers = (ompi_proc_t **) calloc (size, sizeof (ompi_proc_t *));
group->grp_proc_count = size;
for (size_t i = 0 ; i < size ; ++i) {
opal_process_name_t name = {.vpid = i, .jobid = OMPI_PROC_MY_NAME->jobid};
/* look for existing ompi_proc_t that matches this name */
group->grp_proc_pointers[i] = (ompi_proc_t *) ompi_proc_lookup (name);
if (NULL == group->grp_proc_pointers[i]) {
/* set sentinel value */
group->grp_proc_pointers[i] = (ompi_proc_t *) ompi_proc_name_to_sentinel (name);
} else {
OBJ_RETAIN (group->grp_proc_pointers[i]);
}
}
OMPI_GROUP_SET_INTRINSIC (group);
OMPI_GROUP_SET_DENSE (group);
ompi_set_group_rank(group, ompi_proc_local());
ompi_mpi_comm_world.comm.c_contextid = 0;
ompi_mpi_comm_world.comm.c_id_start_index = 4;
ompi_mpi_comm_world.comm.c_id_available = 4;
ompi_mpi_comm_world.comm.c_my_rank = group->grp_my_rank;
ompi_mpi_comm_world.comm.c_local_group = group;
ompi_mpi_comm_world.comm.c_remote_group = group;
OBJ_RETAIN(ompi_mpi_comm_world.comm.c_remote_group);
ompi_mpi_comm_world.comm.c_cube_dim = opal_cube_dim((int)size);
ompi_mpi_comm_world.comm.error_handler = &ompi_mpi_errors_are_fatal.eh;
OBJ_RETAIN( &ompi_mpi_errors_are_fatal.eh );
OMPI_COMM_SET_PML_ADDED(&ompi_mpi_comm_world.comm);
opal_pointer_array_set_item (&ompi_mpi_communicators, 0, &ompi_mpi_comm_world);
MEMCHECKER (memset (ompi_mpi_comm_world.comm.c_name, 0, MPI_MAX_OBJECT_NAME));
strncpy (ompi_mpi_comm_world.comm.c_name, "MPI_COMM_WORLD",
strlen("MPI_COMM_WORLD")+1 );
ompi_mpi_comm_world.comm.c_flags |= OMPI_COMM_NAMEISSET;
ompi_mpi_comm_world.comm.c_flags |= OMPI_COMM_INTRINSIC;
/* We have to create a hash (although it is legal to leave this
filed NULL -- the attribute accessor functions will intepret
this as "there are no attributes cached on this object")
because MPI_COMM_WORLD has some predefined attributes. */
ompi_attr_hash_init(&ompi_mpi_comm_world.comm.c_keyhash);
/* Setup MPI_COMM_SELF */
OBJ_CONSTRUCT(&ompi_mpi_comm_self, ompi_communicator_t);
assert(ompi_mpi_comm_self.comm.c_f_to_c_index == 1);
group = OBJ_NEW(ompi_group_t);
group->grp_proc_pointers = ompi_proc_self(&size);
group->grp_my_rank = 0;
group->grp_proc_count = (int)size;
OMPI_GROUP_SET_INTRINSIC (group);
OMPI_GROUP_SET_DENSE (group);
ompi_mpi_comm_self.comm.c_contextid = 1;
ompi_mpi_comm_self.comm.c_id_start_index = 20;
ompi_mpi_comm_self.comm.c_id_available = 20;
ompi_mpi_comm_self.comm.c_my_rank = group->grp_my_rank;
ompi_mpi_comm_self.comm.c_local_group = group;
ompi_mpi_comm_self.comm.c_remote_group = group;
OBJ_RETAIN(ompi_mpi_comm_self.comm.c_remote_group);
ompi_mpi_comm_self.comm.error_handler = &ompi_mpi_errors_are_fatal.eh;
OBJ_RETAIN( &ompi_mpi_errors_are_fatal.eh );
OMPI_COMM_SET_PML_ADDED(&ompi_mpi_comm_self.comm);
opal_pointer_array_set_item (&ompi_mpi_communicators, 1, &ompi_mpi_comm_self);
MEMCHECKER (memset (ompi_mpi_comm_self.comm.c_name, 0, MPI_MAX_OBJECT_NAME));
strncpy(ompi_mpi_comm_self.comm.c_name,"MPI_COMM_SELF",strlen("MPI_COMM_SELF")+1);
ompi_mpi_comm_self.comm.c_flags |= OMPI_COMM_NAMEISSET;
ompi_mpi_comm_self.comm.c_flags |= OMPI_COMM_INTRINSIC;
/* We can set MPI_COMM_SELF's keyhash to NULL because it has no
predefined attributes. If a user defines an attribute on
MPI_COMM_SELF, the keyhash will automatically be created. */
ompi_mpi_comm_self.comm.c_keyhash = NULL;
/* Setup MPI_COMM_NULL */
OBJ_CONSTRUCT(&ompi_mpi_comm_null, ompi_communicator_t);
assert(ompi_mpi_comm_null.comm.c_f_to_c_index == 2);
ompi_mpi_comm_null.comm.c_local_group = &ompi_mpi_group_null.group;
ompi_mpi_comm_null.comm.c_remote_group = &ompi_mpi_group_null.group;
OBJ_RETAIN(&ompi_mpi_group_null.group);
OBJ_RETAIN(&ompi_mpi_group_null.group);
ompi_mpi_comm_null.comm.c_contextid = 2;
ompi_mpi_comm_null.comm.c_my_rank = MPI_PROC_NULL;
ompi_mpi_comm_null.comm.error_handler = &ompi_mpi_errors_are_fatal.eh;
OBJ_RETAIN( &ompi_mpi_errors_are_fatal.eh );
opal_pointer_array_set_item (&ompi_mpi_communicators, 2, &ompi_mpi_comm_null);
MEMCHECKER (memset (ompi_mpi_comm_null.comm.c_name, 0, MPI_MAX_OBJECT_NAME));
strncpy(ompi_mpi_comm_null.comm.c_name,"MPI_COMM_NULL",strlen("MPI_COMM_NULL")+1);
ompi_mpi_comm_null.comm.c_flags |= OMPI_COMM_NAMEISSET;
ompi_mpi_comm_null.comm.c_flags |= OMPI_COMM_INTRINSIC;
/* Initialize the parent communicator to MPI_COMM_NULL */
ompi_mpi_comm_parent = &ompi_mpi_comm_null.comm;
OBJ_RETAIN(&ompi_mpi_comm_null);
OBJ_RETAIN(&ompi_mpi_group_null.group);
OBJ_RETAIN(&ompi_mpi_errors_are_fatal.eh);
/* initialize communicator requests (for ompi_comm_idup) */
ompi_comm_request_init ();
return OMPI_SUCCESS;
}
ompi_communicator_t *ompi_comm_allocate ( int local_size, int remote_size )
{
ompi_communicator_t *new_comm;
/* create new communicator element */
new_comm = OBJ_NEW(ompi_communicator_t);
new_comm->c_local_group = ompi_group_allocate ( local_size );
if ( 0 < remote_size ) {
new_comm->c_remote_group = ompi_group_allocate (remote_size);
new_comm->c_flags |= OMPI_COMM_INTER;
} else {
/*
* simplifies some operations (e.g. p2p), if
* we can always use the remote group
*/
new_comm->c_remote_group = new_comm->c_local_group;
OBJ_RETAIN(new_comm->c_remote_group);
}
/* fill in the inscribing hyper-cube dimensions */
new_comm->c_cube_dim = opal_cube_dim(local_size);
return new_comm;
}
int ompi_comm_finalize(void)
{
int max, i;
ompi_communicator_t *comm;
/* Shut down MPI_COMM_SELF */
OBJ_DESTRUCT( &ompi_mpi_comm_self );
/* disconnect all dynamic communicators */
ompi_dpm_dyn_finalize();
/* Free the attributes on comm world. This is not done in the
* destructor as we delete attributes in ompi_comm_free (which
* is not called for comm world) */
if (NULL != ompi_mpi_comm_world.comm.c_keyhash) {
/* Ignore errors when deleting attributes on comm_world */
(void) ompi_attr_delete_all(COMM_ATTR, &ompi_mpi_comm_world.comm, ompi_mpi_comm_world.comm.c_keyhash);
OBJ_RELEASE(ompi_mpi_comm_world.comm.c_keyhash);
}
/* Shut down MPI_COMM_WORLD */
OBJ_DESTRUCT( &ompi_mpi_comm_world );
/* Shut down the parent communicator, if it exists */
if( ompi_mpi_comm_parent != &ompi_mpi_comm_null.comm ) {
/* Note that we pass ompi_mpi_comm_parent here
(vs. &ompi_mpi_comm_parent) because it is of type
(ompi_communicator_t*), *NOT* (ompi_communicator_t). This
is because a parent communicator is created dynamically
during init, and we just set this pointer to it. Hence, we
just pass in the pointer here. */
OBJ_DESTRUCT (ompi_mpi_comm_parent);
/* Please note, that the we did increase the reference count
for ompi_mpi_comm_null, ompi_mpi_group_null, and
ompi_mpi_errors_are_fatal in ompi_comm_init because of
ompi_mpi_comm_parent. In case a
parent communicator is really created, the ref. counters
for these objects are decreased again by one. However, in a
static scenario, we should ideally decrease the ref. counter
for these objects by one here. The problem just is, that
if the app had a parent_comm, and this has been freed/disconnected,
ompi_comm_parent points again to ompi_comm_null, the reference count
for these objects has not been increased again.
So the point is, if ompi_mpi_comm_parent == &ompi_mpi_comm_null
we do not know whether we have to decrease the ref count for
those three objects or not. Since this is a constant, non-increasing
amount of memory, we stick with the current solution for now,
namely don't do anything.
*/
}
/* Shut down MPI_COMM_NULL */
OBJ_DESTRUCT( &ompi_mpi_comm_null );
/* Check whether we have some communicators left */
max = opal_pointer_array_get_size(&ompi_mpi_communicators);
for ( i=3; i<max; i++ ) {
comm = (ompi_communicator_t *)opal_pointer_array_get_item(&ompi_mpi_communicators, i);
if ( NULL != comm ) {
/* Communicator has not been freed before finalize */
OBJ_RELEASE(comm);
comm=(ompi_communicator_t *)opal_pointer_array_get_item(&ompi_mpi_communicators, i);
if ( NULL != comm ) {
/* Still here ? */
if ( !OMPI_COMM_IS_EXTRA_RETAIN(comm)) {
/* For communicator that have been marked as "extra retain", we do not further
* enforce to decrease the reference counter once more. These "extra retain"
* communicators created e.g. by the hierarch or inter module did increase
* the reference count by one more than other communicators, on order to
* allow for deallocation with the parent communicator. Note, that
* this only occurs if the cid of the local_comm is lower than of its
* parent communicator. Read the comment in comm_activate for
* a full explanation.
*/
if ( ompi_debug_show_handle_leaks && !(OMPI_COMM_IS_FREED(comm)) ){
opal_output(0,"WARNING: MPI_Comm still allocated in MPI_Finalize\n");
ompi_comm_dump ( comm);
OBJ_RELEASE(comm);
}
}
}
}
}
OBJ_DESTRUCT (&ompi_mpi_communicators);
OBJ_DESTRUCT (&ompi_comm_f_to_c_table);
/* finalize communicator requests */
ompi_comm_request_fini ();
return OMPI_SUCCESS;
}
/********************************************************************************/
/********************************************************************************/
/********************************************************************************/
/* static functions */
static void ompi_comm_construct(ompi_communicator_t* comm)
{
comm->c_f_to_c_index = opal_pointer_array_add(&ompi_comm_f_to_c_table, comm);
comm->c_name[0] = '\0';
comm->c_contextid = MPI_UNDEFINED;
comm->c_id_available = MPI_UNDEFINED;
comm->c_id_start_index = MPI_UNDEFINED;
comm->c_flags = 0;
comm->c_my_rank = 0;
comm->c_cube_dim = 0;
comm->c_local_group = NULL;
comm->c_remote_group = NULL;
comm->error_handler = NULL;
comm->c_pml_comm = NULL;
comm->c_topo = NULL;
/* A keyhash will be created if/when an attribute is cached on
this communicator */
comm->c_keyhash = NULL;
comm->errhandler_type = OMPI_ERRHANDLER_TYPE_COMM;
#ifdef OMPI_WANT_PERUSE
comm->c_peruse_handles = NULL;
#endif
/* Need to zero out the collectives module because we sometimes
call coll_unselect without a matching call to coll_select, and
we need an easy way for the coll base code to realize we've
done this. */
memset(&comm->c_coll, 0, sizeof(mca_coll_base_comm_coll_t));
}
static void ompi_comm_destruct(ompi_communicator_t* comm)
{
/* Note that the attributes were already released on this
communicator in ompi_comm_free() (i.e., from MPI_COMM_FREE /
MPI_COMM_DISCONNECT). See the lengthy comment in
communicator/comm.c in ompi_comm_free() for the reasons why. */
/* Release the collective module */
if ( MPI_COMM_NULL != comm ) {
mca_coll_base_comm_unselect(comm);
}
/* Tell the PML that this communicator is done.
MCA_PML_CALL(add_comm()) was called explicitly in
ompi_comm_init() when setting up COMM_WORLD and COMM_SELF; it's
called in ompi_comm_set() for all others. This means that all
communicators must be destroyed before the PML shuts down.
Also -- do not invoke the pml_del_comm if the corresponding
pml_add_comm was never invoked. This can happen in an error
situation where, for example, attributes do not copy properly
from one communicator to another and we end up destroying the
new communication while propagating the error up the stack. We
want to make it all the way up the stack to invoke the MPI
exception, not cause a seg fault in pml_del_comm because it was
never pml_add_com'ed. */
if ( MPI_COMM_NULL != comm && OMPI_COMM_IS_PML_ADDED(comm) ) {
MCA_PML_CALL(del_comm (comm));
}
/* Release topology module */
if (NULL != comm->c_topo) {
OBJ_RELEASE(comm->c_topo);
comm->c_topo = NULL;
}
if (NULL != comm->c_local_group) {
OBJ_RELEASE ( comm->c_local_group );
comm->c_local_group = NULL;
if ( OMPI_COMM_IS_INTRA(comm) ) {
/* We have to decrement the ref count on the remote group
even if it is identical to the local one in case of
intra-comm */
OBJ_RELEASE ( comm->c_remote_group );
comm->c_remote_group = NULL;
}
}
if (NULL != comm->c_remote_group) {
OBJ_RELEASE ( comm->c_remote_group );
comm->c_remote_group = NULL;
}
if (NULL != comm->error_handler) {
OBJ_RELEASE ( comm->error_handler );
comm->error_handler = NULL;
}
/* mark this cid as available */
if ( MPI_UNDEFINED != (int)comm->c_contextid &&
NULL != opal_pointer_array_get_item(&ompi_mpi_communicators,
comm->c_contextid)) {
opal_pointer_array_set_item ( &ompi_mpi_communicators,
comm->c_contextid, NULL);
}
/* reset the ompi_comm_f_to_c_table entry */
if ( MPI_UNDEFINED != comm->c_f_to_c_index &&
NULL != opal_pointer_array_get_item(&ompi_comm_f_to_c_table,
comm->c_f_to_c_index)) {
opal_pointer_array_set_item ( &ompi_comm_f_to_c_table,
comm->c_f_to_c_index, NULL);
}
}

268
ompi/communicator/comm_request.c Обычный файл
Просмотреть файл

@ -0,0 +1,268 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
* reseved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2004-2016 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "comm_request.h"
#include "opal/class/opal_free_list.h"
#include "opal/include/opal/sys/atomic.h"
static opal_free_list_t ompi_comm_requests;
static opal_list_t ompi_comm_requests_active;
static opal_mutex_t ompi_comm_request_mutex;
bool ompi_comm_request_progress_active = false;
bool ompi_comm_request_initialized = false;
typedef struct ompi_comm_request_item_t {
opal_list_item_t super;
ompi_comm_request_callback_fn_t callback;
ompi_request_t *subreqs[OMPI_COMM_REQUEST_MAX_SUBREQ];
int subreq_count;
} ompi_comm_request_item_t;
OBJ_CLASS_DECLARATION(ompi_comm_request_item_t);
static int ompi_comm_request_progress (void);
void ompi_comm_request_init (void)
{
OBJ_CONSTRUCT(&ompi_comm_requests, opal_free_list_t);
(void) opal_free_list_init (&ompi_comm_requests, sizeof (ompi_comm_request_t), 8,
OBJ_CLASS(ompi_comm_request_t), 0, 0, 0, -1, 8,
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&ompi_comm_requests_active, opal_list_t);
ompi_comm_request_progress_active = false;
OBJ_CONSTRUCT(&ompi_comm_request_mutex, opal_mutex_t);
ompi_comm_request_initialized = true;
}
void ompi_comm_request_fini (void)
{
if (!ompi_comm_request_initialized) {
return;
}
ompi_comm_request_initialized = false;
opal_mutex_lock (&ompi_comm_request_mutex);
if (ompi_comm_request_progress_active) {
opal_progress_unregister (ompi_comm_request_progress);
}
opal_mutex_unlock (&ompi_comm_request_mutex);
OBJ_DESTRUCT(&ompi_comm_request_mutex);
OBJ_DESTRUCT(&ompi_comm_requests_active);
OBJ_DESTRUCT(&ompi_comm_requests);
}
int ompi_comm_request_schedule_append (ompi_comm_request_t *request, ompi_comm_request_callback_fn_t callback,
ompi_request_t *subreqs[], int subreq_count)
{
ompi_comm_request_item_t *request_item;
int i;
if (subreq_count > OMPI_COMM_REQUEST_MAX_SUBREQ) {
return OMPI_ERR_BAD_PARAM;
}
request_item = OBJ_NEW(ompi_comm_request_item_t);
if (NULL == request_item) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
request_item->callback = callback;
for (i = 0 ; i < subreq_count ; ++i) {
request_item->subreqs[i] = subreqs[i];
}
request_item->subreq_count = subreq_count;
opal_list_append (&request->schedule, &request_item->super);
return OMPI_SUCCESS;
}
static int ompi_comm_request_progress (void)
{
ompi_comm_request_t *request, *next;
static int32_t progressing = 0;
/* don't allow re-entry */
if (opal_atomic_swap_32 (&progressing, 1)) {
return 0;
}
opal_mutex_lock (&ompi_comm_request_mutex);
OPAL_LIST_FOREACH_SAFE(request, next, &ompi_comm_requests_active, ompi_comm_request_t) {
int rc = OMPI_SUCCESS;
if (opal_list_get_size (&request->schedule)) {
ompi_comm_request_item_t *request_item = (ompi_comm_request_item_t *) opal_list_remove_first (&request->schedule);
int item_complete = true;
/* don't call ompi_request_test_all as it causes a recursive call into opal_progress */
while (request_item->subreq_count) {
ompi_request_t *subreq = request_item->subreqs[request_item->subreq_count-1];
if( REQUEST_COMPLETE(subreq) ) {
ompi_request_free (&subreq);
request_item->subreq_count--;
} else {
item_complete = false;
break;
}
}
if (item_complete) {
if (request_item->callback) {
opal_mutex_unlock (&ompi_comm_request_mutex);
rc = request_item->callback (request);
opal_mutex_lock (&ompi_comm_request_mutex);
}
OBJ_RELEASE(request_item);
} else {
opal_list_prepend (&request->schedule, &request_item->super);
}
}
/* if the request schedule is empty then the request is complete */
if (0 == opal_list_get_size (&request->schedule)) {
opal_list_remove_item (&ompi_comm_requests_active, (opal_list_item_t *) request);
request->super.req_status.MPI_ERROR = (OMPI_SUCCESS == rc) ? MPI_SUCCESS : MPI_ERR_INTERN;
ompi_request_complete (&request->super, true);
}
}
if (0 == opal_list_get_size (&ompi_comm_requests_active)) {
/* no more active requests. disable this progress function */
ompi_comm_request_progress_active = false;
opal_progress_unregister (ompi_comm_request_progress);
}
opal_mutex_unlock (&ompi_comm_request_mutex);
progressing = 0;
return 1;
}
void ompi_comm_request_start (ompi_comm_request_t *request)
{
opal_mutex_lock (&ompi_comm_request_mutex);
opal_list_append (&ompi_comm_requests_active, (opal_list_item_t *) request);
/* check if we need to start the communicator request progress function */
if (!ompi_comm_request_progress_active) {
opal_progress_register (ompi_comm_request_progress);
ompi_comm_request_progress_active = true;
}
request->super.req_state = OMPI_REQUEST_ACTIVE;
opal_mutex_unlock (&ompi_comm_request_mutex);
}
static int ompi_comm_request_cancel (struct ompi_request_t *ompi_req, int complete)
{
ompi_comm_request_t *tmp, *request = (ompi_comm_request_t *) ompi_req;
ompi_comm_request_item_t *item, *next;
opal_mutex_lock (&ompi_comm_request_mutex);
OPAL_LIST_FOREACH_SAFE(item, next, &request->schedule, ompi_comm_request_item_t) {
for (int i = 0 ; i < item->subreq_count ; ++i) {
ompi_request_cancel (item->subreqs[i]);
}
opal_list_remove_item (&request->schedule, &item->super);
OBJ_RELEASE(item);
}
/* remove the request for the list of active requests */
OPAL_LIST_FOREACH(tmp, &ompi_comm_requests_active, ompi_comm_request_t) {
if (tmp == request) {
opal_list_remove_item (&ompi_comm_requests_active, (opal_list_item_t *) request);
break;
}
}
opal_mutex_unlock (&ompi_comm_request_mutex);
return MPI_ERR_REQUEST;
}
static int ompi_comm_request_free (struct ompi_request_t **ompi_req)
{
ompi_comm_request_t *request = (ompi_comm_request_t *) *ompi_req;
if( !REQUEST_COMPLETE(*ompi_req) ) {
return MPI_ERR_REQUEST;
}
OMPI_REQUEST_FINI(*ompi_req);
ompi_comm_request_return (request);
*ompi_req = MPI_REQUEST_NULL;
return OMPI_SUCCESS;
}
static void ompi_comm_request_construct (ompi_comm_request_t *request)
{
request->context = NULL;
request->super.req_type = OMPI_REQUEST_COMM;
request->super.req_status._cancelled = 0;
request->super.req_free = ompi_comm_request_free;
request->super.req_cancel = ompi_comm_request_cancel;
OBJ_CONSTRUCT(&request->schedule, opal_list_t);
}
static void ompi_comm_request_destruct (ompi_comm_request_t *request)
{
OBJ_DESTRUCT(&request->schedule);
}
OBJ_CLASS_INSTANCE(ompi_comm_request_t, ompi_request_t,
ompi_comm_request_construct,
ompi_comm_request_destruct);
OBJ_CLASS_INSTANCE(ompi_comm_request_item_t, opal_list_item_t, NULL, NULL);
ompi_comm_request_t *ompi_comm_request_get (void)
{
opal_free_list_item_t *item;
item = opal_free_list_get (&ompi_comm_requests);
if (OPAL_UNLIKELY(NULL == item)) {
return NULL;
}
OMPI_REQUEST_INIT((ompi_request_t *) item, false);
return (ompi_comm_request_t *) item;
}
void ompi_comm_request_return (ompi_comm_request_t *request)
{
if (request->context) {
OBJ_RELEASE (request->context);
}
OMPI_REQUEST_FINI(&request->super);
opal_free_list_return (&ompi_comm_requests, (opal_free_list_item_t *) request);
}

39
ompi/communicator/comm_request.h Обычный файл
Просмотреть файл

@ -0,0 +1,39 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
* reseved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#if !defined(OMPI_COMM_REQ_H)
#define OMPI_COMM_REQ_H
#include "opal/class/opal_list.h"
#include "ompi/request/request.h"
/* increase this number if more subrequests are needed */
#define OMPI_COMM_REQUEST_MAX_SUBREQ 2
typedef struct ompi_comm_request_t {
ompi_request_t super;
opal_object_t *context;
opal_list_t schedule;
} ompi_comm_request_t;
OBJ_CLASS_DECLARATION(ompi_comm_request_t);
typedef int (*ompi_comm_request_callback_fn_t) (ompi_comm_request_t *);
void ompi_comm_request_init (void);
void ompi_comm_request_fini (void);
int ompi_comm_request_schedule_append (ompi_comm_request_t *request, ompi_comm_request_callback_fn_t callback,
ompi_request_t *subreqs[], int subreq_count);
void ompi_comm_request_start (ompi_comm_request_t *request);
ompi_comm_request_t *ompi_comm_request_get (void);
void ompi_comm_request_return (ompi_comm_request_t *request);
#endif /* OMPI_COMM_REQ_H */

669
ompi/communicator/communicator.h Обычный файл
Просмотреть файл

@ -0,0 +1,669 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* 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-2010 University of Houston. All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2011-2013 Inria. All rights reserved.
* Copyright (c) 2011-2013 Universite Bordeaux 1
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef OMPI_COMMUNICATOR_H
#define OMPI_COMMUNICATOR_H
#include "ompi_config.h"
#include "opal/class/opal_object.h"
#include "ompi/errhandler/errhandler.h"
#include "opal/threads/mutex.h"
#include "ompi/communicator/comm_request.h"
#include "mpi.h"
#include "ompi/group/group.h"
#include "ompi/mca/coll/coll.h"
#include "ompi/info/info.h"
#include "ompi/proc/proc.h"
BEGIN_C_DECLS
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_communicator_t);
#define OMPI_COMM_INTER 0x00000001
#define OMPI_COMM_NAMEISSET 0x00000002
#define OMPI_COMM_INTRINSIC 0x00000004
#define OMPI_COMM_DYNAMIC 0x00000008
#define OMPI_COMM_ISFREED 0x00000010
#define OMPI_COMM_INVALID 0x00000020
#define OMPI_COMM_CART 0x00000100
#define OMPI_COMM_GRAPH 0x00000200
#define OMPI_COMM_DIST_GRAPH 0x00000400
#define OMPI_COMM_PML_ADDED 0x00001000
#define OMPI_COMM_EXTRA_RETAIN 0x00004000
/* some utility #defines */
#define OMPI_COMM_IS_INTER(comm) ((comm)->c_flags & OMPI_COMM_INTER)
#define OMPI_COMM_IS_INTRA(comm) (!((comm)->c_flags & OMPI_COMM_INTER))
#define OMPI_COMM_IS_CART(comm) ((comm)->c_flags & OMPI_COMM_CART)
#define OMPI_COMM_IS_GRAPH(comm) ((comm)->c_flags & OMPI_COMM_GRAPH)
#define OMPI_COMM_IS_DIST_GRAPH(comm) ((comm)->c_flags & OMPI_COMM_DIST_GRAPH)
#define OMPI_COMM_IS_INTRINSIC(comm) ((comm)->c_flags & OMPI_COMM_INTRINSIC)
#define OMPI_COMM_IS_FREED(comm) ((comm)->c_flags & OMPI_COMM_ISFREED)
#define OMPI_COMM_IS_DYNAMIC(comm) ((comm)->c_flags & OMPI_COMM_DYNAMIC)
#define OMPI_COMM_IS_INVALID(comm) ((comm)->c_flags & OMPI_COMM_INVALID)
#define OMPI_COMM_IS_PML_ADDED(comm) ((comm)->c_flags & OMPI_COMM_PML_ADDED)
#define OMPI_COMM_IS_EXTRA_RETAIN(comm) ((comm)->c_flags & OMPI_COMM_EXTRA_RETAIN)
#define OMPI_COMM_IS_TOPO(comm) (OMPI_COMM_IS_CART((comm)) || \
OMPI_COMM_IS_GRAPH((comm)) || \
OMPI_COMM_IS_DIST_GRAPH((comm)))
#define OMPI_COMM_SET_DYNAMIC(comm) ((comm)->c_flags |= OMPI_COMM_DYNAMIC)
#define OMPI_COMM_SET_INVALID(comm) ((comm)->c_flags |= OMPI_COMM_INVALID)
#define OMPI_COMM_SET_PML_ADDED(comm) ((comm)->c_flags |= OMPI_COMM_PML_ADDED)
#define OMPI_COMM_SET_EXTRA_RETAIN(comm) ((comm)->c_flags |= OMPI_COMM_EXTRA_RETAIN)
/* a set of special tags: */
/* to recognize an MPI_Comm_join in the comm_connect_accept routine. */
#define OMPI_COMM_ALLGATHER_TAG -31078
#define OMPI_COMM_BARRIER_TAG -31079
#define OMPI_COMM_ALLREDUCE_TAG -31080
/**
* Modes required for acquiring the new comm-id.
* The first (INTER/INTRA) indicates whether the
* input comm was an inter/intra-comm, the second
* whether the new communicator will be an inter/intra
* comm
*/
#define OMPI_COMM_CID_INTRA 0x00000020
#define OMPI_COMM_CID_INTER 0x00000040
#define OMPI_COMM_CID_INTRA_BRIDGE 0x00000080
#define OMPI_COMM_CID_INTRA_PMIX 0x00000100
#define OMPI_COMM_CID_GROUP 0x00000200
/**
* The block of CIDs allocated for MPI_COMM_WORLD
* and other communicators
*/
#define OMPI_COMM_BLOCK_WORLD 16
#define OMPI_COMM_BLOCK_OTHERS 8
/* A macro comparing two CIDs */
#define OMPI_COMM_CID_IS_LOWER(comm1,comm2) ( ((comm1)->c_contextid < (comm2)->c_contextid)? 1:0)
OMPI_DECLSPEC extern opal_pointer_array_t ompi_mpi_communicators;
OMPI_DECLSPEC extern opal_pointer_array_t ompi_comm_f_to_c_table;
struct ompi_communicator_t {
opal_object_t c_base;
opal_mutex_t c_lock; /* mutex for name and potentially
attributes */
char c_name[MPI_MAX_OBJECT_NAME];
uint32_t c_contextid;
int c_my_rank;
uint32_t c_flags; /* flags, e.g. intercomm,
topology, etc. */
int c_id_available; /* the currently available Cid for allocation
to a child*/
int c_id_start_index; /* the starting index of the block of cids
allocated to this communicator*/
ompi_group_t *c_local_group;
ompi_group_t *c_remote_group;
struct ompi_communicator_t *c_local_comm; /* a duplicate of the
local communicator in
case the comm is an
inter-comm*/
/* Attributes */
struct opal_hash_table_t *c_keyhash;
/**< inscribing cube dimension */
int c_cube_dim;
/* Standard information about the selected topology module (or NULL
if this is not a cart, graph or dist graph communicator) */
struct mca_topo_base_module_t* c_topo;
/* index in Fortran <-> C translation array */
int c_f_to_c_index;
#ifdef OMPI_WANT_PERUSE
/*
* Place holder for the PERUSE events.
*/
struct ompi_peruse_handle_t** c_peruse_handles;
#endif
/* Error handling. This field does not have the "c_" prefix so
that the OMPI_ERRHDL_* macros can find it, regardless of whether
it's a comm, window, or file. */
ompi_errhandler_t *error_handler;
ompi_errhandler_type_t errhandler_type;
/* Hooks for PML to hang things */
struct mca_pml_comm_t *c_pml_comm;
/* Collectives module interface and data */
mca_coll_base_comm_coll_t c_coll;
};
typedef struct ompi_communicator_t ompi_communicator_t;
/**
* Padded struct to maintain back compatibiltiy.
*
* The following ompi_predefined_xxx_t structure is used to maintain
* backwards binary compatibility for MPI applications compiled
* against one version of OMPI library but dynamically linked at
* runtime with another. The issue is between versions the actual
* structure may change in size (even between debug and optimized
* compilation -- the structure contents change, and therefore the
* overall size changes).
*
* This is problematic with predefined handles because the storage of
* the structure ends up being located to an application's BSS. This
* causes problems because if one version has the predefined as size X
* and then the application is dynamically linked with a version that
* has a size of Y (where X != Y) then the application will
* unintentionally overrun the memory initially allocated for the
* structure.
*
* The solution we are using below creates a parent structure
* (ompi_predefined_xxx_t) that contains the base structure
* (ompi_xxx_t) followed by a character padding that is the size of
* the total size we choose to preallocate for the structure minus the
* amount used by the base structure. In this way, we've normalized
* the size of each predefined handle across multiple versions and
* configurations of Open MPI (e.g., MPI_COMM_WORLD will refer to a
* back-end struct that is X bytes long, even if we change the
* back-end ompi_communicator_t between version A.B and version C.D in
* Open MPI). When we come close to filling up the the padding we can
* add a pointer at the back end of the base structure to point to an
* extension of the type. Or we can just increase the padding and
* break backwards binary compatibility.
*
* The above method was decided after several failed attempts
* described below.
*
* - Original implementation - suffered that the base structure seemed
* to always change in size between Open MPI versions and/or
* configurations (e.g., optimized vs. debugging build).
*
* - Convert all predefined handles to run-time-assigned pointers
* (i.e., global variables) - This worked except in cases where an MPI
* application wanted to assign the predefined handle value to a
* global variable -- we could not guarantee to have the global
* variable filled until MPI_INIT was called (recall that MPI
* predefined handles must be assignable before MPI_INIT; e.g.,
* "MPI_Comm foo = MPI_COMM_WORLD").
*
* - union of struct and padding - Similar to current implementation
* except using a union for the parent. This worked except in cases
* where the compilers did not support C99 union static initalizers.
* It would have been a pain to convert a bunch of the code to use
* non-static initializers (e.g., MPI datatypes).
*/
/* Define for the preallocated size of the predefined handle.
* Note that we are using a pointer type as the base memory chunk
* size so when the bitness changes the size of the handle changes.
* This is done so we don't end up needing a structure that is
* incredibly larger than necessary because of the bitness.
*/
#define PREDEFINED_COMMUNICATOR_PAD (sizeof(void*) * 192)
struct ompi_predefined_communicator_t {
struct ompi_communicator_t comm;
char padding[PREDEFINED_COMMUNICATOR_PAD - sizeof(ompi_communicator_t)];
};
typedef struct ompi_predefined_communicator_t ompi_predefined_communicator_t;
OMPI_DECLSPEC extern ompi_communicator_t *ompi_mpi_comm_parent;
OMPI_DECLSPEC extern ompi_predefined_communicator_t ompi_mpi_comm_world;
OMPI_DECLSPEC extern ompi_predefined_communicator_t ompi_mpi_comm_self;
OMPI_DECLSPEC extern ompi_predefined_communicator_t ompi_mpi_comm_null;
/*
* These variables are for the MPI F03 bindings (F03 must bind Fortran
* varaiables to symbols; it cannot bind Fortran variables to the
* address of a C variable).
*/
OMPI_DECLSPEC extern ompi_predefined_communicator_t *ompi_mpi_comm_world_addr;
OMPI_DECLSPEC extern ompi_predefined_communicator_t *ompi_mpi_comm_self_addr;
OMPI_DECLSPEC extern ompi_predefined_communicator_t *ompi_mpi_comm_null_addr;
/**
* Is this a valid communicator? This is a complicated question.
* :-)
*
* According to MPI-1:5.2.4 (p137):
*
* "The predefined constant MPI_COMM_NULL is the value used for
* invalid communicator handles."
*
* Hence, MPI_COMM_NULL is not valid. However, MPI-2:4.12.4 (p50)
* clearly states that the MPI_*_C2F and MPI_*_F2C functions
* should treat MPI_COMM_NULL as a valid communicator -- it
* distinctly differentiates between "invalid" handles and
* "MPI_*_NULL" handles. Some feel that the MPI-1 definition
* still holds for all other MPI functions; others feel that the
* MPi-2 definitions trump the MPI-1 definition. Regardless of
* who is right, there is ambiguity here. So we have left
* ompi_comm_invalid() as originally coded -- per the MPI-1
* definition, where MPI_COMM_NULL is an invalid communicator.
* The MPI_Comm_c2f() function, therefore, calls
* ompi_comm_invalid() but also explictily checks to see if the
* handle is MPI_COMM_NULL.
*/
static inline int ompi_comm_invalid(ompi_communicator_t* comm)
{
if ((NULL == comm) || (MPI_COMM_NULL == comm) ||
(OMPI_COMM_IS_FREED(comm)) || (OMPI_COMM_IS_INVALID(comm)) )
return true;
else
return false;
}
/**
* rank w/in the communicator
*/
static inline int ompi_comm_rank(ompi_communicator_t* comm)
{
return comm->c_my_rank;
}
/**
* size of the communicator
*/
static inline int ompi_comm_size(ompi_communicator_t* comm)
{
return comm->c_local_group->grp_proc_count;
}
/**
* size of the remote group for inter-communicators.
* returns zero for an intra-communicator
*/
static inline int ompi_comm_remote_size(ompi_communicator_t* comm)
{
return (comm->c_flags & OMPI_COMM_INTER ? comm->c_remote_group->grp_proc_count : 0);
}
/**
* Context ID for the communicator, suitable for passing to
* ompi_comm_lookup for getting the communicator back
*/
static inline uint32_t ompi_comm_get_cid(ompi_communicator_t* comm)
{
return comm->c_contextid;
}
/* return pointer to communicator associated with context id cid,
* No error checking is done*/
static inline ompi_communicator_t *ompi_comm_lookup(uint32_t cid)
{
/* array of pointers to communicators, indexed by context ID */
return (ompi_communicator_t*)opal_pointer_array_get_item(&ompi_mpi_communicators, cid);
}
static inline struct ompi_proc_t* ompi_comm_peer_lookup(ompi_communicator_t* comm, int peer_id)
{
#if OPAL_ENABLE_DEBUG
if(peer_id >= comm->c_remote_group->grp_proc_count) {
opal_output(0, "ompi_comm_peer_lookup: invalid peer index (%d)", peer_id);
return (struct ompi_proc_t *) NULL;
}
#endif
/*return comm->c_remote_group->grp_proc_pointers[peer_id];*/
return ompi_group_peer_lookup(comm->c_remote_group,peer_id);
}
static inline bool ompi_comm_peer_invalid(ompi_communicator_t* comm, int peer_id)
{
if(peer_id < 0 || peer_id >= comm->c_remote_group->grp_proc_count) {
return true;
}
return false;
}
/**
* Initialise MPI_COMM_WORLD and MPI_COMM_SELF
*/
int ompi_comm_init(void);
/**
* extract the local group from a communicator
*/
OMPI_DECLSPEC int ompi_comm_group (ompi_communicator_t *comm, ompi_group_t **group);
/**
* create a communicator based on a group
*/
int ompi_comm_create (ompi_communicator_t* comm, ompi_group_t *group,
ompi_communicator_t** newcomm);
/**
* Non-collective create communicator based on a group
*/
int ompi_comm_create_group (ompi_communicator_t *comm, ompi_group_t *group, int tag,
ompi_communicator_t **newcomm);
/**
* Take an almost complete communicator and reserve the CID as well
* as activate it (initialize the collective and the topologies).
*/
int ompi_comm_enable(ompi_communicator_t *old_comm,
ompi_communicator_t *new_comm,
int new_rank,
int num_procs,
ompi_proc_t** topo_procs);
/**
* Back end of MPI_DIST_GRAPH_CREATE_ADJACENT
*/
int ompi_topo_dist_graph_create_adjacent(ompi_communicator_t *old_comm,
int indegree, int sources[],
int sourceweights[], int outdegree,
int destinations[], int destweights[],
MPI_Info info, int reorder,
MPI_Comm *comm_dist_graph);
/**
* split a communicator based on color and key. Parameters
* are identical to the MPI-counterpart of the function.
*
* @param comm: input communicator
* @param color
* @param key
*
* @
*/
OMPI_DECLSPEC int ompi_comm_split (ompi_communicator_t *comm, int color, int key,
ompi_communicator_t** newcomm, bool pass_on_topo);
/**
* split a communicator based on type and key. Parameters
* are identical to the MPI-counterpart of the function.
*
* @param comm: input communicator
* @param color
* @param key
*
* @
*/
OMPI_DECLSPEC int ompi_comm_split_type(ompi_communicator_t *comm,
int split_type, int key,
struct ompi_info_t *info,
ompi_communicator_t** newcomm);
/**
* dup a communicator. Parameter are identical to the MPI-counterpart
* of the function. It has been extracted, since we need to be able
* to dup a communicator internally as well.
*
* @param comm: input communicator
* @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected.
*/
OMPI_DECLSPEC int ompi_comm_dup (ompi_communicator_t *comm, ompi_communicator_t **newcomm);
/**
* dup a communicator (non-blocking). Parameter are identical to the MPI-counterpart
* of the function. It has been extracted, since we need to be able
* to dup a communicator internally as well.
*
* @param comm: input communicator
* @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected.
*/
OMPI_DECLSPEC int ompi_comm_idup (ompi_communicator_t *comm, ompi_communicator_t **newcomm, ompi_request_t **request);
/**
* dup a communicator with info. Parameter are identical to the MPI-counterpart
* of the function. It has been extracted, since we need to be able
* to dup a communicator internally as well.
*
* @param comm: input communicator
* @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected.
*/
OMPI_DECLSPEC int ompi_comm_dup_with_info (ompi_communicator_t *comm, ompi_info_t *info, ompi_communicator_t **newcomm);
/**
* dup a communicator (non-blocking) with info.
* of the function. It has been extracted, since we need to be able
* to dup a communicator internally as well.
*
* @param comm: input communicator
* @param newcomm: the new communicator or MPI_COMM_NULL if any error is detected.
*/
OMPI_DECLSPEC int ompi_comm_idup_with_info (ompi_communicator_t *comm, ompi_info_t *info, ompi_communicator_t **newcomm, ompi_request_t **req);
/**
* compare two communicators.
*
* @param comm1,comm2: input communicators
*
*/
int ompi_comm_compare(ompi_communicator_t *comm1, ompi_communicator_t *comm2, int *result);
/**
* free a communicator
*/
OMPI_DECLSPEC int ompi_comm_free (ompi_communicator_t **comm);
/**
* allocate a new communicator structure
* @param local_group_size
* @param remote_group_size
*
* This routine allocates the structure, the according local and
* remote groups, the proc-arrays in the local and remote group.
* It furthermore sets the fortran index correctly,
* and sets all other elements to zero.
*/
ompi_communicator_t* ompi_comm_allocate (int local_group_size,
int remote_group_size);
/**
* allocate new communicator ID
* @param newcomm: pointer to the new communicator
* @param oldcomm: original comm
* @param bridgecomm: bridge comm for intercomm_create
* @param mode: combination of input
* OMPI_COMM_CID_INTRA: intra-comm
* OMPI_COMM_CID_INTER: inter-comm
* OMPI_COMM_CID_GROUP: only decide CID within the ompi_group_t
* associated with the communicator. arg0
* must point to an int which will be used
* as the pml tag for communication.
* OMPI_COMM_CID_INTRA_BRIDGE: 2 intracomms connected by
* a bridge comm. arg0 and arg1 must point
* to integers representing the local and
* remote leader ranks. the remote leader rank
* is a rank in the bridgecomm.
* OMPI_COMM_CID_INTRA_PMIX: 2 intracomms, leaders talk
* through PMIx. arg0 must point to an integer
* representing the local leader rank. arg1
* must point to a string representing the
* port of the remote leader.
* @param send_first: to avoid a potential deadlock for
* the OOB version.
* This routine has to be thread safe in the final version.
*/
OMPI_DECLSPEC int ompi_comm_nextcid (ompi_communicator_t *newcomm, ompi_communicator_t *comm,
ompi_communicator_t *bridgecomm, const void *arg0, const void *arg1,
bool send_first, int mode);
/**
* allocate new communicator ID (non-blocking)
* @param newcomm: pointer to the new communicator
* @param oldcomm: original comm
* @param bridgecomm: bridge comm for intercomm_create
* @param mode: combination of input
* OMPI_COMM_CID_INTRA: intra-comm
* OMPI_COMM_CID_INTER: inter-comm
* This routine has to be thread safe in the final version.
*/
OMPI_DECLSPEC int ompi_comm_nextcid_nb (ompi_communicator_t *newcomm, ompi_communicator_t *comm,
ompi_communicator_t *bridgecomm, const void *arg0, const void *arg1,
bool send_first, int mode, ompi_request_t **req);
/**
* shut down the communicator infrastructure.
*/
int ompi_comm_finalize (void);
/**
* This is THE routine, where all the communicator stuff
* is really set.
*
* @param[out] newcomm new ompi communicator object
* @param[in] oldcomm old communicator
* @param[in] local_size size of local_ranks array
* @param[in] local_ranks local ranks (not used if local_group != NULL)
* @param[in] remote_size size of remote_ranks array
* @param[in] remote_ranks remote ranks (intercomm) (not used if remote_group != NULL)
* @param[in] attr attributes (can be NULL)
* @param[in] errh error handler
* @param[in] copy_topocomponent whether to copy the topology
* @param[in] local_group local process group (may be NULL if local_ranks array supplied)
* @param[in] remote_group remote process group (may be NULL)
*/
OMPI_DECLSPEC int ompi_comm_set ( ompi_communicator_t** newcomm,
ompi_communicator_t* oldcomm,
int local_size,
int *local_ranks,
int remote_size,
int *remote_ranks,
opal_hash_table_t *attr,
ompi_errhandler_t *errh,
bool copy_topocomponent,
ompi_group_t *local_group,
ompi_group_t *remote_group );
/**
* This is THE routine, where all the communicator stuff
* is really set. Non-blocking version.
*
* @param[out] newcomm new ompi communicator object
* @param[in] oldcomm old communicator
* @param[in] local_size size of local_ranks array
* @param[in] local_ranks local ranks (not used if local_group != NULL)
* @param[in] remote_size size of remote_ranks array
* @param[in] remote_ranks remote ranks (intercomm) (not used if remote_group != NULL)
* @param[in] attr attributes (can be NULL)
* @param[in] errh error handler
* @param[in] copy_topocomponent whether to copy the topology
* @param[in] local_group local process group (may be NULL if local_ranks array supplied)
* @param[in] remote_group remote process group (may be NULL)
* @param[out] req ompi_request_t object for tracking completion
*/
OMPI_DECLSPEC int ompi_comm_set_nb ( ompi_communicator_t **ncomm,
ompi_communicator_t *oldcomm,
int local_size,
int *local_ranks,
int remote_size,
int *remote_ranks,
opal_hash_table_t *attr,
ompi_errhandler_t *errh,
bool copy_topocomponent,
ompi_group_t *local_group,
ompi_group_t *remote_group,
ompi_request_t **req );
/**
* This is a short-hand routine used in intercomm_create.
* The routine makes sure, that all processes have afterwards
* a list of ompi_proc_t pointers for the remote group.
*/
struct ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm,
ompi_communicator_t *bridge_comm,
int local_leader,
int remote_leader,
int tag,
int rsize);
/**
* This routine verifies, whether local_group and remote group are overlapping
* in intercomm_create
*/
int ompi_comm_overlapping_groups (int size, struct ompi_proc_t ** lprocs,
int rsize, struct ompi_proc_t ** rprocs);
/**
* This is a routine determining whether the local or the
* remote group will be first in the new intra-comm.
* Just used from within MPI_Intercomm_merge.
*/
int ompi_comm_determine_first ( ompi_communicator_t *intercomm,
int high );
OMPI_DECLSPEC int ompi_comm_activate (ompi_communicator_t **newcomm, ompi_communicator_t *comm,
ompi_communicator_t *bridgecomm, const void *arg0,
const void *arg1, bool send_first, int mode);
/**
* Non-blocking variant of comm_activate.
*
* @param[inout] newcomm New communicator
* @param[in] comm Parent communicator
* @param[in] bridgecomm Bridge communicator (used for PMIX and bridge modes)
* @param[in] arg0 Mode argument 0
* @param[in] arg1 Mode argument 1
* @param[in] send_first Send first from this process (PMIX mode only)
* @param[in] mode Collective mode
* @param[out] req New request object to track this operation
*/
OMPI_DECLSPEC int ompi_comm_activate_nb (ompi_communicator_t **newcomm, ompi_communicator_t *comm,
ompi_communicator_t *bridgecomm, const void *arg0,
const void *arg1, bool send_first, int mode, ompi_request_t **req);
/**
* a simple function to dump the structure
*/
int ompi_comm_dump ( ompi_communicator_t *comm );
/* setting name */
int ompi_comm_set_name (ompi_communicator_t *comm, const char *name );
/* global variable to save the number od dynamic communicators */
extern int ompi_comm_num_dyncomm;
/* check whether any of the processes has requested support for
MPI_THREAD_MULTIPLE. Note, that this produces global
information across MPI_COMM_WORLD, in contrary to the local
flag ompi_mpi_thread_provided
*/
OMPI_DECLSPEC int ompi_comm_cid_init ( void );
END_C_DECLS
#endif /* OMPI_COMMUNICATOR_H */

19
ompi/contrib/README.txt Обычный файл
Просмотреть файл

@ -0,0 +1,19 @@
This is the OMPI contrib system. It is (far) less functional and
flexible than the OMPI MCA framework/component system.
Each contrib package must have a configure.m4. It may optionally also
have an autogen.subdirs file.
If it has a configure.m4 file, it must specify its own relevant files
to AC_CONFIG_FILES to create during AC_OUTPUT -- just like MCA
components (at a minimum, usually its own Makefile). The configure.m4
file will be slurped up into the main configure script, just like
other MCA components. Note that there is currently no "no configure"
option for contrib packages -- you *must* have a configure.m4 (even if
all it does it call $1). Feel free to fix this situation if you want
-- it probably won't not be too difficult to extend autogen.pl to
support this scenario, similar to how it is done for MCA components.
:-)
If it has an autogen.subdirs file, then it needs to be a subdirectory
that is autogen-able.

46
ompi/contrib/libompitrace/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,46 @@
# -*- makefile -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
lib_LTLIBRARIES = libompitrace.la
libompitrace_la_SOURCES = \
abort.c \
accumulate.c \
add_error_class.c \
add_error_code.c \
add_error_string.c \
address.c \
allgather.c \
allgatherv.c \
alloc_mem.c \
allreduce.c \
barrier.c \
bcast.c \
finalize.c \
init.c \
isend.c \
recv.c \
reduce.c \
request_free.c \
send.c \
sendrecv.c
libompitrace_la_LDFLAGS = -version-info $(libompitrace_so_version)

39
ompi/contrib/libompitrace/abort.c Обычный файл
Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
int MPI_Abort(MPI_Comm comm, int errorcode)
{
char commname[MPI_MAX_OBJECT_NAME];
int len;
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
PMPI_Comm_get_name(comm, commname, &len);
fprintf(stderr, "MPI_ABORT[%d]: comm %s errorcode %d\n", rank, commname, errorcode);
fflush(stderr);
return PMPI_Abort(comm, errorcode);
}

55
ompi/contrib/libompitrace/accumulate.c Обычный файл
Просмотреть файл

@ -0,0 +1,55 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Sun Microsystmes, Inc. All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/op/op.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
int target_rank, MPI_Aint target_disp, int target_count,
MPI_Datatype target_datatype, MPI_Op op, MPI_Win win)
{
char typename[MPI_MAX_OBJECT_NAME], target_dt[MPI_MAX_OBJECT_NAME];
char winname[MPI_MAX_OBJECT_NAME];
int len;
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
PMPI_Type_get_name(origin_datatype, typename, &len);
PMPI_Type_get_name(target_datatype, target_dt, &len);
PMPI_Win_get_name(win, winname, &len);
fprintf(stderr, "MPI_ACCUMULATE[%d]: origin_addr %0" PRIxPTR " origin_count %d origin_datatype %s\n"
"\ttarget_rank %d target_disp %" PRIdPTR " target_count %d target_datatype %s op %s win %s\n",
rank, (uintptr_t)origin_addr, origin_count, typename, target_rank, (intptr_t) target_disp,
target_count, target_dt, op->o_name, winname);
fflush(stderr);
return PMPI_Accumulate(origin_addr, origin_count, origin_datatype,
target_rank, target_disp, target_count,
target_datatype, op, win);
}

38
ompi/contrib/libompitrace/add_error_class.c Обычный файл
Просмотреть файл

@ -0,0 +1,38 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 University of Houston. All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Add_error_class(int *errorclass)
{
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
fprintf(stderr, "MPI_ADD_ERROR_CLASS[%d]: errorclass %0" PRIxPTR "\n", rank, (uintptr_t)errorclass);
fflush(stderr);
return PMPI_Add_error_class(errorclass);
}

37
ompi/contrib/libompitrace/add_error_code.c Обычный файл
Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 University of Houston. All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Add_error_code(int errorclass, int *errorcode)
{
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
fprintf(stderr, "MPI_ADD_ERROR_CODE[%d]: errorclass %d errcode %0" PRIxPTR "\n", rank, errorclass, (uintptr_t)errorcode);
fflush(stderr);
return PMPI_Add_error_code(errorclass, errorcode);
}

Просмотреть файл

@ -0,0 +1,39 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 University of Houston. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
int MPI_Add_error_string(int errorcode, const char *string)
{
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
fprintf(stderr, "MPI_ADD_ERROR_STRING[%d]: errorcode %d string %s\n",
rank, errorcode, string);
fflush(stderr);
return PMPI_Add_error_string(errorcode, string);
}

39
ompi/contrib/libompitrace/address.c Обычный файл
Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Address(void *location, MPI_Aint *address)
{
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
fprintf(stderr, "MPI_ADDRESS[%d]: location %0" PRIxPTR " address %0" PRIxPTR "\n",
rank, (uintptr_t)location, (uintptr_t)address);
fflush(stderr);
return PMPI_Address(location, address);
}

51
ompi/contrib/libompitrace/allgather.c Обычный файл
Просмотреть файл

@ -0,0 +1,51 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, int recvcount, MPI_Datatype recvtype,
MPI_Comm comm)
{
char sendtypename[MPI_MAX_OBJECT_NAME], recvtypename[MPI_MAX_OBJECT_NAME];
char commname[MPI_MAX_OBJECT_NAME];
int len;
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
PMPI_Type_get_name(sendtype, sendtypename, &len);
PMPI_Type_get_name(recvtype, recvtypename, &len);
PMPI_Comm_get_name(comm, commname, &len);
fprintf(stderr, "MPI_ALLGATHER[%d]: sendbuf %0" PRIxPTR " sendcount %d sendtype %s\n\trecvbuf %0" PRIxPTR " recvcount %d recvtype %s comm %s\n",
rank, (uintptr_t) sendbuf, sendcount, sendtypename, (uintptr_t) recvbuf, recvcount, recvtypename, commname);
fflush(stderr);
return PMPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
}

51
ompi/contrib/libompitrace/allgatherv.c Обычный файл
Просмотреть файл

@ -0,0 +1,51 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, const int recvcounts[], const int displs[],
MPI_Datatype recvtype, MPI_Comm comm)
{
char sendtypename[MPI_MAX_OBJECT_NAME], recvtypename[MPI_MAX_OBJECT_NAME];
char commname[MPI_MAX_OBJECT_NAME];
int len;
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
PMPI_Type_get_name(sendtype, sendtypename, &len);
PMPI_Type_get_name(recvtype, recvtypename, &len);
PMPI_Comm_get_name(comm, commname, &len);
fprintf(stderr, "MPI_ALLGATHERV[%d]: sendbuf %0" PRIxPTR " sendcount %d sendtype %s\n\trecvbuf %0" PRIxPTR " recvtype %s comm %s\n",
rank, (uintptr_t) sendbuf, sendcount, sendtypename, (uintptr_t) recvbuf, recvtypename, commname);
fflush(stderr);
return PMPI_Allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
}

38
ompi/contrib/libompitrace/alloc_mem.c Обычный файл
Просмотреть файл

@ -0,0 +1,38 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr)
{
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
fprintf(stderr, "MPI_Alloc_mem[%d]: size %0ld\n", rank, (long)size);
fflush(stderr);
return PMPI_Alloc_mem(size, info, baseptr);
}

47
ompi/contrib/libompitrace/allreduce.c Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/op/op.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
{
char typename[MPI_MAX_OBJECT_NAME], commname[MPI_MAX_OBJECT_NAME];
int len;
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
PMPI_Type_get_name(datatype, typename, &len);
PMPI_Comm_get_name(comm, commname, &len);
fprintf(stderr, "MPI_ALLREDUCE[%d]: sendbuf %0" PRIxPTR " recvbuf %0" PRIxPTR " count %d datatype %s op %s comm %s\n",
rank, (uintptr_t)sendbuf, (uintptr_t)recvbuf, count, typename, op->o_name, commname);
fflush(stderr);
return PMPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
}

39
ompi/contrib/libompitrace/barrier.c Обычный файл
Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
int MPI_Barrier(MPI_Comm comm)
{
char commname[MPI_MAX_OBJECT_NAME];
int len;
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
PMPI_Comm_get_name(comm, commname, &len);
fprintf(stderr, "MPI_BARRIER[%d]: comm %s\n", rank, commname);
fflush(stderr);
return PMPI_Barrier(comm);
}

45
ompi/contrib/libompitrace/bcast.c Обычный файл
Просмотреть файл

@ -0,0 +1,45 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype,
int root, MPI_Comm comm)
{
char typename[MPI_MAX_OBJECT_NAME], commname[MPI_MAX_OBJECT_NAME];
int len;
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
PMPI_Type_get_name(datatype, typename, &len);
PMPI_Comm_get_name(comm, commname, &len);
fprintf(stderr, "MPI_BCAST[%d]: buffer %0" PRIxPTR " count %d datatype %s root %d comm %s\n",
rank, (uintptr_t) buffer, count, typename, root, commname);
fflush(stderr);
return PMPI_Bcast(buffer, count, datatype, root, comm);
}

27
ompi/contrib/libompitrace/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,27 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# OMPI_contrib_libompitrace_CONFIG([action-if-can-compile],
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([OMPI_contrib_libompitrace_CONFIG],[
AC_CONFIG_FILES([ompi/contrib/libompitrace/Makefile])
$1
])dnl

36
ompi/contrib/libompitrace/finalize.c Обычный файл
Просмотреть файл

@ -0,0 +1,36 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
int MPI_Finalize(void)
{
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
fprintf(stderr, "MPI_FINALIZE[%d]\n", rank);
fflush(stderr);
return PMPI_Finalize();
}

33
ompi/contrib/libompitrace/init.c Обычный файл
Просмотреть файл

@ -0,0 +1,33 @@
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2008 Sun Microsystems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
int MPI_Init(int *argc, char ***argv)
{
fprintf(stderr, "MPI_INIT: argc %d\n", (0 < *argc) ? *argc : 0);
fflush(stderr);
return PMPI_Init(argc, argv);
}

47
ompi/contrib/libompitrace/isend.c Обычный файл
Просмотреть файл

@ -0,0 +1,47 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2005 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "opal_stdint.h"
#include "ompi/mpi/c/bindings.h"
int MPI_Isend(const void *buf, int count, MPI_Datatype type, int dest,
int tag, MPI_Comm comm, MPI_Request *request)
{
char typename[MPI_MAX_OBJECT_NAME], commname[MPI_MAX_OBJECT_NAME];
int len;
int rank;
PMPI_Comm_rank(MPI_COMM_WORLD, &rank);
PMPI_Type_get_name(type, typename, &len);
PMPI_Comm_get_name(comm, commname, &len);
fprintf(stderr, "MPI_ISEND[%d]: buf %0" PRIxPTR " count %d datatype %s dest %d tag %d comm %s\n",
rank, (uintptr_t) buf, count, typename, dest, tag, commname);
fflush(stderr);
return PMPI_Isend(buf, count, type, dest, tag, comm, request);
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше