1
1

- massive change for module<-->component name fixes throughout the

code base.
  - many (most) mca type names have "component" or "module" in them,
    as relevant, just to further distinguish the difference between
    component data/actions and module data/actions.  All developers
    are encouraged to perpetuate this convention when you create
    types that are specific to a framework, component, or module
  - did very little to entire framework (just the basics to make it
    compile) because it's just about to be almost entirely replaced
  - ditto for io / romio
  - did not work on elan or ib components; have to commit and then
    convert those on a different machine with the right libraries and
    headers
- renamed a bunch of *_module.c files to *_component.c and *module*c
  to *component*c (a few still remain, e.g., ptl/ib, ptl/elan, etc.)
- modified autogen/configure/build process to match new filenames
  (e.g., output static-components.h instead of static-modules.h)
- removed DOS-style cr/lf stuff in ns/ns.h
- added newline to end of file src/util/numtostr.h
- removed some redundant error checking in the top-level topo
  functions
- added a few {} here and there where people "forgot" to put them in
  for 1 line blocks ;-)
- removed a bunch of MPI_* types from mca header files (replaced with
  corresponding ompi_* types)
- all the ptl components had version numbers in their structs; removed
- converted a few more elements in the MCA base to use the OBJ
  interface -- removed some old manual reference counting kruft

This commit was SVN r1830.
Этот коммит содержится в:
Jeff Squyres 2004-08-02 00:24:22 +00:00
родитель dc997f438b
Коммит eb8cba98af
186 изменённых файлов: 4510 добавлений и 4405 удалений

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

@ -42,7 +42,8 @@ sinclude(config/ompi_config_solaris_threads.m4)
sinclude(config/ompi_config_threads.m4)
#
# The config/mca_no_configure_modules.m4 file is generated by autogen.sh
# The config/mca_no_configure_components.m4 file is generated by
# autogen.sh
#
sinclude(config/mca_no_configure_modules.m4)
sinclude(config/mca_no_configure_components.m4)

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

@ -40,7 +40,7 @@ ompi_autoconf=""
ompi_libtoolize=""
ompi_automake=""
mca_no_configure_modules_file="config/mca_no_configure_modules.m4"
mca_no_configure_components_file="config/mca_no_configure_components.m4"
mca_no_config_list_file="mca_no_config_list"
mca_no_config_amc_file="mca_no_config_amc"
@ -289,7 +289,7 @@ run_gnu_tools() {
EOF
"$rgt_ompi_topdir/config/mca_make_configure.pl" \
--ompidir "$rgt_ompi_topdir" \
--moduledir "`pwd`"
--componentdir "`pwd`"
if test "$?" != "0"; then
echo "*** autogen.sh failed to complete!"
exit 1
@ -335,7 +335,7 @@ EOF
run_and_check $ompi_autoconf
# We only need the libltdl stuff for the top-level
# configure, not any of the MCA modules.
# configure, not any of the MCA components.
if test -f include/mpi.h; then
rm -rf libltdl src/libltdl src/ltdl.h
@ -464,9 +464,9 @@ EOF
*** Nothing to do -- skipping this directory
EOF
else
pd_module_name="`basename $pd_dir`"
pd_module_type="`dirname $pd_dir`"
pd_module_type="`basename $pd_module_type`"
pd_component_name="`basename $pd_dir`"
pd_component_type="`dirname $pd_dir`"
pd_component_type="`basename $pd_component_type`"
pd_ver_file="`grep PARAM_VERSION_FILE configure.params`"
if test -z "$pd_ver_file"; then
pd_ver_file="VERSION"
@ -482,14 +482,14 @@ EOF
cat >> $pd_list_file <<EOF
dnl ----------------------------------------------------------------
dnl No-configure module:
dnl No-configure component:
dnl $pd_dir
EOF
cat >> $pd_amc_file <<EOF
dnl ----------------------------------------------------------------
dnl No-configure module:
dnl No-configure component:
dnl $pd_dir
EOF
@ -510,7 +510,7 @@ EOF
pd_ver_svn="`echo $pd_ver | cut -d: -f7`"
cat >> $pd_list_file <<EOF
MCA_${pd_module_type}_NO_CONFIGURE_SUBDIRS="$pd_dir \$MCA_${pd_module_type}_NO_CONFIGURE_SUBDIRS"
MCA_${pd_component_type}_NO_CONFIGURE_SUBDIRS="$pd_dir \$MCA_${pd_component_type}_NO_CONFIGURE_SUBDIRS"
dnl Since AM_CONDITIONAL does not accept a variable name as its first
dnl argument, we generate it here, and the variable used in the test
@ -519,32 +519,32 @@ dnl will be filled in later.
dnl Similarly, AC_DEFINE_UNQUOTED doesn't take a variable first
dnl argument. So we have to figure it out here.
AC_DEFINE_UNQUOTED(MCA_${pd_module_type}_${pd_module_name}_MAJOR_VERSION,
AC_DEFINE_UNQUOTED(MCA_${pd_component_type}_${pd_component_name}_MAJOR_VERSION,
$pd_ver_major,
[Major OMPI MCA $pd_module_type $pd_module_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_module_type}_${pd_module_name}_MINOR_VERSION,
[Major OMPI MCA $pd_component_type $pd_component_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_component_type}_${pd_component_name}_MINOR_VERSION,
$pd_ver_minor,
[Minor OMPI MCA $pd_module_type $pd_module_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_module_type}_${pd_module_name}_RELEASE_VERSION,
[Minor OMPI MCA $pd_component_type $pd_component_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_component_type}_${pd_component_name}_RELEASE_VERSION,
$pd_ver_release,
[Release OMPI MCA $pd_module_type $pd_module_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_module_type}_${pd_module_name}_ALPHA_VERSION,
[Release OMPI MCA $pd_component_type $pd_component_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_component_type}_${pd_component_name}_ALPHA_VERSION,
$pd_ver_alpha,
[Alpha OMPI MCA $pd_module_type $pd_module_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_module_type}_${pd_module_name}_BETA_VERSION,
[Alpha OMPI MCA $pd_component_type $pd_component_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_component_type}_${pd_component_name}_BETA_VERSION,
$pd_ver_beta,
[Beta OMPI MCA $pd_module_type $pd_module_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_module_type}_${pd_module_name}_SVN_VERSION,
[Beta OMPI MCA $pd_component_type $pd_component_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_component_type}_${pd_component_name}_SVN_VERSION,
"$pd_ver_svn",
[SVN OMPI MCA $pd_module_type $pd_module_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_module_type}_${pd_module_name}_FULL_VERSION,
[SVN OMPI MCA $pd_component_type $pd_component_name version])
AC_DEFINE_UNQUOTED(MCA_${pd_component_type}_${pd_component_name}_FULL_VERSION,
"$pd_ver_full",
[Full OMPI MCA $pd_module_type $pd_module_name version])
[Full OMPI MCA $pd_component_type $pd_component_name version])
EOF
cat >> $pd_amc_file <<EOF
AM_CONDITIONAL(OMPI_BUILD_${pd_module_type}_${pd_module_name}_DSO,
test "\$BUILD_${pd_module_type}_${pd_module_name}_DSO" = "1")
AM_CONDITIONAL(OMPI_BUILD_${pd_component_type}_${pd_component_name}_DSO,
test "\$BUILD_${pd_component_type}_${pd_component_name}_DSO" = "1")
EOF
@ -568,13 +568,13 @@ EOF
cd "$pd_cur_dir"
fi
unset pd_dir pd_ompi_topdir pd_cur_dir pd_module_type
unset pd_dir pd_ompi_topdir pd_cur_dir pd_component_type
}
##############################################################################
#
# run_global - run the config in the top OMPI dir and all MCA modules
# run_global - run the config in the top OMPI dir and all MCA components
#
# INPUT:
# none
@ -586,11 +586,11 @@ EOF
#
##############################################################################
run_global() {
# [Re-]Create the mca_module_list file
# [Re-]Create the mca_component_list file
rm -f "$mca_no_configure_modules_file" "$mca_no_config_list_file" \
rm -f "$mca_no_configure_components_file" "$mca_no_config_list_file" \
"$mca_no_config_amc_file"
touch "$mca_no_configure_modules_file" "$mca_no_config_list_file" \
touch "$mca_no_configure_components_file" "$mca_no_config_list_file" \
"$mca_no_config_amc_file"
# Now run the config in every directory in src/mca/*/*
@ -600,12 +600,12 @@ run_global() {
echo $rg_cwd
for type in src/mca/*; do
if test -d "$type"; then
for module in "$type"/*; do
if test -d "$module"; then
if test -f "$module/configure.in" -o \
-f "$module/configure.params" -o \
-f "$module/configure.ac"; then
process_dir "$module" "$rg_cwd"
for component in "$type"/*; do
if test -d "$component"; then
if test -f "$component/configure.in" -o \
-f "$component/configure.params" -o \
-f "$component/configure.ac"; then
process_dir "$component" "$rg_cwd"
fi
fi
done
@ -614,7 +614,7 @@ run_global() {
# Fill in the final m4 file
cat > "$mca_no_configure_modules_file" <<EOF
cat > "$mca_no_configure_components_file" <<EOF
dnl
dnl \$HEADER
dnl
@ -622,10 +622,10 @@ dnl
dnl This file is automatically created by autogen.sh; it should not
dnl be edited by hand!!
dnl List all the no-configure modules that we found, and AC_DEFINE
dnl List all the no-configure components that we found, and AC_DEFINE
dnl their versions
AC_DEFUN([MCA_FIND_NO_CONFIGURE_MODULES],[
AC_DEFUN([MCA_FIND_NO_CONFIGURE_COMPONENTS],[
MCA_cofs_NO_CONFIGURE_SUBDIRS=""
MCA_pcm_NO_CONFIGURE_SUBDIRS=""
MCA_gpr_NO_CONFIGURE_SUBDIRS=""
@ -643,11 +643,11 @@ MCA_topo_NO_CONFIGURE_SUBDIRS=""
])dnl
dnl Separately have the AM_CONDITIONALS as to whether we build the
dnl modules static or shared. This must be done separately from the
dnl components static or shared. This must be done separately from the
dnl list because we have to do it late in the configure script, after
dnl all the test variable values have been set.
AC_DEFUN([MCA_AMC_NO_CONFIGURE_MODULES],[
AC_DEFUN([MCA_AMC_NO_CONFIGURE_COMPONENTS],[
`cat $mca_no_config_amc_file`
])dnl
EOF
@ -655,12 +655,12 @@ EOF
rm -f $mca_no_config_list_file $mca_no_config_amc_file
# Finally, after we found all the no-configure MCA modules, run
# Finally, after we found all the no-configure MCA components, run
# the config in the top-level directory
process_dir . .
unset type module
unset type component
}
@ -701,13 +701,13 @@ EOF
sleep 5
fi
# figure out if we're at the top level of the OMPI tree, a module's
# figure out if we're at the top level of the OMPI tree, a component's
# top-level directory, or somewhere else.
if test -f VERSION -a -f configure.ac -a -f include/mpi.h ; then
# Top level of OMPI tree
ompidir="`pwd`"
elif test -f configure.in -o -f configure.ac -o -f configure.params ; then
# Top level of a module directory
# Top level of a component directory
want_local=yes
if test -z "$ompidir"; then
ompidir="../../../.."
@ -716,7 +716,7 @@ else
cat <<EOF
You must run this script from either the top level of the OMPI
directory tree or the top-level of an MCA module directory tree.
directory tree or the top-level of an MCA component directory tree.
EOF
exit 1

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

@ -28,7 +28,7 @@ sinclude(../../../../config/cxx_find_template_parameters.m4)
dnl
dnl This will be replaced with s_i_n_c_l_u_d_e(configure.stub) if it
dnl exists for that module, or a blank line if it does not.
dnl exists for that component, or a blank line if it does not.
dnl
@CONFIGURE_STUB_SINCLUDE@

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

@ -14,32 +14,32 @@ AC_INIT(@PARAM_INIT_FILE@)
AC_PREREQ(2.57)
AC_CONFIG_AUX_DIR(@PARAM_CONFIG_AUX_DIR@)
# Get the version of @MCA_TYPE@ @MCA_MODULE_NAME@ that we are installing.
# Get the version of @MCA_TYPE@ @MCA_COMPONENT_NAME@ that we are installing.
if test -n "@PARAM_VERSION_FILE@" -a -f "@PARAM_VERSION_FILE@"; then
OMPI_GET_VERSION(@PARAM_VERSION_FILE@, @PARAM_VAR_PREFIX@)
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_MAJOR_VERSION,
$@PARAM_VAR_PREFIX@_MAJOR_VERSION,
[Major OMPI MCA @MCA_TYPE@ @MCA_MODULE_NAME@ version])
[Major OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_MINOR_VERSION,
$@PARAM_VAR_PREFIX@_MINOR_VERSION,
[Minor OMPI MCA @MCA_TYPE@ @MCA_MODULE_NAME@ version])
[Minor OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_RELEASE_VERSION,
$@PARAM_VAR_PREFIX@_RELEASE_VERSION,
[Release OMPI MCA @MCA_TYPE@ @MCA_MODULE_NAME@ version])
[Release OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_ALPHA_VERSION,
$@PARAM_VAR_PREFIX@_ALPHA_VERSION,
[Alpha OMPI MCA @MCA_TYPE@ @MCA_MODULE_NAME@ version])
[Alpha OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_BETA_VERSION,
$@PARAM_VAR_PREFIX@_BETA_VERSION,
[Beta OMPI MCA @MCA_TYPE@ @MCA_MODULE_NAME@ version])
[Beta OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_CVS_VERSION,
$@PARAM_VAR_PREFIX@_CVS_VERSION,
[CVS OMPI MCA @MCA_TYPE@ @MCA_MODULE_NAME@ version])
[CVS OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_VERSION,
"$@PARAM_VAR_PREFIX@_VERSION",
[Overall OMPI MCA @MCA_TYPE@ @MCA_MODULE_NAME@ version number])
[Overall OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version number])
version_string="version $@PARAM_VAR_PREFIX@_VERSION"
else
version_string=""
@ -50,7 +50,7 @@ fi
#
OMPI_CONFIGURE_SETUP
ompi_show_title "Configuring MCA @MCA_TYPE@ @MCA_MODULE_NAME@ module $version_string"
ompi_show_title "Configuring MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ component $version_string"
ompi_show_subtitle "Initialization, setup"
#
@ -61,14 +61,14 @@ ompi_show_subtitle "Initialization, setup"
AM_INIT_AUTOMAKE(@PARAM_AM_NAME@, $@PARAM_VAR_PREFIX@_VERSION, 'no')
# Setup the top-level MCA module config.h file
# Setup the top-level MCA component config.h file
AH_TOP([/* -*- c -*-
*
* $HEADER$
*
* Open MPI configuation header file.
* MCA @MCA_TYPE@: @MCA_MODULE_NAME@ module
* MCA @MCA_TYPE@: @MCA_COMPONENT_NAME@ component
*/
#ifndef @PARAM_VAR_PREFIX@_CONFIG_H
@ -90,18 +90,18 @@ OMPI_BASIC_SETUP
# Check to see if the user wants this @MCA_TYPE@ to be the default
#
AC_MSG_CHECKING([if want the @MCA_MODULE_NAME@ @MCA_TYPE@ to be the default])
AC_MSG_CHECKING([if want the @MCA_COMPONENT_NAME@ @MCA_TYPE@ to be the default])
want_default=0
result=no
AC_ARG_WITH(@PROCESSED_MCA_TYPE@,
AC_HELP_STRING([--with-@PROCESSED_MCA_TYPE@=name],
[if name is "@MCA_MODULE_NAME@", the @MCA_MODULE_NAME@ @MCA_TYPE@ will be the default]))
if test "$with_@PROCESSED_MCA_TYPE@" = "@MCA_MODULE_NAME@"; then
[if name is "@MCA_COMPONENT_NAME@", the @MCA_COMPONENT_NAME@ @MCA_TYPE@ will be the default]))
if test "$with_@PROCESSED_MCA_TYPE@" = "@MCA_COMPONENT_NAME@"; then
want_default=1
result=yes
fi
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_DEFAULT, $want_default,
[Whether the @MCA_MODULE_NAME@ @MCA_TYPE@ is the default @PROCESSED_MCA_TYPE@ or not])
[Whether the @MCA_COMPONENT_NAME@ @MCA_TYPE@ is the default @PROCESSED_MCA_TYPE@ or not])
AC_MSG_RESULT([$result])
#
@ -113,7 +113,7 @@ AM_DISABLE_STATIC
#
# Find which modules should be built as run-time loadable modules
# Find which components should be built as run-time loadable components
# Acceptable combinations:
#
# [default -- no option given]
@ -126,7 +126,7 @@ AM_DISABLE_STATIC
AC_MSG_CHECKING([if want component to be a DSO])
AC_ARG_ENABLE(mca-dso,
AC_HELP_STRING([--enable-mca-dso=LIST],
[comma-separated list of types and/or type-component pairs that will be built as run-time loadable modules (as opposed to statically linked in), if supported on this platform. The default is to build all components as DSOs; the --disable-mca-dso[=LIST] form can be used to disable building all or some types/components as DSOs]. If LIST is "@MCA_TYPE@-@MCA_MODULE_NAME@" or "@MCA_MODULENAME@", then @MCA_MODULE_NAME@ will be compiled as a DSO (if supported on this platform).))
[comma-separated list of types and/or type-component pairs that will be built as run-time loadable components (as opposed to statically linked in), if supported on this platform. The default is to build all components as DSOs; the --disable-mca-dso[=LIST] form can be used to disable building all or some types/components as DSOs]. If LIST is "@MCA_TYPE@-@MCA_COMPONENT_NAME@" or "@MCA_COMPONENTNAME@", then @MCA_COMPONENT_NAME@ will be compiled as a DSO (if supported on this platform).))
# Manual conversion of $kind to its generic name (e.g., crmpi->cr,
# crompi->cr).
@ -143,22 +143,22 @@ crompi)
;;
esac
BUILD_@MCA_TYPE@_@MCA_MODULE_NAME@_DSO=0
BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO=0
msg=no
if test "$enable_shared" = "no"; then
msg=no
elif test -z "$enable_mca_dso" -o "$enable_mca_dso" = "yes" -o \
"$enable_mca_dso" = "@MCA_TYPE@" -o "$enable_mca_dso" = "$generic_type"; then
BUILD_@MCA_TYPE@_@MCA_MODULE_NAME@_DSO=1
BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO=1
msg=yes
else
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
for item in $enable_mca_dso; do
if test "$item" = "@MCA_TYPE@-@MCA_MODULE_NAME@" -o \
if test "$item" = "@MCA_TYPE@-@MCA_COMPONENT_NAME@" -o \
"$item" = "@MCA_TYPE@" -o "$item" = "$generic_type"; then
BUILD_@MCA_TYPE@_@MCA_MODULE_NAME@_DSO=1
BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO=1
msg=yes
fi
done
@ -297,7 +297,7 @@ AC_SUBST(top_ompi_srcdir)
AC_SUBST(top_ompi_builddir)
##################################
# @MCA_TYPE@ @MCA_MODULE_NAME@ module specific setup
# @MCA_TYPE@ @MCA_COMPONENT_NAME@ component specific setup
##################################
#
@ -387,8 +387,8 @@ AC_SUBST(CXXCPPFLAGS)
ompi_show_subtitle "GNU libtool setup"
AM_PROG_LIBTOOL
AM_CONDITIONAL(OMPI_BUILD_@MCA_TYPE@_@MCA_MODULE_NAME@_DSO,
test "$BUILD_@MCA_TYPE@_@MCA_MODULE_NAME@_DSO" = "1")
AM_CONDITIONAL(OMPI_BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO,
test "$BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO" = "1")
############################################################################

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

@ -14,12 +14,12 @@ use File::Basename;
############################################################################
my $ompi_topdir;
my $module_topdir;
my $component_topdir;
my %config_values;
my %config_params;
my $initial_cwd = cwd();
my $announce_str = "OMPI/MPI MCA module configure generator";
my $announce_str = "OMPI/MPI MCA component configure generator";
my %config_param_names = (PIFILE => "PARAM_INIT_FILE",
PCFGAUXDIR => "PARAM_CONFIG_AUX_DIR",
PC => "PARAM_WANT_C",
@ -37,14 +37,14 @@ my %config_param_names = (PIFILE => "PARAM_INIT_FILE",
Getopt::Long::Configure("bundling", "require_order");
my $ok = Getopt::Long::GetOptions("ompidir|l=s" => \$ompi_topdir,
"moduledir|m=s" => \$module_topdir);
"componentdir|m=s" => \$component_topdir);
if (!$ok) {
print "Usage: $0 [--ompidir=DIR] [--moduledir=DIR]\n";
print "Usage: $0 [--ompidir=DIR] [--componentdir=DIR]\n";
exit(1);
}
############################################################################
# Try to figure out the ompi and module topdirs
# Try to figure out the ompi and component topdirs
############################################################################
print "$announce_str starting\n";
@ -59,42 +59,42 @@ if (!$ompi_topdir || ! -f "$ompi_topdir/autogen.sh") {
croak("Unable to find OMPI base directory (try using --ompidir)");
}
if (!$module_topdir) {
$module_topdir = $initial_cwd;
if ($module_topdir eq $ompi_topdir) {
croak("Unable to determine which module to operate on");
if (!$component_topdir) {
$component_topdir = $initial_cwd;
if ($component_topdir eq $ompi_topdir) {
croak("Unable to determine which component to operate on");
}
}
chdir($module_topdir);
$module_topdir = cwd();
chdir($component_topdir);
$component_topdir = cwd();
chdir($initial_cwd);
if (!$ompi_topdir || ! -d $module_topdir) {
croak("Unable to find module directory (try using --moduledir)");
if (!$ompi_topdir || ! -d $component_topdir) {
croak("Unable to find component directory (try using --componentdir)");
}
# Print them out
print "--> Found OMPI top dir: $ompi_topdir\n";
print "--> Found module top dir: $module_topdir\n";
print "--> Found component top dir: $component_topdir\n";
# If we have a configure.params file in the module topdir, we're good to
# If we have a configure.params file in the component topdir, we're good to
# go.
if (! -f "$module_topdir/configure.params") {
die("No configure.params in module topdir; nothing to do");
if (! -f "$component_topdir/configure.params") {
die("No configure.params in component topdir; nothing to do");
}
# Make a backup
if (-f "$module_topdir/acinclude.m4") {
printf(" *** WARNING: Replacing old acinclude.m4 in $module_topdir\n");
unlink("$module_topdir/acinclude.m4.bak");
rename("$module_topdir/acinclude.m4", "$module_topdir/acinclude.m4.bak");
if (-f "$component_topdir/acinclude.m4") {
printf(" *** WARNING: Replacing old acinclude.m4\n");
unlink("$component_topdir/acinclude.m4.bak");
rename("$component_topdir/acinclude.m4", "$component_topdir/acinclude.m4.bak");
}
if (-f "$module_topdir/configure.ac") {
printf(" *** WARNING: Replacing old configure.ac in $module_topdir\n");
unlink("$module_topdir/configure.ac.bak");
rename("$module_topdir/configure.ac", "$module_topdir/configure.ac.bak");
if (-f "$component_topdir/configure.ac") {
printf(" *** WARNING: Replacing old configure.ac\n");
unlink("$component_topdir/configure.ac.bak");
rename("$component_topdir/configure.ac", "$component_topdir/configure.ac.bak");
}
############################################################################
@ -104,7 +104,7 @@ if (-f "$module_topdir/configure.ac") {
# Unchangeable values
# MCA_TYPE: calculate
$config_values{"MCA_TYPE"} = dirname($module_topdir);
$config_values{"MCA_TYPE"} = dirname($component_topdir);
$config_values{"MCA_TYPE"} = basename($config_values{"MCA_TYPE"});
# PROCESSED_MCA_TYPE: For "special" MCA types, like "crompi" and
@ -118,12 +118,12 @@ if ($config_values{"PROCESSED_MCA_TYPE"} eq "crompi" ||
# MCA_NAME: calculate
$config_values{"MCA_MODULE_NAME"} = basename($module_topdir);
$config_values{"MCA_COMPONENT_NAME"} = basename($component_topdir);
# Parameter (changeable) values
# PARAM_CONFIG_AUX_DIR: set
if (-d "$module_topdir/config") {
if (-d "$component_topdir/config") {
$config_params{$config_param_names{PCFGAUXDIR}} = "config";
} else {
$config_params{$config_param_names{PCFGAUXDIR}} = ".";
@ -133,9 +133,9 @@ $config_params{$config_param_names{PCXX}} = 0;
# PARAM_VERSION_FILE: calculate
if (-f "$module_topdir/VERSION") {
if (-f "$component_topdir/VERSION") {
$config_params{$config_param_names{PVERFILE}} = "\$srcdir/VERSION";
} elsif (-f "$module_topdir/$config_params{$config_param_names{PCFGAUXDIR}}/VERSION") {
} elsif (-f "$component_topdir/$config_params{$config_param_names{PCFGAUXDIR}}/VERSION") {
$config_params{$config_param_names{PVERFILE}} =
"\$srcdir/$config_params{$config_param_names{PCFGAUXDIR}}/VERSION";
}
@ -144,36 +144,36 @@ if (-f "$module_topdir/VERSION") {
$config_params{$config_param_names{PVARPREFIX}} =
"MCA_" . uc($config_values{"MCA_TYPE"}) .
"_" . uc($config_values{"MCA_MODULE_NAME"});
"_" . uc($config_values{"MCA_COMPONENT_NAME"});
# PARAM_AM_NAME: calculate
$config_params{$config_param_names{PAMNAME}} =
lc($config_values{"MCA_TYPE"}) .
"-" . lc($config_values{"MCA_MODULE_NAME"});
"-" . lc($config_values{"MCA_COMPONENT_NAME"});
# PARAM_CONFIG_HEADER_FILE: calculate
$config_params{$config_param_names{PCFGHDRFILE}} =
"src/" . lc($config_values{"MCA_TYPE"}) .
"_" . lc($config_values{"MCA_MODULE_NAME"}) . "_config.h";
"_" . lc($config_values{"MCA_COMPONENT_NAME"}) . "_config.h";
# Is there a config.stub file in the module topdir?
# Is there a config.stub file in the component topdir?
if (-f "$module_topdir/configure.stub") {
if (-f "$component_topdir/configure.stub") {
$config_values{CONFIGURE_STUB_SINCLUDE} = "#
# Module-specific tests
# Component-specific tests
#
sinclude(configure.stub)\n";
$config_values{CONFIGURE_STUB_MACRO} =
"ompi_show_subtitle \"MCA " . $config_values{"MCA_TYPE"} . " " .
$config_values{"MCA_MODULE_NAME"} . "-specific setup\"
$config_values{"MCA_COMPONENT_NAME"} . "-specific setup\"
MCA_CONFIGURE_STUB";
# See if there's a CONFIGURE_DIST_STUB in configure.stub
open(STUB, "$module_topdir/configure.stub");
open(STUB, "$component_topdir/configure.stub");
my $found = 0;
while (<STUB>) {
$found = 1
@ -183,7 +183,7 @@ MCA_CONFIGURE_STUB";
if ($found == 1) {
$config_values{CONFIGURE_DIST_STUB_MACRO} =
"ompi_show_subtitle \"MCA " . $config_values{"MCA_TYPE"} . " " .
$config_values{"MCA_MODULE_NAME"} .
$config_values{"MCA_COMPONENT_NAME"} .
"-specific setup (dist specific!)\"
MCA_CONFIGURE_DIST_STUB";
} else {
@ -202,8 +202,8 @@ MCA_CONFIGURE_DIST_STUB";
my $found = 0;
my @names = values %config_param_names;
open(PARAMS, "$module_topdir/configure.params") ||
die("Could not open configure.params in $module_topdir");
open(PARAMS, "$component_topdir/configure.params") ||
die("Could not open configure.params in $component_topdir");
while (<PARAMS>) {
chomp;
@ -226,7 +226,7 @@ while (<PARAMS>) {
for (my $i = 0; $i <= $#names; ++$i) {
if ($key eq $names[$i]) {
if (!$found) {
printf("--> Found parameter override:\n");
printf("--> Found parameter override(s):\n");
$found = 1;
}
printf(" $key = $value\n");
@ -340,9 +340,9 @@ sub make_template {
# Read and fill in the templates
make_template("$ompi_topdir/config/mca_configure.ac",
"$module_topdir/configure.ac", 0644);
"$component_topdir/configure.ac", 0644);
make_template("$ompi_topdir/config/mca_acinclude.m4",
"$module_topdir/acinclude.m4", 0644);
"$component_topdir/acinclude.m4", 0644);
############################################################################
# All done

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

@ -5,7 +5,7 @@ dnl
AC_DEFUN([OMPI_MCA],[
# Find which modules should be built as run-time loadable modules
# Find which components should be built as run-time loadable components
# Acceptable combinations:
#
# [default -- no option given]
@ -15,10 +15,10 @@ AC_DEFUN([OMPI_MCA],[
# --disable-mca-dso
#
AC_MSG_CHECKING([which modules should be run-time loadable])
AC_MSG_CHECKING([which components should be run-time loadable])
AC_ARG_ENABLE(mca-dso,
AC_HELP_STRING([--enable-mca-dso=LIST],
[comma-separated list of types and/or type-component pairs that will be built as run-time loadable modules (as opposed to statically linked in), if supported on this platform. The default is to build all components as DSOs; the --disable-mca-dso[=LIST] form can be used to disable building all or some types/components as DSOs]))
[comma-separated list of types and/or type-component pairs that will be built as run-time loadable components (as opposed to statically linked in), if supported on this platform. The default is to build all components as DSOs; the --disable-mca-dso[=LIST] form can be used to disable building all or some types/components as DSOs]))
# First, check to see if we're only building static libraries. If so,
# then override everything and only build components as static
@ -58,23 +58,23 @@ AC_MSG_CHECKING([for MCA types])
found_types="allocator coll common gpr io mpool ns one oob op pcm pml ptl topo"
AC_MSG_RESULT([$found_types])
# Get the list of all the non-configure MCA modules that were found by
# Get the list of all the non-configure MCA components that were found by
# autogen.sh.
# config/mca_no_configure_modules.m4
MCA_FIND_NO_CONFIGURE_MODULES
# config/mca_no_configure_components.m4
MCA_FIND_NO_CONFIGURE_COMPONENTS
# Now determine the configurable modules in each of the types. This
# Now determine the configurable components in each of the types. This
# is a little redundant and could be combined into
# MCA_FIND_NO_CONFIGURE_MODULES, but we separate it out for clarity.
# The extern statements and array of pointers to the module global
# MCA_FIND_NO_CONFIGURE_COMPONENTS, but we separate it out for clarity.
# The extern statements and array of pointers to the component global
# structs are written to a file for each type that is #include'd in
# the file for each type.
for type in $found_types; do
all_modules=
static_modules=
dso_modules=
all_components=
static_components=
dso_components=
static_ltlibs=
# Ensure that the directory where the #include file is to live
@ -103,7 +103,7 @@ for type in $found_types; do
# Remove any previous generated #include files
outfile=$outdir/static-modules.h
outfile=$outdir/static-components.h
rm -f $outfile $outfile.struct $outfile.extern \
$outfile.all $outfile.static $outfile.dyanmic
touch $outfile.struct $outfile.extern \
@ -125,27 +125,27 @@ for type in $found_types; do
;;
esac
# Iterate through the list of no-configure modules
# Iterate through the list of no-configure components
foo="found_modules=\$MCA_${type}_NO_CONFIGURE_SUBDIRS"
foo="found_components=\$MCA_${type}_NO_CONFIGURE_SUBDIRS"
eval $foo
for module in $found_modules; do
m=`basename "$module"`
for component in $found_components; do
m=`basename "$component"`
if test -d $srcdir/$module -a ! -f $srcdir/$module/.ompi_ignore; then
ompi_show_subtitle "MCA module $type:$m (no configure script)"
if test -d $srcdir/$component -a ! -f $srcdir/$component/.ompi_ignore; then
ompi_show_subtitle "MCA component $type:$m (no configure script)"
# Remove any possible sym link in the mca-dynamic tree
rm -f src/dynamic-mca/$type/$m
# Now process the module
# Now process the component
MCA_PROCESS_MODULE(1, 1, $type, $m)
MCA_PROCESS_COMPONENT(1, 1, $type, $m)
# Note that the AM_CONDITIONAL for this module is set in
# config/mca_no_configure_modules.m4 -- which is generated by
# Note that the AM_CONDITIONAL for this component is set in
# config/mca_no_configure_components.m4 -- which is generated by
# autogen.sh because we cannot have a variable
# AM_CONDITIONAL name (which we need here). Since
# autogen.sh knows the name that is necessary, it just
@ -162,16 +162,16 @@ for type in $found_types; do
fi
done
# Find all configureable modules, run their configure scripts,
# Find all configureable components, run their configure scripts,
# etc.
for module in $srcdir/src/mca/$type/*; do
for component in $srcdir/src/mca/$type/*; do
FOUND=0
HAPPY=0
m="`basename $module`"
if test -d $module -a -x $module/configure -a \
! -f $module/.ompi_ignore; then
ompi_show_subtitle "MCA module $type:$m (need to configure)"
m="`basename $component`"
if test -d $component -a -x $component/configure -a \
! -f $component/.ompi_ignore; then
ompi_show_subtitle "MCA component $type:$m (need to configure)"
# We found one!
@ -181,31 +181,31 @@ for type in $found_types; do
rm -f src/dyanmic-mca/$type/$m
# Configure the module subdirectory
# Configure the component subdirectory
OMPI_CONFIG_SUBDIR([src/mca/$type/$m],
[$ompi_subdir_args],
[HAPPY=1], [HAPPY=0])
fi
# Process this module
# Process this component
MCA_PROCESS_MODULE($FOUND, $HAPPY, $type, $m)
MCA_PROCESS_COMPONENT($FOUND, $HAPPY, $type, $m)
done
# m4 weirdness: must also do the echo after the sort, or we get a
# string with newlines in it
all_modules="`sort $outfile.all`"
all_modules="`echo $all_modules`"
static_modules="`sort $outfile.static`"
static_modules="`echo $static_modules`"
dso_modules="`sort $outfile.dso`"
dso_modules="`echo $dso_modules`"
all_components="`sort $outfile.all`"
all_components="`echo $all_components`"
static_components="`sort $outfile.static`"
static_components="`echo $static_components`"
dso_components="`sort $outfile.dso`"
dso_components="`echo $dso_components`"
rm -f $outfile $outfile.all $outfile.static $outfile.dso
# Create the final .h file that will be included in the type's
# top-level glue. This lists all the static modules.
# top-level glue. This lists all the static components.
cat > $outfile <<EOF
/*
@ -214,7 +214,7 @@ for type in $found_types; do
`cat $outfile.extern`
const mca_base_module_t *mca_${type}_base_static_modules[[]] = {
const mca_base_component_t *mca_${type}_base_static_components[[]] = {
`cat $outfile.struct`
NULL
};
@ -222,20 +222,20 @@ EOF
rm -f $outfile.struct $outfile.extern
# Save the results for the Makefile.am's. Note the whacky shell
# script escaping that is necessary because $modules may be
# script escaping that is necessary because $components may be
# multiple words, but we also need to substitute on ${type}...
foo="MCA_${type}_ALL_SUBDIRS"'="$all_modules"'
foo="MCA_${type}_ALL_SUBDIRS"'="$all_components"'
eval "$foo"
foo="MCA_${type}_STATIC_SUBDIRS"'="$static_modules"'
foo="MCA_${type}_STATIC_SUBDIRS"'="$static_components"'
eval "$foo"
foo="MCA_${type}_DSO_SUBDIRS"'="$dso_modules"'
foo="MCA_${type}_DSO_SUBDIRS"'="$dso_components"'
eval "$foo"
foo="MCA_${type}_STATIC_LTLIBS"'="$static_ltlibs"'
eval "$foo"
done
unset foo type m modules structs outfile outdir total_dir file \
all_modules static_modules dso_modules static_ltlibs
unset foo type m components structs outfile outdir total_dir file \
all_components static_components dso_components static_ltlibs
# Grumble. It seems that AC_SUBST and AC_DEFINE don't let you
# substitue on a variable name that contains a variable (e.g.,
@ -313,17 +313,17 @@ AC_SUBST(MCA_topo_DSO_SUBDIRS)
AC_SUBST(MCA_topo_STATIC_LTLIBS)
# Finally, now that we've filled in all the test variables, get all
# the AM_CONDITIONALs that indicate whether to build modules as shared
# the AM_CONDITIONALs that indicate whether to build components as shared
# or static.
# config/mca_no_configure_modules.m4
MCA_AMC_NO_CONFIGURE_MODULES])
# config/mca_no_configure_components.m4
MCA_AMC_NO_CONFIGURE_COMPONENTS])
dnl -----------------------------------------------------------------------
dnl -----------------------------------------------------------------------
dnl -----------------------------------------------------------------------
AC_DEFUN([MCA_PROCESS_MODULE],[
AC_DEFUN([MCA_PROCESS_COMPONENT],[
FOUND=$1
HAPPY=$2
type=$3
@ -334,22 +334,22 @@ m=$4
infile="src/mca/$type/$m/post_configure.sh"
# Did we find a valid module, and did its configure run
# Did we find a valid component, and did its configure run
# successfully?
if test "$HAPPY" = "1"; then
# Add this subdir to the mast list of all MCA module subdirs
# Add this subdir to the mast list of all MCA component subdirs
echo $m >> $outfile.all
# Is this module going to built staic or shared?
# Is this component going to built staic or shared?
str="SHARED_TYPE=\$DSO_$type"
eval $str
str="SHARED_GENERIC_TYPE=\$DSO_$generic_type"
eval $str
str="SHARED_MODULE=\$DSO_${type}_$m"
str="SHARED_COMPONENT=\$DSO_${type}_$m"
eval $str
shared_mode_override=static
@ -359,7 +359,7 @@ if test "$HAPPY" = "1"; then
if test "$shared_mode_override" = "dso" -o \
"$SHARED_TYPE" = "1" -o \
"$SHARED_GENERIC_TYPE" = "1" -o \
"$SHARED_MODULE" = "1" -o \
"$SHARED_COMPONENT" = "1" -o \
"$DSO_all" = "1"; then
compile_mode="dso"
echo $m >> $outfile.dso
@ -368,17 +368,17 @@ if test "$HAPPY" = "1"; then
"src/dynamic-mca/$type/$m"
else
static_ltlibs="$m/libmca_${type}_${m}.la $static_ltlibs"
echo "extern const mca_base_module_t mca_${type}_${m}_module;" >> $outfile.extern
echo " &mca_${type}_${m}_module, " >> $outfile.struct
echo "extern const mca_base_component_t mca_${type}_${m}_component;" >> $outfile.extern
echo " &mca_${type}_${m}_component, " >> $outfile.struct
compile_mode="static"
echo $m >> $outfile.static
fi
# Output pretty results
AC_MSG_CHECKING([if MCA module $type:$m can compile])
AC_MSG_CHECKING([if MCA component $type:$m can compile])
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for MCA module $type:$m compile mode])
AC_MSG_CHECKING([for MCA component $type:$m compile mode])
AC_MSG_RESULT([$compile_mode])
# If there's an output file, add the values to
@ -390,7 +390,7 @@ if test "$HAPPY" = "1"; then
line="`grep ABORT= $infile | cut -d= -f2-`"
if test -n "$line" -a "$line" != "no"; then
AC_MSG_WARN([MCA module configure script told me to abort])
AC_MSG_WARN([MCA component configure script told me to abort])
AC_MSG_ERROR([cannot continue])
fi
@ -420,10 +420,10 @@ if test "$HAPPY" = "1"; then
fi
fi
elif test "$FOUND" = "1"; then
AC_MSG_CHECKING([if MCA module $type:$m can compile])
AC_MSG_CHECKING([if MCA component $type:$m can compile])
AC_MSG_RESULT([no])
# If this module was requested as the default for this
# If this component was requested as the default for this
# type, then abort.
str="foo="'"$'"with_$type"'"'
@ -431,8 +431,8 @@ elif test "$FOUND" = "1"; then
str="bar="'"$'"with_$generic_type"'"'
eval $str
if test "$foo" = "$m" -o "$bar" = "$m"; then
AC_MSG_WARN([MCA module "$m" failed to configure properly])
AC_MSG_WARN([This module was selected as the default])
AC_MSG_WARN([MCA component "$m" failed to configure properly])
AC_MSG_WARN([This component was selected as the default])
AC_MSG_ERROR([Cannot continue])
exit 1
fi

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

@ -87,7 +87,7 @@ AH_BOTTOM([
#endif /* OMPI_CONFIG_H */
])
# Other basic setup stuff (shared with modules)
# Other basic setup stuff (shared with components)
OMPI_BASIC_SETUP

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

@ -40,7 +40,7 @@ int ompi_free_list_init(
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
mca_mpool_t* mpool)
mca_mpool_base_module_t* mpool)
{
flist->fl_elem_size = elem_size;
flist->fl_elem_class = elem_class;

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

@ -22,7 +22,7 @@ struct ompi_free_list_t
int fl_num_per_alloc;
size_t fl_elem_size;
ompi_class_t* fl_elem_class;
mca_mpool_t* fl_mpool;
mca_mpool_base_module_t* fl_mpool;
ompi_mutex_t fl_lock;
};
typedef struct ompi_free_list_t ompi_free_list_t;
@ -35,7 +35,7 @@ int ompi_free_list_init(
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
mca_mpool_t*);
mca_mpool_base_module_t*);
int ompi_free_list_grow(ompi_free_list_t* flist, size_t num_elements);

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

@ -40,7 +40,7 @@ static int ompi_comm_fill_rest (ompi_communicator_t *comm,
ompi_proc_t **proc_pointers,
int my_rank,
ompi_errhandler_t *errh,
mca_base_module_t *coll_module);
mca_base_component_t *coll_component);
/*
** typedef for the allgather_intra required in comm_split.
** the reason for introducing this abstraction is, that
@ -73,8 +73,8 @@ ompi_communicator_t * ompi_comm_set ( ompi_communicator_t* oldcomm,
ompi_proc_t **remote_procs,
ompi_hash_table_t *attr,
ompi_errhandler_t *errh,
mca_base_module_t *collmodule,
mca_base_module_t *topomodule )
mca_base_component_t *collcomponent,
mca_base_component_t *topocomponent )
{
ompi_communicator_t *newcomm;
ompi_proc_t *my_gpointer;
@ -112,17 +112,17 @@ ompi_communicator_t * ompi_comm_set ( ompi_communicator_t* oldcomm,
/* Set Topology, if required */
if ( NULL != topomodule ) {
if ( NULL != topocomponent ) {
/*
* This functions is never used o determine the topology
* module. The topology module is determined only by the
* ompi_cart_create and ompi_comm_create functions. Have
* to see what ahppens during MPI_Comm_dup though. During
* this the topology information has to be copied into the
* new communicator which includes selecting a new topology
* module and setting the information which is on that
* communicator into this communicator. This probably is
* another function in this file.
* This functions is never used o determine the topology
* component. The topology component is determined only by the
* ompi_cart_create and ompi_comm_create functions. Have to
* see what ahppens during MPI_Comm_dup though. During this
* the topology information has to be copied into the new
* communicator which includes selecting a new topology
* component and setting the information which is on that
* communicator into this communicator. This probably is
* another function in this file.
*/
if (OMPI_COMM_IS_CART ( oldcomm ) )
newcomm->c_flags |= OMPI_COMM_CART;
@ -142,10 +142,10 @@ ompi_communicator_t * ompi_comm_set ( ompi_communicator_t* oldcomm,
goto err_exit;
}
/* Initialize the coll modules */
/* Let the collectives modules fight over who will do
/* Initialize the coll components */
/* Let the collectives components fight over who will do
collective on this new comm. */
if (OMPI_ERROR == mca_coll_base_comm_select(newcomm, collmodule)) {
if (OMPI_ERROR == mca_coll_base_comm_select(newcomm, collcomponent)) {
goto err_exit;
}
@ -251,8 +251,8 @@ int ompi_comm_create ( ompi_communicator_t *comm, ompi_group_t *group,
rprocs, /* remote_procs */
NULL, /* attrs */
comm->error_handler, /* error handler */
NULL, /* coll module */
NULL /* topo module */
NULL, /* coll component */
NULL /* topo component */
);
if ( MPI_COMM_NULL == newcomp ) {
@ -452,8 +452,8 @@ int ompi_comm_split ( ompi_communicator_t* comm, int color, int key,
rprocs, /* remote_procs */
NULL, /* attrs */
comm->error_handler,/* error handler */
NULL, /* coll module */
NULL /* topo module */
NULL, /* coll component */
NULL /* topo component */
);
if ( MPI_COMM_NULL == newcomp ) {
rc = MPI_ERR_INTERN;
@ -859,13 +859,15 @@ static int rankkeycompare (const void *p, const void *q)
/*************************************************************************************
* Counterpart of MPI_Cart/Graph_create. This will be called from the top level MPI. The
* condition for INTER communicator is already checked by the time this has been
* invoked. This function should do somewhat the same things which ompi_comm_create
* does. It will however select a module for topology and then call the cart_create
* on that module so that it can re-arrange the proc structure as required (if the
* reorder flag is true). It will then use this proc structure to create the communicator
* using ompi_comm_set.
* Counterpart of MPI_Cart/Graph_create. This will be called from the
* top level MPI. The condition for INTER communicator is already
* checked by the time this has been invoked. This function should do
* somewhat the same things which ompi_comm_create does. It will
* however select a component for topology and then call the
* cart_create on that component so that it can re-arrange the proc
* structure as required (if the reorder flag is true). It will then
* use this proc structure to create the communicator using
* ompi_comm_set.
*/
int ompi_topo_create (ompi_communicator_t *old_comm,
int ndims_or_nnodes,
@ -882,22 +884,23 @@ int ompi_topo_create (ompi_communicator_t *old_comm,
int ret;
/*
* Allocate a comm structure. This structure is used later to pass down to
* topo_base_comm_select so that the actions structure pertaining to the
* selected topology module can be used to re-aarange the procs.
* Allocate a comm structure. This structure is used later to pass
* down to topo_base_comm_select so that the actions structure
* pertaining to the selected topology component can be used to
* re-aarange the procs.
*/
*comm_topo = MPI_COMM_NULL;
new_comm = OBJ_NEW (ompi_communicator_t);
/* allocate the data for the common good */
new_comm->c_topo_comm = malloc(sizeof(mca_topo_comm_t));
new_comm->c_topo_comm = malloc(sizeof(mca_topo_base_comm_t));
if (NULL == new_comm->c_topo_comm) {
OBJ_RELEASE(new_comm);
return OMPI_ERROR;
}
/* select the topology module on the communicator */
/* select the topology component on the communicator */
if (OMPI_SUCCESS != (ret = mca_topo_base_comm_select (new_comm, NULL))) {
free(new_comm->c_topo_comm);
@ -905,8 +908,8 @@ int ompi_topo_create (ompi_communicator_t *old_comm,
return ret;
}
/* since the topo module has initialised, let us now initialise the
* topo comm structure */
/* since the topo component has initialised, let us now initialise
* the topo comm structure */
#define FREE_COMMUNICATOR(new_comm) \
if (NULL != new_comm->c_topo_comm->mtc_dims_or_index) { \
free(new_comm->c_topo_comm->mtc_dims_or_index); \
@ -938,13 +941,14 @@ int ompi_topo_create (ompi_communicator_t *old_comm,
memcpy (new_comm->c_topo_comm->mtc_dims_or_index,
dims_or_index, ndims_or_nnodes * sizeof(int));
/* Now the topology module has been selected, let the module re-arrange
* the proc ranks if need be. This is a down-call into the topo
* module and does not have anything to do with this level */
/* Now the topology component has been selected, let the component
* re-arrange the proc ranks if need be. This is a down-call into
* the topo component and does not have anything to do with this
* level */
/* first, copy the proc structure from the previous communicator over to the
* new one. the topology module can then work on this and rearrange it as
* it deems fit.
/* first, copy the proc structure from the previous communicator
* over to the new one. the topology component can then work on
* this and rearrange it as it deems fit.
*/
num_procs = old_comm->c_local_group->grp_proc_count;
topo_procs = (ompi_proc_t **)malloc (num_procs * sizeof(ompi_proc_t *));
@ -957,9 +961,10 @@ int ompi_topo_create (ompi_communicator_t *old_comm,
/* A cartesian system has been requested. Call the right function */
/* Note that we fill in the basic information, i.e, copy the information
* which was provided to us over into the structure. The base module
* functions are free to change it as they deem fit */
/* Note that we fill in the basic information, i.e, copy the
* information which was provided to us over into the
* structure. The base component functions are free to change
* it as they deem fit */
new_comm->c_topo_comm->mtc_periods_or_edges = malloc (sizeof(int) * ndims_or_nnodes);
if (NULL == new_comm->c_topo_comm->mtc_periods_or_edges) {
@ -991,9 +996,10 @@ int ompi_topo_create (ompi_communicator_t *old_comm,
/* A graph system has been requested. Call the right function */
/* Note that we fill in the basic information, i.e, copy the information
* which was provided to us over into the structure. The base module
* functions are free to change it as they deem fit */
/* Note that we fill in the basic information, i.e, copy the
* information which was provided to us over into the
* structure. The base component functions are free to change
* it as they deem fit */
new_comm->c_topo_comm->mtc_periods_or_edges =
malloc (sizeof(int) * dims_or_index[ndims_or_nnodes-1]);
@ -1042,17 +1048,18 @@ int ompi_topo_create (ompi_communicator_t *old_comm,
return ret;
}
/* Now, the topology module has been selected and the group which has
* the topology information has been created. All we need to do now is
* to fill the rest of the information into the communicator. The following
* steps are not just similar to ompi_comm_set, but are actually the same */
/* Now, the topology component has been selected and the group
* which has the topology information has been created. All we
* need to do now is to fill the rest of the information into the
* communicator. The following steps are not just similar to
* ompi_comm_set, but are actually the same */
ret = ompi_comm_fill_rest(new_comm, /* the communicator */
num_procs, /* local size */
topo_procs, /* process structure */
new_rank, /* rank of the process */
old_comm->error_handler, /* error handler */
NULL); /*coll module */
NULL); /*coll component */
if (OMPI_SUCCESS != ret) {
/* something wrong happened during setting the communicator */
@ -1073,11 +1080,10 @@ static int ompi_comm_fill_rest (ompi_communicator_t *comm,
ompi_proc_t **proc_pointers,
int my_rank,
ompi_errhandler_t *errh,
mca_base_module_t *coll_module) {
mca_base_component_t *coll_component)
{
int ret;
/* allocate a group structure for the new communicator */
comm->c_local_group = ompi_group_allocate(num_procs);
@ -1121,7 +1127,7 @@ static int ompi_comm_fill_rest (ompi_communicator_t *comm,
return ret;
}
/* initialize the coll module */
/* initialize the coll component */
if (OMPI_SUCCESS != (ret = mca_coll_base_comm_select (comm, NULL))) {
/* some error has happened */
return ret;

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

@ -206,10 +206,10 @@ static void ompi_comm_construct(ompi_communicator_t* comm)
comm->c_topo_comm = NULL;
comm->c_topo_module = NULL;
comm->c_coll_selected_module = NULL;
comm->c_coll_selected_data = NULL;
comm->c_coll_basic_module = NULL;
comm->c_coll_basic_data = NULL;
comm->c_coll_selected_module = NULL;
comm->c_coll_selected_data = NULL;
comm->c_coll_basic_module = NULL;
comm->c_coll_basic_data = NULL;
return;
}

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

@ -62,16 +62,19 @@ struct ompi_communicator_t {
ompi_hash_table_t *c_keyhash;
int c_cube_dim; /**< inscribing cube dimension */
int c_cube_dim;
/**< inscribing cube dimension */
/* Hooks for topo module to hang things */
const mca_topo_1_0_0_t *c_topo; /**< structure of function pointers */
const mca_topo_base_module_1_0_0_t *c_topo;
/**< structure of function pointers */
mca_topo_comm_t *c_topo_comm; /**<structure containing basic information
*about the topology */
mca_topo_base_comm_t *c_topo_comm;
/**< structure containing basic information about the topology */
struct mca_topo_module_comm_t *c_topo_module; /**< component specific data */
struct mca_topo_base_module_comm_t *c_topo_module;
/**< module specific data */
/* index in Fortran <-> C translation array */
@ -85,23 +88,23 @@ struct ompi_communicator_t {
/* Hooks for PML to hang things */
struct mca_pml_comm_t* c_pml_comm;
struct mca_pml_comm_t *c_pml_comm;
mca_coll_1_0_0_t c_coll;
mca_coll_base_module_1_0_0_t c_coll;
/**< Selected collective module, saved by value for speed (instead
of by reference) */
const mca_coll_1_0_0_t *c_coll_selected_module;
/**< The selected module, but only when the selected module is
*not* the basic module. Used during comm_unselect(). */
struct mca_coll_comm_t* c_coll_selected_data;
const mca_coll_base_module_1_0_0_t *c_coll_selected_module;
/**< The selected module, but only when the selected module
is not* the basic module. Used during comm_unselect(). */
struct mca_coll_base_comm_t *c_coll_selected_data;
/**< Allow the selected module to cache data on the communicator */
const mca_coll_1_0_0_t *c_coll_basic_module;
const mca_coll_base_module_1_0_0_t *c_coll_basic_module;
/**< Save the basic module; only necessary when the selected
module is *not* the basic module, but was supplemented with
methods from the basic module. */
struct mca_coll_comm_t* c_coll_basic_data;
module is *not* the basic module, but was supplemented
with methods from the basic module. */
struct mca_coll_base_comm_t *c_coll_basic_data;
/**< Allow the basic module to cache data on the communicator */
};
typedef struct ompi_communicator_t ompi_communicator_t;
@ -280,8 +283,8 @@ extern "C" {
ompi_proc_t **remote_procs,
ompi_hash_table_t *attr,
ompi_errhandler_t *errh,
mca_base_module_t *collmodule,
mca_base_module_t *topomodule );
mca_base_component_t *collcomponent,
mca_base_component_t *topocomponent );
/**
* This is a short-hand routine used in intercomm_create.
* The routine makes sure, that all processes have afterwards

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

@ -22,7 +22,7 @@ struct ompi_file_t {
/* Hooks for io modules to hang things */
union {
mca_io_1_0_0_t f_io;
mca_io_base_module_1_0_0_t f_io;
} mca_io_functions;
/* index in Fortran <-> C translation array */

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

@ -9,31 +9,31 @@
#define MCA_ALLOCATOR_H
#include "mca/mca.h"
/* Here so that we can use mca_allocator_t in the function typedefs */
struct mca_allocator_t;
/* Here so that we can use mca_allocator_base_module_t in the function typedefs */
struct mca_allocator_base_module_t;
/**
* The allocate function typedef for the functrion to be provided by the component.
*/
typedef void* (*mca_allocator_alloc_fn_t)(struct mca_allocator_t*, size_t size, size_t align);
typedef void* (*mca_allocator_base_module_alloc_fn_t)(struct mca_allocator_base_module_t*, size_t size, size_t align);
/**
* The realloc function typedef
*/
typedef void* (*mca_allocator_realloc_fn_t)(struct mca_allocator_t*, void*, size_t);
typedef void* (*mca_allocator_base_module_realloc_fn_t)(struct mca_allocator_base_module_t*, void*, size_t);
/**
* Free function typedef
*/
typedef void(*mca_allocator_free_fn_t)(struct mca_allocator_t*, void *);
typedef void(*mca_allocator_base_module_free_fn_t)(struct mca_allocator_base_module_t*, void *);
/**
* compact/return memory to higher level allocator
*/
typedef int (*mca_allocator_return_fn_t)(
struct mca_allocator_t* allocator
typedef int (*mca_allocator_base_module_return_fn_t)(
struct mca_allocator_base_module_t* allocator
);
@ -41,24 +41,29 @@ typedef int (*mca_allocator_return_fn_t)(
* cleanup (free) any resources held by allocator
*/
typedef int (*mca_allocator_finalize_fn_t)(
struct mca_allocator_t* allocator
typedef int (*mca_allocator_base_module_finalize_fn_t)(
struct mca_allocator_base_module_t* allocator
);
/**
* The data structure for each component.
*/
struct mca_allocator_t {
mca_allocator_alloc_fn_t alc_alloc; /**< Allocate memory */
mca_allocator_realloc_fn_t alc_realloc; /**< Reallocate memory */
mca_allocator_free_fn_t alc_free; /**< Free memory */
mca_allocator_return_fn_t alc_return; /**< Return memory */
mca_allocator_finalize_fn_t alc_finalize; /**< Finalize and free everything */
struct mca_allocator_base_module_t {
mca_allocator_base_module_alloc_fn_t alc_alloc;
/**< Allocate memory */
mca_allocator_base_module_realloc_fn_t alc_realloc;
/**< Reallocate memory */
mca_allocator_base_module_free_fn_t alc_free;
/**< Free memory */
mca_allocator_base_module_return_fn_t alc_return;
/**< Return memory */
mca_allocator_base_module_finalize_fn_t alc_finalize;
/**< Finalize and free everything */
};
/**
* Convenience typedef.
*/
typedef struct mca_allocator_t mca_allocator_t;
typedef struct mca_allocator_base_module_t mca_allocator_base_module_t;
/**
@ -66,42 +71,45 @@ typedef struct mca_allocator_t mca_allocator_t;
* provided by the module to the allocator framework.
*/
typedef void* (*mca_allocator_segment_alloc_fn_t)(size_t* size);
typedef void* (*mca_allocator_base_component_segment_alloc_fn_t)(size_t* size);
/**
* A function to free memory from the control of the allocator framework
* back to the system. This function is to be provided by the module to the
* allocator frmaework.
*/
typedef void* (*mca_allocator_segment_free_fn_t)(void* segment);
typedef void* (*mca_allocator_base_component_segment_free_fn_t)(void* segment);
/**
* The function used to initialize the module.
* The function used to initialize the component.
*/
typedef struct mca_allocator_t* (*mca_allocator_base_module_init_fn_t)(
typedef struct mca_allocator_base_module_t* (*mca_allocator_base_component_init_fn_t)(
bool *allow_multi_user_threads,
mca_allocator_segment_alloc_fn_t segment_alloc,
mca_allocator_segment_free_fn_t segment_free
mca_allocator_base_component_segment_alloc_fn_t segment_alloc,
mca_allocator_base_component_segment_free_fn_t segment_free
);
/**
* The data structure provided by each component to the framework which
* describes the component.
*/
struct mca_allocator_base_module_1_0_0_t {
mca_base_module_t allocator_version; /**< The version of the module */
mca_base_module_data_1_0_0_t allocator_data; /**< The module metadata */
mca_allocator_base_module_init_fn_t allocator_init;
/**< The module initialization function. */
struct mca_allocator_base_component_1_0_0_t {
mca_base_component_t allocator_version;
/**< The version of the component */
mca_base_component_data_1_0_0_t allocator_data;
/**< The component metadata */
mca_allocator_base_component_init_fn_t allocator_init;
/**< The component initialization function. */
};
/**
* Convenience typedef.
*/
typedef struct mca_allocator_base_module_1_0_0_t mca_allocator_base_module_t;
typedef struct mca_allocator_base_component_1_0_0_t mca_allocator_base_component_t;
/**
* Macro for use in modules that are of type allocator v1.0.0
* Macro for use in components that are of type allocator v1.0.0
*/
#define MCA_ALLOCATOR_BASE_VERSION_1_0_0 \
/* mpool v1.0 is chained to MCA v1.0 */ \

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

@ -22,7 +22,8 @@ int mca_allocator_base_close(void)
/* Close all remaining available modules (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
mca_base_modules_close(mca_allocator_base_output, &mca_allocator_base_components, NULL);
mca_base_components_close(mca_allocator_base_output,
&mca_allocator_base_components, NULL);
/* All done */

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

@ -15,10 +15,10 @@
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* module's public mca_base_module_t struct.
* component's public mca_base_component_t struct.
*/
#include "mca/allocator/base/static-modules.h"
#include "mca/allocator/base/static-components.h"
/*
@ -28,35 +28,38 @@ ompi_list_t mca_allocator_base_components;
int mca_allocator_base_output = -1;
/**
* Function for finding and opening either all MCA modules, or the one
* Function for finding and opening either all MCA components, or the one
* that was specifically requested via a MCA parameter.
*/
int mca_allocator_base_open(void)
{
/* Open up all available modules */
return mca_base_modules_open("allocator", 0, mca_allocator_base_static_modules,
&mca_allocator_base_components);
/* Open up all available components */
return mca_base_components_open("allocator", 0,
mca_allocator_base_static_components,
&mca_allocator_base_components);
}
/**
* Traverses through the list of available modules, calling their init functions
* until it finds the module that has the specified name. It then returns the found
* module.
* Traverses through the list of available components, calling their init
* functions until it finds the component that has the specified name. It
* then returns the found component.
*
* @param name the name of the module that is being searched for.
* @retval mca_allocator_base_module_t* pointer to the requested module
* @retval NULL if the requested module is not found
* @param name the name of the component that is being searched for.
* @retval mca_allocator_base_component_t* pointer to the requested component
* @retval NULL if the requested component is not found
*/
mca_allocator_base_module_t* mca_allocator_component_lookup(const char* name)
mca_allocator_base_component_t* mca_allocator_component_lookup(const char* name)
{
/* Traverse the list of available modules; call their init functions. */
/* Traverse the list of available components; call their init functions. */
ompi_list_item_t* item;
for (item = ompi_list_get_first(&mca_allocator_base_components);
item != ompi_list_get_end(&mca_allocator_base_components);
item = ompi_list_get_next(item)) {
mca_base_module_list_item_t *mli = (mca_base_module_list_item_t *) item;
mca_allocator_base_module_t* component = (mca_allocator_base_module_t *) mli->mli_module;
if(strcmp(component->allocator_version.mca_module_name,name) == 0) {
mca_base_component_list_item_t *cli = (mca_base_component_list_item_t *) item;
mca_allocator_base_component_t* component = (mca_allocator_base_component_t *) cli->cli_component;
if(strcmp(component->allocator_version.mca_component_name,
name) == 0) {
return component;
}
}

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

@ -17,9 +17,12 @@
* Structure which describes a selected module.
*/
struct mca_allocator_base_selected_module_t {
ompi_list_item_t super; /**< Makes this an object of type ompi_list_item */
mca_allocator_base_module_t *allocator_component; /**< Info about the module */
mca_allocator_t *allocator_module; /**< The function pointers for all the module's functions. */
ompi_list_item_t super;
/**< Makes this an object of type ompi_list_item */
mca_allocator_base_component_t *allocator_component;
/**< Info about the module */
mca_allocator_base_module_t *allocator_module;
/**< The function pointers for all the module's functions. */
};
/**
* Convenience typedef.
@ -41,7 +44,7 @@ extern "C" {
#endif
int mca_allocator_base_open(void);
int mca_allocator_base_close(void);
mca_allocator_base_module_t* mca_allocator_component_lookup(const char* name);
mca_allocator_base_component_t* mca_allocator_component_lookup(const char* name);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

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

@ -3,32 +3,32 @@
#include "mca/base/mca_base_param.h"
#include "mca/allocator/bucket/allocator_bucket_alloc.h"
struct mca_allocator_t* mca_allocator_bucket_module_init(
struct mca_allocator_base_module_t* mca_allocator_bucket_module_init(
bool *allow_multi_user_threads,
mca_allocator_segment_alloc_fn_t segment_alloc,
mca_allocator_segment_free_fn_t segment_free);
mca_allocator_base_component_segment_alloc_fn_t segment_alloc,
mca_allocator_base_component_segment_free_fn_t segment_free);
int mca_allocator_bucket_module_open(void);
int mca_allocator_bucket_module_close(void);
void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_t* allocator,
void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_base_module_t* allocator,
size_t size, size_t align);
static int mca_allocator_num_buckets;
int mca_allocator_bucket_finalize(struct mca_allocator_t* allocator)
int mca_allocator_bucket_finalize(struct mca_allocator_base_module_t* allocator)
{
mca_allocator_bucket_cleanup(allocator);
free(allocator);
return(OMPI_SUCCESS);
}
struct mca_allocator_t* mca_allocator_bucket_module_init(
struct mca_allocator_base_module_t* mca_allocator_bucket_module_init(
bool *allow_multi_user_threads,
mca_allocator_segment_alloc_fn_t segment_alloc,
mca_allocator_segment_free_fn_t segment_free)
mca_allocator_base_component_segment_alloc_fn_t segment_alloc,
mca_allocator_base_component_segment_free_fn_t segment_free)
{
size_t alloc_size = sizeof(mca_allocator_bucket_t);
mca_allocator_bucket_t * retval;
@ -36,7 +36,7 @@ struct mca_allocator_t* mca_allocator_bucket_module_init(
if(NULL == allocator) {
return(NULL);
}
retval = mca_allocator_bucket_init((mca_allocator_t *) allocator, mca_allocator_num_buckets,
retval = mca_allocator_bucket_init((mca_allocator_base_module_t *) allocator, mca_allocator_num_buckets,
segment_alloc, segment_free);
if(NULL == retval) {
free(allocator);
@ -48,7 +48,7 @@ struct mca_allocator_t* mca_allocator_bucket_module_init(
allocator->super.alc_return = mca_allocator_bucket_cleanup;
allocator->super.alc_finalize = mca_allocator_bucket_finalize;
return((mca_allocator_t *) allocator);
return((mca_allocator_base_module_t *) allocator);
}
int mca_allocator_bucket_module_open(void) {
@ -62,7 +62,7 @@ int mca_allocator_bucket_module_close(void) {
return(OMPI_SUCCESS);
}
void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_t* allocator,
void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_base_module_t* allocator,
size_t size, size_t align)
{
if(0 == align){
@ -72,10 +72,12 @@ void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_t* allocator,
}
mca_allocator_base_module_t mca_allocator_bucket_module = {
/* First, the mca_base_module_t struct containing meta information
about the module itself */
{
mca_allocator_base_component_t mca_allocator_bucket_component = {
/* First, the mca_base_module_t struct containing meta information
about the module itself */
{
/* Indicate that we are a allocator v1.0.0 module (which also implies a
specific MCA version) */
@ -87,14 +89,14 @@ mca_allocator_base_module_t mca_allocator_bucket_module = {
0, /* MCA module release version */
mca_allocator_bucket_module_open, /* module open */
mca_allocator_bucket_module_close /* module close */
},
},
/* Next the MCA v1.0.0 module meta data */
/* Next the MCA v1.0.0 module meta data */
{
{
/* Whether the module is checkpointable or not */
false
},
mca_allocator_bucket_module_init
},
mca_allocator_bucket_module_init
};

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

@ -18,10 +18,10 @@
* Initializes the mca_allocator_bucket_options_t data structure for the passed
* parameters.
*/
mca_allocator_bucket_t * mca_allocator_bucket_init(mca_allocator_t * mem,
mca_allocator_bucket_t * mca_allocator_bucket_init(mca_allocator_base_module_t * mem,
int num_buckets,
mca_allocator_segment_alloc_fn_t get_mem_funct,
mca_allocator_segment_free_fn_t free_mem_funct)
mca_allocator_base_component_segment_alloc_fn_t get_mem_funct,
mca_allocator_base_component_segment_free_fn_t free_mem_funct)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
int i;
@ -53,7 +53,8 @@ mca_allocator_bucket_t * mca_allocator_bucket_init(mca_allocator_t * mem,
* region or NULL if there was an error
*
*/
void * mca_allocator_bucket_alloc(mca_allocator_t * mem, size_t size)
void * mca_allocator_bucket_alloc(mca_allocator_base_module_t * mem,
size_t size)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
int bucket_num = 0;
@ -131,7 +132,8 @@ void * mca_allocator_bucket_alloc(mca_allocator_t * mem, size_t size)
/*
* allocates an aligned region of memory
*/
void * mca_allocator_bucket_alloc_align(mca_allocator_t * mem, size_t size, size_t alignment)
void * mca_allocator_bucket_alloc_align(mca_allocator_base_module_t * mem,
size_t size, size_t alignment)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
int bucket_num = 1;
@ -210,8 +212,8 @@ void * mca_allocator_bucket_alloc_align(mca_allocator_t * mem, size_t size, size
/*
* function to reallocate the segment of memory
*/
void * mca_allocator_bucket_realloc(mca_allocator_t * mem, void * ptr,
size_t size)
void * mca_allocator_bucket_realloc(mca_allocator_base_module_t * mem,
void * ptr, size_t size)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
/* initialize for later bit shifts */
@ -232,14 +234,14 @@ void * mca_allocator_bucket_realloc(mca_allocator_t * mem, void * ptr,
return(ptr);
}
/* we need a new space in memory, so let's get it */
ret_ptr = mca_allocator_bucket_alloc((mca_allocator_t *) mem_options, size);
ret_ptr = mca_allocator_bucket_alloc((mca_allocator_base_module_t *) mem_options, size);
if(NULL == ret_ptr) {
return(NULL);
}
/* copy what they have in memory to the new spot */
memcpy(ret_ptr, ptr, bucket_size);
/* free the old area in memory */
mca_allocator_bucket_free((mca_allocator_t *) mem_options, ptr);
mca_allocator_bucket_free((mca_allocator_base_module_t *) mem_options, ptr);
return(ret_ptr);
}
@ -248,7 +250,7 @@ void * mca_allocator_bucket_realloc(mca_allocator_t * mem, void * ptr,
* Frees the passed region of memory
*
*/
void mca_allocator_bucket_free(mca_allocator_t * mem, void * ptr)
void mca_allocator_bucket_free(mca_allocator_base_module_t * mem, void * ptr)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
mca_allocator_bucket_chunk_header_t * chunk = (mca_allocator_bucket_chunk_header_t *) ptr - 1;
@ -265,7 +267,7 @@ void mca_allocator_bucket_free(mca_allocator_t * mem, void * ptr)
* mca_allocator_bucket_free().
*
*/
int mca_allocator_bucket_cleanup(mca_allocator_t * mem)
int mca_allocator_bucket_cleanup(mca_allocator_base_module_t * mem)
{
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
int i;

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

@ -67,12 +67,12 @@ typedef struct mca_allocator_bucket_bucket_t mca_allocator_bucket_bucket_t;
* Structure that holds the necessary information for each area of memory
*/
struct mca_allocator_bucket_t {
mca_allocator_t super; /**< makes this a child of class mca_allocator_t */
mca_allocator_base_module_t super; /**< makes this a child of class mca_allocator_t */
mca_allocator_bucket_bucket_t * buckets; /**< the array of buckets */
int num_buckets; /**< the number of buckets */
mca_allocator_segment_alloc_fn_t get_mem_fn;
mca_allocator_base_component_segment_alloc_fn_t get_mem_fn;
/**< pointer to the function to get more memory */
mca_allocator_segment_free_fn_t free_mem_fn;
mca_allocator_base_component_segment_free_fn_t free_mem_fn;
/**< pointer to the function to free memory */
};
/**
@ -96,10 +96,10 @@ extern "C" {
* @retval Pointer to the initialized mca_allocator_bucket_options_t structure
* @retval NULL if there was an error
*/
mca_allocator_bucket_t * mca_allocator_bucket_init(mca_allocator_t * mem,
mca_allocator_bucket_t *mca_allocator_bucket_init(mca_allocator_base_module_t * mem,
int num_buckets,
mca_allocator_segment_alloc_fn_t get_mem_funct,
mca_allocator_segment_free_fn_t free_mem_funct);
mca_allocator_base_component_segment_alloc_fn_t get_mem_funct,
mca_allocator_base_component_segment_free_fn_t free_mem_funct);
/**
* Accepts a request for memory in a specific region defined by the
* mca_allocator_bucket_options_t struct and returns a pointer to memory in that
@ -111,7 +111,7 @@ extern "C" {
* @retval Pointer to the area of memory if the allocation was successful
* @retval NULL if the allocation was unsuccessful
*/
void * mca_allocator_bucket_alloc(mca_allocator_t * mem, size_t size);
void * mca_allocator_bucket_alloc(mca_allocator_base_module_t * mem, size_t size);
/**
* Accepts a request for memory in a specific region defined by the
@ -128,8 +128,8 @@ extern "C" {
* @retval NULL if the allocation was unsuccessful
*
*/
void * mca_allocator_bucket_alloc_align(mca_allocator_t * mem, size_t size,
size_t alignment);
void * mca_allocator_bucket_alloc_align(mca_allocator_base_module_t * mem,
size_t size, size_t alignment);
/**
* Attempts to resize the passed region of memory into a larger or a smaller
@ -145,8 +145,8 @@ extern "C" {
* @retval NULL if the allocation was unsuccessful
*
*/
void * mca_allocator_bucket_realloc(mca_allocator_t * mem, void * ptr,
size_t size);
void * mca_allocator_bucket_realloc(mca_allocator_base_module_t * mem,
void * ptr, size_t size);
/**
* Frees the passed region of memory
@ -158,7 +158,8 @@ extern "C" {
* @retval None
*
*/
void mca_allocator_bucket_free(mca_allocator_t * mem, void * ptr);
void mca_allocator_bucket_free(mca_allocator_base_module_t * mem,
void * ptr);
/**
* Frees all the memory from all the buckets back to the system. Note that
@ -171,7 +172,7 @@ extern "C" {
* @retval None
*
*/
int mca_allocator_bucket_cleanup(mca_allocator_t * mem);
int mca_allocator_bucket_cleanup(mca_allocator_base_module_t * mem);
/**
* Cleanup all resources held by this allocator.
@ -182,7 +183,7 @@ extern "C" {
* @retval None
*
*/
int mca_allocator_bucket_finalize(mca_allocator_t * mem);
int mca_allocator_bucket_finalize(mca_allocator_base_module_t * mem);
#if defined(c_plusplus) || defined(__cplusplus)
}

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

@ -4,7 +4,7 @@
include $(top_srcdir)/config/Makefile.options
# Need this so that the base knows where to load dynamic modules from
# Need this so that the base knows where to load dynamic components from
# (by default)
AM_CPPFLAGS = -DOMPI_PKGLIBDIR=\"$(pkglibdir)\"
@ -16,10 +16,10 @@ noinst_LTLIBRARIES = libmca_base.la
headers = \
base.h \
mca_base_module_exchange.h \
mca_base_param.h \
mca_base_param_internal.h \
mca_base_msgbuf.h \
mca_base_msgbuf_internal.h
mca_base_msgbuf_internal.h \
mca_base_param.h \
mca_base_param_internal.h
# Library
@ -27,17 +27,17 @@ libmca_base_la_SOURCES = \
$(headers) \
mca_base_close.c \
mca_base_cmd_line.c \
mca_base_module_compare.c \
mca_base_component_compare.c \
mca_base_component_find.c \
mca_base_component_repository.c \
mca_base_components_open.c \
mca_base_components_close.c \
mca_base_init_select_components.c \
mca_base_list.c \
mca_base_module_exchange.c \
mca_base_module_find.c \
mca_base_init_select_modules.c \
mca_base_module_repository.c \
mca_base_modules_open.c \
mca_base_modules_close.c \
mca_base_msgbuf.c \
mca_base_open.c \
mca_base_priority_list.c \
mca_base_param.c \
mca_base_msgbuf.c
mca_base_param.c
# Conditionally install the header files

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

@ -19,31 +19,14 @@
/*
* Structure for making plain lists of modules
* Structure for making plain lists of components
*/
struct mca_base_module_list_item_t {
struct mca_base_component_list_item_t {
ompi_list_item_t super;
const mca_base_module_t *mli_module;
const mca_base_component_t *cli_component;
};
typedef struct mca_base_module_list_item_t mca_base_module_list_item_t;
/*
* Structure for making priority lists of modules
* DEPRECATED: to be replaced by
* mca_base_component_priority_list_item_t, below, when we make the
* module->component name switch.
*/
struct mca_base_module_priority_list_item_t {
ompi_list_item_t super;
int mpli_priority;
bool mpli_allow_multi_user_threads;
bool mpli_have_hidden_threads;
const mca_base_module_t *mpli_module;
};
typedef struct mca_base_module_priority_list_item_t
mca_base_module_priority_list_item_t;
typedef struct mca_base_component_list_item_t mca_base_component_list_item_t;
OBJ_CLASS_DECLARATION(mca_base_component_list_item_t);
/*
@ -55,7 +38,7 @@ struct mca_base_component_priority_list_item_t {
int cpli_priority;
bool cpli_allow_multi_user_threads;
bool cpli_have_hidden_threads;
const mca_base_module_t *cpli_component;
const mca_base_component_t *cpli_component;
};
typedef struct mca_base_component_priority_list_item_t
mca_base_component_priority_list_item_t;
@ -65,7 +48,7 @@ OBJ_CLASS_DECLARATION(mca_base_component_priority_list_item_t);
/*
* Public variables
*/
extern int mca_base_param_module_path;
extern int mca_base_param_component_path;
/*
@ -82,7 +65,7 @@ extern "C" {
* @return OMPI_ERROR Upon failure
*
* This function starts up the entire MCA. It initializes a bunch
* of built-in MCA parameters, and initialized the MCA module
* of built-in MCA parameters, and initialized the MCA component
* repository.
*
* It must be the first MCA function invoked. It is normally
@ -98,7 +81,7 @@ extern "C" {
* @return OMPI_ERROR Upon failure
*
* This function closes down the entire MCA. It clears all MCA
* parameters and closes down the MCA module respository.
* parameters and closes down the MCA component respository.
*
* It must be the last MCA function invoked. It is normally invoked
* during ompi_mpi_finalize() and specifically invoked during the
@ -112,46 +95,46 @@ extern "C" {
int mca_base_cmd_line_process_args(ompi_cmd_line_t *cmd);
int mca_base_cmd_line_process_arg(const char *param, const char *value);
/* mca_base_module_compare.c */
/* mca_base_component_compare.c */
int mca_base_module_compare_priority(mca_base_module_priority_list_item_t *a,
mca_base_module_priority_list_item_t *b);
int mca_base_module_compare(const mca_base_module_t *a,
const mca_base_module_t *b);
int mca_base_component_compare_priority(mca_base_component_priority_list_item_t *a,
mca_base_component_priority_list_item_t *b);
int mca_base_component_compare(const mca_base_component_t *a,
const mca_base_component_t *b);
/* mca_base_module_find.c */
/* mca_base_component_find.c */
int mca_base_module_find(const char *directory, const char *type,
const mca_base_module_t *static_modules[],
ompi_list_t *found_modules);
int mca_base_component_find(const char *directory, const char *type,
const mca_base_component_t *static_components[],
ompi_list_t *found_components);
/* mca_base_module_register.c */
/* mca_base_component_register.c */
int mca_base_module_repository_initialize(void);
int mca_base_module_repository_retain(char *type,
lt_dlhandle module_handle,
const mca_base_module_t *module_struct);
int mca_base_module_repository_link(const char *src_type,
int mca_base_component_repository_initialize(void);
int mca_base_component_repository_retain(char *type,
lt_dlhandle component_handle,
const mca_base_component_t *component_struct);
int mca_base_component_repository_link(const char *src_type,
const char *src_name,
const char *depend_type,
const char *depend_name);
void mca_base_module_repository_release(const mca_base_module_t *module);
void mca_base_module_repository_finalize(void);
void mca_base_component_repository_release(const mca_base_component_t *component);
void mca_base_component_repository_finalize(void);
/* mca_base_modules_open.c */
/* mca_base_components_open.c */
int mca_base_modules_open(const char *type_name, int output_id,
const mca_base_module_t **static_modules,
ompi_list_t *modules_available);
int mca_base_components_open(const char *type_name, int output_id,
const mca_base_component_t **static_components,
ompi_list_t *components_available);
/* mca_base_modules_close.c */
/* mca_base_components_close.c */
int mca_base_modules_close(int output_id, ompi_list_t *modules_available,
const mca_base_module_t *skip);
int mca_base_components_close(int output_id, ompi_list_t *components_available,
const mca_base_component_t *skip);
/* mca_base_init_select_modules.c */
/* mca_base_init_select_components.c */
int mca_base_init_select_modules(int requested,
int mca_base_init_select_components(int requested,
bool allow_multi_user_threads,
bool have_hidden_threads, int *provided);
@ -159,7 +142,7 @@ extern "C" {
/* JMS Not implemented yet */
int mca_base_init_callback(mca_base_init_cb_t func);
int mca_base_init_callbacks_invoke(void);
int mca_base_module_select(int requested);
int mca_base_component_select(int requested);
int mca_base_param_associate(int index, int keyval);
int mca_base_param_lookup_int(int index, MPI_Comm comm);

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

@ -20,9 +20,9 @@ int mca_base_close(void)
mca_base_param_finalize();
/* Close down the module repository */
/* Close down the component repository */
mca_base_module_repository_finalize();
mca_base_component_repository_finalize();
}
mca_base_opened = false;

75
src/mca/base/mca_base_component_compare.c Обычный файл
Просмотреть файл

@ -0,0 +1,75 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <string.h>
#include "mca/mca.h"
#include "mca/base/base.h"
/*
* Function for comparing two mca_base_component_priority_t structs so
* that we can build prioritized listss of them. This assumed that
* the types of the modules are the same. Sort first by priority,
* second by module name, third by module version.
*
* Note that we acutally want a *reverse* ordering here -- the al_*
* functions will put "smaller" items at the head, and "larger" items
* at the tail. Since we want the highest priority at the head, it
* may help the gentle reader to consider this an inverse comparison.
* :-)
*/
int
mca_base_component_compare_priority(mca_base_component_priority_list_item_t *a,
mca_base_component_priority_list_item_t *b)
{
/* First, compare the priorties */
if (a->cpli_priority > b->cpli_priority) {
return -1;
} else if (a->cpli_priority < b->cpli_priority) {
return 1;
} else {
return mca_base_component_compare(a->cpli_component, b->cpli_component);
}
}
int mca_base_component_compare(const mca_base_component_t* aa,
const mca_base_component_t* bb)
{
/* The priorities were equal, so compare the names */
int val = strncmp(aa->mca_component_name, bb->mca_component_name,
MCA_BASE_MAX_COMPONENT_NAME_LEN);
if (val != 0) {
return -val;
}
/* The names were equal, so compare the versions */
if (aa->mca_component_major_version >
bb->mca_component_major_version) {
return -1;
} else if (aa->mca_component_major_version <
bb->mca_component_major_version) {
return 1;
} else if (aa->mca_component_minor_version >
bb->mca_component_minor_version) {
return -1;
} else if (aa->mca_component_minor_version <
bb->mca_component_minor_version) {
return 1;
} else if (aa->mca_component_release_version >
bb->mca_component_release_version) {
return -1;
} else if (aa->mca_component_release_version <
bb->mca_component_release_version) {
return 1;
}
return 0;
}

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

@ -22,40 +22,40 @@
/*
* Private types
*/
typedef enum module_status {
typedef enum component_status {
UNVISITED,
FAILED_TO_LOAD,
CHECKING_CYCLE,
LOADED,
STATUS_MAX
} module_status_t;
} component_status_t;
struct module_file_item_t {
struct component_file_item_t {
ompi_list_item_t super;
char type[MCA_BASE_MAX_TYPE_NAME_LEN];
char name[MCA_BASE_MAX_MODULE_NAME_LEN];
char name[MCA_BASE_MAX_COMPONENT_NAME_LEN];
char basename[OMPI_PATH_MAX];
char filename[OMPI_PATH_MAX];
module_status_t status;
component_status_t status;
};
typedef struct module_file_item_t module_file_item_t;
typedef struct component_file_item_t component_file_item_t;
OBJ_CLASS_INSTANCE(module_file_item_t, ompi_list_item_t, NULL, NULL);
static OBJ_CLASS_INSTANCE(component_file_item_t, ompi_list_item_t, NULL, NULL);
struct dependency_item_t {
ompi_list_item_t super;
module_file_item_t *di_module_file_item;
component_file_item_t *di_component_file_item;
};
typedef struct dependency_item_t dependency_item_t;
OBJ_CLASS_INSTANCE(dependency_item_t, ompi_list_item_t, NULL, NULL);
static OBJ_CLASS_INSTANCE(dependency_item_t, ompi_list_item_t, NULL, NULL);
struct ltfn_data_holder_t {
char type[MCA_BASE_MAX_TYPE_NAME_LEN];
char name[MCA_BASE_MAX_MODULE_NAME_LEN];
char name[MCA_BASE_MAX_COMPONENT_NAME_LEN];
};
typedef struct ltfn_data_holder_t ltfn_data_holder_t;
@ -63,17 +63,17 @@ typedef struct ltfn_data_holder_t ltfn_data_holder_t;
/*
* Private functions
*/
static void find_dyn_modules(const char *path, const char *type,
const char *name, ompi_list_t *found_modules);
static void find_dyn_components(const char *path, const char *type,
const char *name, ompi_list_t *found_components);
static int save_filename(const char *filename, lt_ptr data);
static int open_module(module_file_item_t *target_file,
ompi_list_t *found_modules);
static int check_ompi_info(module_file_item_t *target_file,
static int open_component(component_file_item_t *target_file,
ompi_list_t *found_components);
static int check_ompi_info(component_file_item_t *target_file,
ompi_list_t *dependencies,
ompi_list_t *found_modules);
static int check_dependency(char *line, module_file_item_t *target_file,
ompi_list_t *found_components);
static int check_dependency(char *line, component_file_item_t *target_file,
ompi_list_t *dependencies,
ompi_list_t *found_modules);
ompi_list_t *found_components);
static void free_dependency_list(ompi_list_t *dependencies);
@ -82,42 +82,41 @@ static void free_dependency_list(ompi_list_t *dependencies);
*/
static const char *ompi_info_suffix = ".ompi_info";
static const char *key_dependency = "dependency=";
static const char module_template[] = "mca_%s_";
static const char component_template[] = "mca_%s_";
static ompi_list_t found_files;
/*
* Function to find as many modules of a given type as possible. This
* includes statically-linked in modules as well as opening up a
* directory and looking for shared-library MCA modules of the
* Function to find as many components of a given type as possible. This
* includes statically-linked in components as well as opening up a
* directory and looking for shared-library MCA components of the
* appropriate type (load them if available).
*
* Return one consolidated array of (mca_base_module_t*) pointing to all
* available modules.
* Return one consolidated array of (mca_base_component_t*) pointing to all
* available components.
*/
int mca_base_module_find(const char *directory, const char *type,
const mca_base_module_t *static_modules[],
ompi_list_t *found_modules)
int mca_base_component_find(const char *directory, const char *type,
const mca_base_component_t *static_components[],
ompi_list_t *found_components)
{
int i;
mca_base_module_list_item_t *mli;
mca_base_component_list_item_t *cli;
/* Find all the modules that were statically linked in */
/* Find all the components that were statically linked in */
OBJ_CONSTRUCT(found_modules, ompi_list_t);
for (i = 0; NULL != static_modules[i]; ++i) {
mli = malloc(sizeof(mca_base_module_list_item_t));
if (NULL == mli) {
OBJ_CONSTRUCT(found_components, ompi_list_t);
for (i = 0; NULL != static_components[i]; ++i) {
cli = OBJ_NEW(mca_base_component_list_item_t);
if (NULL == cli) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
OBJ_CONSTRUCT(mli, ompi_list_item_t);
mli->mli_module = static_modules[i];
ompi_list_append(found_modules, (ompi_list_item_t *) mli);
cli->cli_component = static_components[i];
ompi_list_append(found_components, (ompi_list_item_t *) cli);
}
/* Find any available dynamic modules in the specified directory */
/* Find any available dynamic components in the specified directory */
find_dyn_modules(directory, type, NULL, found_modules);
find_dyn_components(directory, type, NULL, found_components);
/* All done */
@ -126,7 +125,7 @@ int mca_base_module_find(const char *directory, const char *type,
/*
* Open up all directories in a given path and search for modules of
* Open up all directories in a given path and search for components of
* the specified type (and possibly of a given name).
*
* Note that we use our own path iteration functionality (vs. ltdl's
@ -136,34 +135,34 @@ int mca_base_module_find(const char *directory, const char *type,
* functionality, we would not get the directory name of the file
* finally opened in recursive dependency traversals.
*/
static void find_dyn_modules(const char *path, const char *type_name,
const char *name, ompi_list_t *found_modules)
static void find_dyn_components(const char *path, const char *type_name,
const char *name, ompi_list_t *found_components)
{
ltfn_data_holder_t params;
char *path_to_use, *dir, *end, *param;
module_file_item_t *file;
component_file_item_t *file;
ompi_list_item_t *cur;
strcpy(params.type, type_name);
if (NULL == name) {
params.name[0] = '\0';
ompi_output_verbose(40, 0, " looking for all dynamic %s MCA modules",
ompi_output_verbose(40, 0, " looking for all dynamic %s MCA components",
type_name, NULL);
} else {
strcpy(params.name, name);
ompi_output_verbose(40, 0,
" looking for dynamic %s MCA module named \"%s\"",
" looking for dynamic %s MCA component named \"%s\"",
type_name, name, NULL);
}
/* If directory is NULL, iterate over the set of directories
specified by the MCA param mca_base_module_path. If path is not
specified by the MCA param mca_base_component_path. If path is not
NULL, then use that as the path. */
param = NULL;
if (NULL == path) {
mca_base_param_lookup_string(mca_base_param_module_path, &param);
mca_base_param_lookup_string(mca_base_param_component_path, &param);
dir = param;
}
if (NULL == dir) {
@ -190,7 +189,7 @@ static void find_dyn_modules(const char *path, const char *type_name,
} while (NULL != end);
/* Iterate through all the filenames that we found. Since one
module may [try to] call another to be loaded, only try to load
component may [try to] call another to be loaded, only try to load
the UNVISITED files. Also, ignore the return code -- basically,
give every file one chance to try to load. If they load, great.
If not, great. */
@ -198,13 +197,13 @@ static void find_dyn_modules(const char *path, const char *type_name,
for (cur = ompi_list_get_first(&found_files);
ompi_list_get_end(&found_files) != cur;
cur = ompi_list_get_next(cur)) {
file = (module_file_item_t *) cur;
file = (component_file_item_t *) cur;
if (UNVISITED == file->status) {
open_module(file, found_modules);
open_component(file, found_components);
}
}
/* So now we have a final list of loaded modules. We can free all
/* So now we have a final list of loaded components. We can free all
the file information. */
for (cur = ompi_list_remove_first(&found_files);
@ -233,18 +232,18 @@ static int save_filename(const char *filename, lt_ptr data)
int len, prefix_len, total_len;
char *prefix;
const char *basename;
module_file_item_t *module_file;
component_file_item_t *component_file;
ltfn_data_holder_t *params = (ltfn_data_holder_t *) data;
/* Check to see if the file is named what we expect it to be
named */
len = sizeof(module_template) + strlen(params->type) + 32;
len = sizeof(component_template) + strlen(params->type) + 32;
if (NULL != params->name) {
len += strlen(params->name);
}
prefix = malloc(len);
snprintf(prefix, len, module_template, params->type);
snprintf(prefix, len, component_template, params->type);
prefix_len = strlen(prefix);
if (NULL != params->name) {
strcat(prefix, params->name);
@ -263,18 +262,18 @@ static int save_filename(const char *filename, lt_ptr data)
return 0;
}
/* Save all the info and put it in the list of found modules */
/* Save all the info and put it in the list of found components */
module_file = OBJ_NEW(module_file_item_t);
if (NULL == module_file) {
component_file = OBJ_NEW(component_file_item_t);
if (NULL == component_file) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
strcpy(module_file->type, params->type);
strcpy(module_file->name, basename + prefix_len);
strcpy(module_file->basename, basename);
strcpy(module_file->filename, filename);
module_file->status = UNVISITED;
ompi_list_append(&found_files, (ompi_list_item_t *) module_file);
strcpy(component_file->type, params->type);
strcpy(component_file->name, basename + prefix_len);
strcpy(component_file->basename, basename);
strcpy(component_file->filename, filename);
component_file->status = UNVISITED;
ompi_list_append(&found_files, (ompi_list_item_t *) component_file);
/* All done */
@ -284,64 +283,64 @@ static int save_filename(const char *filename, lt_ptr data)
/*
* Open a module, chasing down its dependencies first, if possible.
* Open a component, chasing down its dependencies first, if possible.
*/
static int open_module(module_file_item_t *target_file,
ompi_list_t *found_modules)
static int open_component(component_file_item_t *target_file,
ompi_list_t *found_components)
{
int len;
lt_dlhandle module_handle;
mca_base_module_t *module_struct;
lt_dlhandle component_handle;
mca_base_component_t *component_struct;
char *struct_name;
ompi_list_t dependencies;
ompi_list_item_t *cur;
mca_base_module_list_item_t *mitem;
mca_base_component_list_item_t *mitem;
dependency_item_t *ditem;
ompi_output_verbose(40, 0, " examining dyanmic %s MCA module \"%s\"",
ompi_output_verbose(40, 0, " examining dyanmic %s MCA component \"%s\"",
target_file->type, target_file->name, NULL);
ompi_output_verbose(40, 0, " %s", target_file->filename, NULL);
/* Was this module already loaded (e.g., via dependency)? */
/* Was this component already loaded (e.g., via dependency)? */
if (LOADED == target_file->status) {
ompi_output_verbose(40, 0, " already loaded (ignored)", NULL);
return OMPI_SUCCESS;
}
/* Ensure that this module is not already loaded (should only happen
/* Ensure that this component is not already loaded (should only happen
if it was statically loaded). It's an error if it's already
loaded because we're evaluating this file -- not this module.
loaded because we're evaluating this file -- not this component.
Hence, returning OMPI_ERR_PARAM indicates that the *file* failed
to load, not the module. */
to load, not the component. */
for (cur = ompi_list_get_first(found_modules);
ompi_list_get_end(found_modules) != cur;
for (cur = ompi_list_get_first(found_components);
ompi_list_get_end(found_components) != cur;
cur = ompi_list_get_next(cur)) {
mitem = (mca_base_module_list_item_t *) cur;
if (0 == strcmp(mitem->mli_module->mca_type_name, target_file->type) &&
0 == strcmp(mitem->mli_module->mca_module_name, target_file->name)) {
mitem = (mca_base_component_list_item_t *) cur;
if (0 == strcmp(mitem->cli_component->mca_type_name, target_file->type) &&
0 == strcmp(mitem->cli_component->mca_component_name, target_file->name)) {
ompi_output_verbose(40, 0, " already loaded (ignored)", NULL);
target_file->status = FAILED_TO_LOAD;
return OMPI_ERR_BAD_PARAM;
}
}
/* Look at see if this module has any dependencies. If so, load
them. If we can't load them, then this module must also fail to
/* Look at see if this component has any dependencies. If so, load
them. If we can't load them, then this component must also fail to
load. */
OBJ_CONSTRUCT(&dependencies, ompi_list_t);
if (0 != check_ompi_info(target_file, &dependencies, found_modules)) {
if (0 != check_ompi_info(target_file, &dependencies, found_components)) {
target_file->status = FAILED_TO_LOAD;
free_dependency_list(&dependencies);
return OMPI_ERR_OUT_OF_RESOURCE;
}
/* Now try to load the module */
/* Now try to load the component */
module_handle = lt_dlopenext(target_file->filename);
if (NULL == module_handle) {
component_handle = lt_dlopenext(target_file->filename);
if (NULL == component_handle) {
ompi_output_verbose(40, 0, " unable to open: %s (ignored)",
lt_dlerror(), NULL);
target_file->status = FAILED_TO_LOAD;
@ -349,67 +348,66 @@ static int open_module(module_file_item_t *target_file,
return OMPI_ERR_BAD_PARAM;
}
/* Successfully opened the module; now find the public struct.
/* Successfully opened the component; now find the public struct.
Malloc out enough space for it. */
len = strlen(target_file->type) + strlen(target_file->name) + 32;
struct_name = malloc(len);
if (NULL == struct_name) {
lt_dlclose(module_handle);
lt_dlclose(component_handle);
target_file->status = FAILED_TO_LOAD;
free_dependency_list(&dependencies);
return OMPI_ERR_OUT_OF_RESOURCE;
}
snprintf(struct_name, len, "mca_%s_%s_module", target_file->type,
snprintf(struct_name, len, "mca_%s_%s_component", target_file->type,
target_file->name);
mitem = malloc(sizeof(mca_base_module_list_item_t));
mitem = OBJ_NEW(mca_base_component_list_item_t);
if (NULL == mitem) {
free(struct_name);
lt_dlclose(module_handle);
lt_dlclose(component_handle);
target_file->status = FAILED_TO_LOAD;
free_dependency_list(&dependencies);
return OMPI_ERR_OUT_OF_RESOURCE;
}
OBJ_CONSTRUCT(mitem, ompi_list_item_t);
module_struct = lt_dlsym(module_handle, struct_name);
if (NULL == module_struct) {
component_struct = lt_dlsym(component_handle, struct_name);
if (NULL == component_struct) {
ompi_output_verbose(40, 0, " \"%s\" does not appear to be a valid "
"%s MCA dynamic module (ignored)",
"%s MCA dynamic component (ignored)",
target_file->basename, target_file->type, NULL);
free(mitem);
free(struct_name);
lt_dlclose(module_handle);
lt_dlclose(component_handle);
target_file->status = FAILED_TO_LOAD;
free_dependency_list(&dependencies);
return OMPI_ERR_BAD_PARAM;
}
/* We found the public struct. Save it, and register this module to
/* We found the public struct. Save it, and register this component to
be closed later. */
mitem->mli_module = module_struct;
ompi_list_append(found_modules, (ompi_list_item_t *) mitem);
mca_base_module_repository_retain(target_file->type, module_handle,
module_struct);
mitem->cli_component = component_struct;
ompi_list_append(found_components, (ompi_list_item_t *) mitem);
mca_base_component_repository_retain(target_file->type, component_handle,
component_struct);
/* Now that that's all done, link all the dependencies in to this
module's repository entry */
component's repository entry */
for (cur = ompi_list_remove_first(&dependencies);
NULL != cur;
cur = ompi_list_remove_first(&dependencies)) {
ditem = (dependency_item_t *) cur;
mca_base_module_repository_link(target_file->type,
target_file->name,
ditem->di_module_file_item->type,
ditem->di_module_file_item->name);
mca_base_component_repository_link(target_file->type,
target_file->name,
ditem->di_component_file_item->type,
ditem->di_component_file_item->name);
OBJ_RELEASE(ditem);
}
OBJ_DESTRUCT(&dependencies);
ompi_output_verbose(40, 0, " opened dynamic %s MCA module \"%s\"",
ompi_output_verbose(40, 0, " opened dynamic %s MCA component \"%s\"",
target_file->type, target_file->name, NULL);
target_file->status = LOADED;
@ -422,13 +420,13 @@ static int open_module(module_file_item_t *target_file,
/*
* For a given filename, see if there exists a filename.ompi_info, which
* lists dependencies that must be loaded before this module is
* loaded. If we find this file, try to load those modules first.
* lists dependencies that must be loaded before this component is
* loaded. If we find this file, try to load those components first.
*
* Detect dependency cycles and error out.
*/
static int check_ompi_info(module_file_item_t *target_file,
ompi_list_t *dependencies, ompi_list_t *found_modules)
static int check_ompi_info(component_file_item_t *target_file,
ompi_list_t *dependencies, ompi_list_t *found_components)
{
int len;
FILE *fp;
@ -452,7 +450,7 @@ static int check_ompi_info(module_file_item_t *target_file,
}
/* Otherwise, loop reading the lines in the file and trying to load
them. Return failure upon the first module that fails to
them. Return failure upon the first component that fails to
load. */
ompi_output_verbose(40, 0, " opening ompi_info file: %s", depname, NULL);
@ -481,15 +479,15 @@ static int check_ompi_info(module_file_item_t *target_file,
else if (0 == strncasecmp(p, key_dependency, strlen(key_dependency))) {
if (OMPI_SUCCESS != check_dependency(p + strlen(key_dependency),
target_file, dependencies,
found_modules)) {
found_components)) {
fclose(fp);
free(depname);
/* We can leave any successfully loaded dependencies; we might
need them again later. But free the dependency list for
this module, because since [at least] one of them didn't
this component, because since [at least] one of them didn't
load, we have to pretend like all of them didn't load and
disallow loading this module. So free the dependency
disallow loading this component. So free the dependency
list. */
free_dependency_list(dependencies);
@ -510,17 +508,17 @@ static int check_ompi_info(module_file_item_t *target_file,
/*
* A DEPENDENCY key was found in the ompi_info file. Chase it down: see
* if we've already got such a module loaded, or go try to load it if
* if we've already got such a component loaded, or go try to load it if
* it's not already loaded.
*/
static int check_dependency(char *line, module_file_item_t *target_file,
static int check_dependency(char *line, component_file_item_t *target_file,
ompi_list_t *dependencies,
ompi_list_t *found_modules)
ompi_list_t *found_components)
{
bool happiness;
char buffer[BUFSIZ];
char *type, *name;
module_file_item_t *mitem;
component_file_item_t *mitem;
dependency_item_t *ditem;
ompi_list_item_t *cur;
@ -533,13 +531,13 @@ static int check_dependency(char *line, module_file_item_t *target_file,
*name = '\0';
++name;
/* Form the name of the module to compare to */
/* Form the name of the component to compare to */
if (strlen(type) + strlen(name) + 32 >= BUFSIZ) {
target_file->status = FAILED_TO_LOAD;
return OMPI_ERR_OUT_OF_RESOURCE;
}
snprintf(buffer, BUFSIZ, module_template, type);
snprintf(buffer, BUFSIZ, component_template, type);
strcat(buffer, name);
/* Traverse down the list of files that we have, and see if we can
@ -549,7 +547,7 @@ static int check_dependency(char *line, module_file_item_t *target_file,
for (happiness = false, cur = ompi_list_get_first(&found_files);
ompi_list_get_end(&found_files) != cur;
cur = ompi_list_get_next(cur)) {
mitem = (module_file_item_t *) cur;
mitem = (component_file_item_t *) cur;
/* Compare the name to the basename */
@ -560,7 +558,7 @@ static int check_dependency(char *line, module_file_item_t *target_file,
else if (mitem == target_file) {
ompi_output_verbose(40, 0,
" module depends on itself (ignored dependency)",
" component depends on itself (ignored dependency)",
NULL);
happiness = true;
break;
@ -600,7 +598,7 @@ static int check_dependency(char *line, module_file_item_t *target_file,
else if (UNVISITED == mitem->status) {
ompi_output_verbose(40, 0, " loading dependency (%s)",
mitem->basename, NULL);
if (OMPI_SUCCESS == open_module(target_file, found_modules)) {
if (OMPI_SUCCESS == open_component(target_file, found_components)) {
happiness = true;
} else {
ompi_output_verbose(40, 0, " dependency failed to load (%s)",
@ -624,7 +622,7 @@ static int check_dependency(char *line, module_file_item_t *target_file,
if (NULL == ditem) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
ditem->di_module_file_item = mitem;
ditem->di_component_file_item = mitem;
ompi_list_append(dependencies, (ompi_list_item_t*) ditem);
/* All done -- all depenencies satisfied */

329
src/mca/base/mca_base_component_repository.c Обычный файл
Просмотреть файл

@ -0,0 +1,329 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* Ensure to get the right <ltdl.h> */
#include "libltdl/ltdl.h"
#include "include/constants.h"
#include "class/ompi_list.h"
#include "mca/mca.h"
#include "mca/base/base.h"
/*
* Private types
*/
struct repository_item_t {
ompi_list_item_t super;
char ri_type[MCA_BASE_MAX_TYPE_NAME_LEN];
lt_dlhandle ri_dlhandle;
const mca_base_component_t *ri_component_struct;
ompi_list_t ri_dependencies;
};
typedef struct repository_item_t repository_item_t;
static void ri_constructor(ompi_object_t *obj);
static void ri_destructor(ompi_object_t *obj);
static OBJ_CLASS_INSTANCE(repository_item_t, ompi_list_item_t,
ri_constructor, ri_destructor);
struct dependency_item_t {
ompi_list_item_t super;
repository_item_t *di_repository_entry;
};
typedef struct dependency_item_t dependency_item_t;
static void di_constructor(ompi_object_t *obj);
static void di_destructor(ompi_object_t *obj);
static OBJ_CLASS_INSTANCE(dependency_item_t, ompi_list_item_t,
di_constructor, di_destructor);
/*
* Private variables
*/
static bool initialized = false;
static ompi_list_t repository;
/*
* Private functions
*/
static repository_item_t *find_component(const char *type, const char *name);
static int link_items(repository_item_t *src, repository_item_t *depend);
/*
* Initialize the repository
*/
int mca_base_component_repository_initialize(void)
{
/* Setup internal structures */
if (!initialized) {
/* Initialize libltdl */
if (lt_dlinit() != 0) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
OBJ_CONSTRUCT(&repository, ompi_list_t);
initialized = true;
}
/* All done */
return OMPI_SUCCESS;
}
/*
* Add a newly-opened dyanmic component to the repository of open
* components. The component's type, handle, and public struct are
* saved.
*/
int mca_base_component_repository_retain(char *type,
lt_dlhandle component_handle,
const mca_base_component_t *component_struct)
{
repository_item_t *ri;
/* Allocate a new repository item */
ri = OBJ_NEW(repository_item_t);
if (NULL == ri) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
/* Initialize the repository item */
strcpy(ri->ri_type, type);
ri->ri_dlhandle = component_handle;
ri->ri_component_struct = component_struct;
/* Append the new item to the repository */
ompi_list_append(&repository, (ompi_list_item_t *) ri);
/* All done */
return OMPI_SUCCESS;
}
/*
* Create a dependency from one component entry to another
*/
int mca_base_component_repository_link(const char *src_type,
const char *src_name,
const char *depend_type,
const char *depend_name)
{
repository_item_t *src, *depend;
/* Look up the two components */
src = find_component(src_type, src_name);
if (NULL == src) {
return OMPI_ERR_BAD_PARAM;
}
depend = find_component(depend_type, depend_name);
if (NULL == depend) {
return OMPI_ERR_BAD_PARAM;
}
/* Link them */
return link_items(src, depend);
}
/*
* If it's in the repository, close a specified component and remove
* it from the repository.
*/
void mca_base_component_repository_release(const mca_base_component_t *component)
{
repository_item_t *ri = find_component(component->mca_type_name,
component->mca_component_name);
if (NULL != ri) {
OBJ_RELEASE(ri);
}
}
/*
* Finalize the repository -- close everything that's still open.
*/
void mca_base_component_repository_finalize(void)
{
ompi_list_item_t *item;
repository_item_t *ri;
bool changed;
if (initialized) {
/* Have to be slightly careful about this because of dependencies,
particularly on OS's where it matters (i.e., closing a
component that is depended on by other components actually
causes missing symbols because the OS actually does unload it
from memory!), such as OS X.
So instead of just blindly closing everything, we have iterate
over the array of open components releasing everything with a
refcount of 1 -- skip anything with a refcount of more than 1.
Repeat this procedure until either we have nothing open or we
made one full pass and no refcounts went to 1 (which is
technically an error). */
do {
changed = false;
for (item = ompi_list_get_first(&repository);
ompi_list_get_end(&repository) != item && changed; ) {
ri = (repository_item_t *) item;
item = ompi_list_get_next(item);
OBJ_RELEASE(ri);
}
} while (ompi_list_get_size(&repository) > 0);
/* Close down libltdl */
lt_dlexit();
initialized = false;
}
}
static repository_item_t *find_component(const char *type, const char *name)
{
ompi_list_item_t *item;
repository_item_t *ri;
for (item = ompi_list_get_first(&repository);
ompi_list_get_end(&repository) != item;
item = ompi_list_get_next(item)) {
ri = (repository_item_t *) item;
if (0 == strcmp(ri->ri_type, type) &&
0 == strcmp(ri->ri_component_struct->mca_component_name, name)) {
return ri;
}
}
/* Not found */
return NULL;
}
static int link_items(repository_item_t *src, repository_item_t *depend)
{
dependency_item_t *di;
/* Bozo check */
if (NULL == src || NULL == depend) {
return OMPI_ERR_BAD_PARAM;
}
/* Make a new depedency item */
di = OBJ_NEW(dependency_item_t);
if (NULL == di) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
/* Initialize the new dependency item */
di->di_repository_entry = depend;
/* Add it to the dependency list on the source repository entry */
ompi_list_append(&src->ri_dependencies, (ompi_list_item_t *) di);
/* Increment the refcount in the dependency */
OBJ_RETAIN(depend);
/* All done */
return OMPI_SUCCESS;
}
/*
* Basic sentinel values, and construct the inner list
*/
static void ri_constructor(ompi_object_t *obj)
{
repository_item_t *ri = (repository_item_t *) obj;
memset(ri->ri_type, 0, sizeof(ri->ri_type));
ri->ri_dlhandle = NULL;
ri->ri_component_struct = NULL;
OBJ_CONSTRUCT(&ri->ri_dependencies, ompi_list_t);
}
/*
* Close a component
*/
static void ri_destructor(ompi_object_t *obj)
{
repository_item_t *ri = (repository_item_t *) obj;
dependency_item_t *di;
ompi_list_item_t *item;
/* Close the component (and potentially unload it from memory */
lt_dlclose(ri->ri_dlhandle);
/* It should be obvious, but I'll state it anyway because it bit me
during debugging: after the dlclose(), the mca_base_component_t
pointer is no longer valid because it has [potentially] been
unloaded from memory. So don't try to use it. :-) */
/* Now go release/close (at a minimum: decrement the refcount) any
dependencies of this component */
for (item = ompi_list_remove_first(&ri->ri_dependencies);
NULL != item;
item = ompi_list_remove_first(&ri->ri_dependencies)) {
di = (dependency_item_t *) item;
OBJ_RELEASE(di);
}
OBJ_DESTRUCT(&ri->ri_dependencies);
ompi_list_remove_item(&repository, (ompi_list_item_t *) ri);
}
/*
* Basic sentinel values
*/
static void di_constructor(ompi_object_t *obj)
{
dependency_item_t *di = (dependency_item_t *) obj;
di->di_repository_entry = NULL;
}
/*
* When a dependency item is released, go release the repository entry
* that it points to
*/
static void di_destructor(ompi_object_t *obj)
{
dependency_item_t *di = (dependency_item_t *) obj;
OBJ_RELEASE(di->di_repository_entry);
}

67
src/mca/base/mca_base_components_close.c Обычный файл
Просмотреть файл

@ -0,0 +1,67 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include "class/ompi_list.h"
#include "util/output.h"
#include "mca/mca.h"
#include "mca/base/base.h"
int mca_base_components_close(int output_id,
ompi_list_t *components_available,
const mca_base_component_t *skip)
{
ompi_list_item_t *item;
mca_base_component_list_item_t *cli;
const mca_base_component_t *component;
/* Close and unload all components in the available list, except the
"skip" item. This is handy to close out all non-selected
components. It's easier to simply remove the entire list and
then simply re-add the skip entry when done. */
for (item = ompi_list_remove_first(components_available);
NULL != item;
item = ompi_list_remove_first(components_available)) {
cli = (mca_base_component_list_item_t *) item;
component = cli->cli_component;
if (component != skip) {
/* Close */
if (NULL != component->mca_close_component) {
component->mca_close_component();
ompi_output_verbose(10, output_id, "close: component %s closed",
component->mca_component_name);
}
/* Unload */
mca_base_component_repository_release((mca_base_component_t *) component);
ompi_output_verbose(10, output_id, "close: component %s unloaded",
component->mca_component_name);
}
free(cli);
}
/* Re-add the skipped component to the available list (see above
comment) */
if (NULL != skip) {
cli = malloc(sizeof(mca_base_component_list_item_t));
if (NULL == cli) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
cli->cli_component = skip;
ompi_list_append(components_available, (ompi_list_item_t *) cli);
}
/* All done */
return OMPI_SUCCESS;
}

271
src/mca/base/mca_base_components_open.c Обычный файл
Просмотреть файл

@ -0,0 +1,271 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "class/ompi_list.h"
#include "util/strncpy.h"
#include "util/argv.h"
#include "util/output.h"
#include "mca/mca.h"
#include "mca/base/base.h"
struct component_name_t {
ompi_list_item_t super;
char mn_name[MCA_BASE_MAX_COMPONENT_NAME_LEN];
};
typedef struct component_name_t component_name_t;
/*
* Local functions
*/
static int open_components(const char *type_name, int output_id,
ompi_list_t *components_found,
ompi_list_t *components_available,
char **requested_component_names);
static int parse_requested(int mca_param, char ***requested_component_names);
/**
* Function for finding and opening either all MCA components, or the
* one that was specifically requested via a MCA parameter.
*/
int mca_base_components_open(const char *type_name, int output_id,
const mca_base_component_t **static_components,
ompi_list_t *components_available)
{
int ret;
ompi_list_item_t *item;
ompi_list_t components_found;
char **requested_component_names;
int param_verbose = -1;
int param_type = -1;
int verbose_level;
/* Register MCA parameters */
param_verbose = mca_base_param_register_int(type_name, "base",
"verbose", NULL, 0);
param_type = mca_base_param_register_string(type_name, "base", NULL,
type_name, NULL);
/* Setup verbosity for this MCA type */
mca_base_param_lookup_int(param_verbose, &verbose_level);
if (output_id != 0) {
ompi_output_set_verbosity(output_id, verbose_level);
}
ompi_output_verbose(10, output_id, "open: Looking for components");
/* Find and load all available components */
if (OMPI_SUCCESS !=
mca_base_component_find(NULL, type_name, static_components,
&components_found)) {
return OMPI_ERROR;
}
/* See if one or more specific components were requested */
ret = parse_requested(param_type, &requested_component_names);
if (OMPI_SUCCESS == ret) {
ret = open_components(type_name, output_id, &components_found,
components_available,
requested_component_names);
}
/* Free resources */
for (item = ompi_list_remove_first(&components_found); NULL != item;
item = ompi_list_remove_first(&components_found)) {
OBJ_RELEASE(item);
}
if (NULL != requested_component_names) {
ompi_argv_free(requested_component_names);
}
/* All done */
return ret;
}
static int parse_requested(int mca_param, char ***requested_component_names)
{
char *requested;
char *comma;
char *start;
int argc;
*requested_component_names = NULL;
/* See if the user requested anything */
if (OMPI_ERROR == mca_base_param_lookup_string(mca_param, &requested)) {
return OMPI_ERROR;
}
if (NULL == requested) {
return OMPI_SUCCESS;
}
/* Loop over all names (yes, this could be more clever, but it's
nice and obvious this way!) */
start = requested;
comma = strchr(start, ',');
while (NULL != comma) {
*comma = '\0';
ompi_argv_append(&argc, requested_component_names, start);
start = comma + 1;
comma = strchr(start, ',');
}
/* The last name */
ompi_argv_append(&argc, requested_component_names, start);
/* All done */
return OMPI_SUCCESS;
}
/*
* Traverse the entire list of found components (a list of
* mca_base_component_t instances). If the requested_component_names
* array is empty, or the name of each component in the list of found
* components is in the requested_components_array, try to open it.
* If it opens, add it to the components_available list.
*/
static int open_components(const char *type_name, int output_id,
ompi_list_t *components_found,
ompi_list_t *components_available,
char **requested_component_names)
{
int i;
ompi_list_item_t *item;
const mca_base_component_t *component;
mca_base_component_list_item_t *cli;
bool acceptable;
bool called_open;
bool opened;
/* Announce */
if (NULL == requested_component_names) {
ompi_output_verbose(10, output_id,
"open: looking for any %s components", type_name);
} else {
ompi_output_verbose(10, output_id,
"open: looking for specific %s components:",
type_name);
for (i = 0; NULL != requested_component_names[i]; ++i) {
ompi_output_verbose(10, output_id, "open: %s",
requested_component_names[i]);
}
}
/* Traverse the list of found components */
OBJ_CONSTRUCT(components_available, ompi_list_t);
for (item = ompi_list_get_first(components_found);
ompi_list_get_end(components_found) != item;
item = ompi_list_get_next(item)) {
cli = (mca_base_component_list_item_t *) item;
component = cli->cli_component;
/* Do we need to check for specific components? */
if (NULL != requested_component_names) {
acceptable = false;
for (i = 0; NULL != requested_component_names[i]; ++i) {
if (0 == strcmp(requested_component_names[i],
component->mca_component_name)) {
acceptable = true;
break;
}
}
} else {
acceptable = true;
}
/* If this is an acceptable component, try to open it */
if (acceptable) {
opened = called_open = false;
ompi_output_verbose(10, output_id, "open: found loaded component %s",
component->mca_component_name);
if (NULL == component->mca_open_component) {
opened = true;
ompi_output_verbose(10, output_id,
"open: component %s has no open function",
component->mca_component_name);
} else {
called_open = true;
if (MCA_SUCCESS == component->mca_open_component()) {
opened = true;
ompi_output_verbose(10, output_id,
"open: component %s open function successful",
component->mca_component_name);
} else {
ompi_output_verbose(10, output_id,
"open: component %s open function failed",
component->mca_component_name);
}
}
/* If it didn't open, close it out and get rid of it */
if (!opened) {
if (called_open) {
if (NULL != component->mca_close_component) {
component->mca_close_component();
}
ompi_output_verbose(10, output_id,
"open: component %s closed",
component->mca_component_name);
called_open = false;
}
mca_base_component_repository_release(component);
ompi_output_verbose(10, output_id,
"open: component %s unloaded",
component->mca_component_name);
}
/* If it did open, register its "priority" MCA parameter (if it
doesn't already have one) and save it in the opened_components
list */
else {
if (OMPI_ERROR == mca_base_param_find(type_name,
component->mca_component_name,
"priority")) {
mca_base_param_register_int(type_name,
component->mca_component_name,
"priority", NULL, 0);
}
cli = OBJ_NEW(mca_base_component_list_item_t);
if (NULL == cli) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
cli->cli_component = component;
ompi_list_append(components_available, (ompi_list_item_t *) cli);
}
}
}
/* All done */
return OMPI_SUCCESS;
}

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

@ -28,9 +28,9 @@
*
* The contents of this function will likely be replaced
*/
int mca_base_init_select_modules(int requested,
bool allow_multi_user_threads,
bool have_hidden_threads, int *provided)
int mca_base_init_select_components(int requested,
bool allow_multi_user_threads,
bool have_hidden_threads, int *provided)
{
bool user_threads, hidden_threads;
@ -88,7 +88,7 @@ int mca_base_init_select_modules(int requested,
/* Tell the selected pml module about all the selected ptl
modules */
mca_pml.pml_add_ptls(&mca_ptl_base_modules_initialized);
mca_pml.pml_add_ptls(&mca_ptl_base_components_initialized);
/* All done */

53
src/mca/base/mca_base_list.c Обычный файл
Просмотреть файл

@ -0,0 +1,53 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include "class/ompi_list.h"
#include "mca/base/base.h"
/*
* Local functions
*/
static void cl_constructor(ompi_object_t *obj);
static void cpl_constructor(ompi_object_t *obj);
/*
* Class instance of the mca_base_component_list_item_t class
*/
OBJ_CLASS_INSTANCE(mca_base_component_list_item_t,
ompi_list_item_t, cl_constructor, NULL);
/*
* Class instance of the mca_base_component_priority_list_item_t class
*/
OBJ_CLASS_INSTANCE(mca_base_component_priority_list_item_t,
ompi_list_item_t, cpl_constructor, NULL);
/*
* Just do basic sentinel intialization
*/
static void cl_constructor(ompi_object_t *obj)
{
mca_base_component_list_item_t *cli = (mca_base_component_list_item_t *) obj;
cli->cli_component = NULL;
}
/*
* Just do basic sentinel intialization
*/
static void cpl_constructor(ompi_object_t *obj)
{
mca_base_component_priority_list_item_t *cpli =
(mca_base_component_priority_list_item_t *) obj;
cpli->cpli_priority = -1;
cpli->cpli_allow_multi_user_threads = false;
cpli->cpli_have_hidden_threads = false;
cpli->cpli_component = NULL;
}

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

@ -1,67 +0,0 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <string.h>
#include "mca/mca.h"
#include "mca/base/base.h"
/*
* Function for comparing two mca_base_module_priorit_t structs so
* that we can build prioritized LIST's of them. This assumed that
* the types of the modules are the same. Sort first by priority,
* second by module name, third by module version.
*
* Note that we acutally want a *reverse* ordering here -- the al_*
* functions will put "smaller" items at the head, and "larger" items
* at the tail. Since we want the highest priority at the head, it
* may help the gentle reader to consider this an inverse comparison.
* :-)
*/
int mca_base_module_compare_priority(
mca_base_module_priority_list_item_t *a,
mca_base_module_priority_list_item_t *b)
{
/* First, compare the priorties */
if (a->mpli_priority > b->mpli_priority)
return -1;
else if (a->mpli_priority < b->mpli_priority)
return 1;
else
return mca_base_module_compare(a->mpli_module, b->mpli_module);
}
int mca_base_module_compare(const mca_base_module_t* aa,
const mca_base_module_t* bb)
{
/* The priorities were equal, so compare the names */
int val = strncmp(aa->mca_module_name, bb->mca_module_name,
MCA_BASE_MAX_MODULE_NAME_LEN);
if (val != 0)
return -val;
/* The names were equal, so compare the versions */
if (aa->mca_module_major_version > bb->mca_module_major_version)
return -1;
else if (aa->mca_module_major_version < bb->mca_module_major_version)
return 1;
else if (aa->mca_module_minor_version > bb->mca_module_minor_version)
return -1;
else if (aa->mca_module_minor_version < bb->mca_module_minor_version)
return 1;
else if (aa->mca_module_release_version > bb->mca_module_release_version)
return -1;
else if (aa->mca_module_release_version < bb->mca_module_release_version)
return 1;
return 0;
}

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

@ -22,7 +22,7 @@
struct mca_base_modex_module_t {
ompi_list_item_t super;
mca_base_module_t *module;
mca_base_component_t *component;
void *module_data;
size_t module_data_size;
};
@ -30,7 +30,7 @@ typedef struct mca_base_modex_module_t mca_base_modex_module_t;
static void mca_base_modex_module_construct(mca_base_modex_module_t *module)
{
module->module = NULL;
module->component = NULL;
module->module_data = NULL;
module->module_data_size = 0;
}
@ -80,15 +80,16 @@ OBJ_CLASS_INSTANCE(
* Look to see if there is any data associated with a specified module.
*/
static inline mca_base_modex_module_t* mca_base_modex_lookup_module(
static mca_base_modex_module_t* mca_base_modex_lookup_module(
mca_base_modex_t* modex,
mca_base_module_t* module)
mca_base_component_t* component)
{
mca_base_modex_module_t* modex_module;
for(modex_module = (mca_base_modex_module_t*)ompi_list_get_first(&modex->modex_modules);
modex_module != (mca_base_modex_module_t*)ompi_list_get_end(&modex->modex_modules);
modex_module = (mca_base_modex_module_t*)ompi_list_get_next(modex_module)) {
if(mca_base_module_compare(modex_module->module, module) == 0) {
if(mca_base_component_compare(modex_module->component,
component) == 0) {
return modex_module;
}
}
@ -100,16 +101,18 @@ static inline mca_base_modex_module_t* mca_base_modex_lookup_module(
* Create a placeholder for data associated with the specified module.
*/
static inline mca_base_modex_module_t* mca_base_modex_create_module(
static mca_base_modex_module_t* mca_base_modex_create_module(
mca_base_modex_t* modex,
mca_base_module_t* module)
mca_base_component_t* component)
{
mca_base_modex_module_t* modex_module;
if(NULL == (modex_module = mca_base_modex_lookup_module(modex, module))) {
if(NULL == (modex_module = mca_base_modex_lookup_module(modex,
component))) {
modex_module = OBJ_NEW(mca_base_modex_module_t);
if(NULL != modex_module) {
modex_module->module = module;
ompi_list_append(&modex->modex_modules, (ompi_list_item_t*)modex_module);
modex_module->component = component;
ompi_list_append(&modex->modex_modules,
(ompi_list_item_t*)modex_module);
}
}
return modex_module;
@ -122,7 +125,8 @@ static inline mca_base_modex_module_t* mca_base_modex_create_module(
* during mca_base_modex_exchange().
*/
int mca_base_modex_send(mca_base_module_t *source_module, const void *buffer, size_t size)
int mca_base_modex_send(mca_base_component_t *source_component,
const void *buffer, size_t size)
{
ompi_proc_t *self = ompi_proc_local();
mca_base_modex_t* modex;
@ -136,7 +140,8 @@ int mca_base_modex_send(mca_base_module_t *source_module, const void *buffer, si
self->proc_modex = modex = OBJ_NEW(mca_base_modex_t);
}
if(NULL == (modex_module = mca_base_modex_create_module(modex, source_module))) {
if(NULL == (modex_module = mca_base_modex_create_module(modex,
source_component))) {
OMPI_THREAD_UNLOCK(&self->proc_lock);
return OMPI_ERROR;
}
@ -159,7 +164,8 @@ int mca_base_modex_send(mca_base_module_t *source_module, const void *buffer, si
* mca_base_modex_exchange().
*/
int mca_base_modex_recv(mca_base_module_t *module, ompi_proc_t *source_proc, void **buffer, size_t *size)
int mca_base_modex_recv(mca_base_component_t *component,
ompi_proc_t *source_proc, void **buffer, size_t *size)
{
mca_base_modex_t* modex;
mca_base_modex_module_t* modex_module;
@ -167,7 +173,8 @@ int mca_base_modex_recv(mca_base_module_t *module, ompi_proc_t *source_proc, voi
OMPI_THREAD_LOCK(&source_proc->proc_lock);
if(NULL == (modex = source_proc->proc_modex) ||
NULL == (modex_module = mca_base_modex_lookup_module(modex, module))) {
NULL == (modex_module = mca_base_modex_lookup_module(modex,
component))) {
OMPI_THREAD_UNLOCK(&source_proc->proc_lock);
return OMPI_ERR_NOT_FOUND;
}
@ -269,7 +276,7 @@ int mca_base_modex_exchange(void)
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
proc_module = mca_base_modex_create_module(proc->proc_modex, self_module->module);
proc_module = mca_base_modex_create_module(proc->proc_modex, self_module->component);
if(NULL == proc_module) {
free(procs);
OMPI_THREAD_UNLOCK(&proc->proc_lock);

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

@ -22,8 +22,8 @@ extern "C" {
* Send a module-specific buffer to all other corresponding MCA
* modules in peer processes.
*
* @param source_module A pointer to this module's mca_base_module_t
* instance.
* @param source_component A pointer to this module's component
* structure (i.e., mca_base_component_t)
* @param buffer A pointer to the beginning of the buffer to send.
* @param size Number of bytes of each instance in the buffer.
* @param count Number of instances in the buffer.
@ -33,16 +33,17 @@ extern "C" {
*
* This function takes a contiguous buffer of network-ordered data
* and makes it available to all other MCA processes during the
* selection process. Modules sent by one source_module can only be
* received by a corresponding module in peer processes.
* selection process. Modules sent by one source_component can only
* be received by a corresponding module with the same
* source_componennt in peer processes.
*
* Two modules are "corresponding" if:
* Two components are "corresponding" if:
*
* - they share the same major and minor MCA version number
* - they have the same type name string
* - they share the same major and minor type version number
* - they have the same module name string
* - they share the same major and minor module version number
* - they have the same component name string
* - they share the same major and minor component version number
*
* This function is indended to be used during MCA module
* initialization \em before \em selection (the selection process is
@ -71,15 +72,15 @@ extern "C" {
* in some format that peer processes will be able to read it,
* regardless of pointer sizes or endian bias.
*/
int mca_base_modex_send(mca_base_module_t *source_module,
int mca_base_modex_send(mca_base_component_t *source_component,
const void *buffer, size_t size);
/**
* Receive a module-specific buffer from a corresponding MCA module
* in a specific peer process.
*
* @param dest_module A pointer to this module's mca_base_module_t
* instance.
* @param dest_component A pointer to this module's component struct
* (i.e., mca_base_component_t instance).
* @param source_proc Peer process to receive from.
* @param buffer A pointer to a (void*) that will be filled with a
* pointer to the received buffer.
@ -107,7 +108,7 @@ extern "C" {
* count). See the explanation in mca_base_modex_send() for why the
* number of bytes is split into two parts.
*/
int mca_base_modex_recv(mca_base_module_t *dest_module,
int mca_base_modex_recv(mca_base_component_t *dest_component,
ompi_proc_t *source_proc,
void **buffer, size_t *size);

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

@ -1,293 +0,0 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* Ensure to get the right <ltdl.h> */
#include "libltdl/ltdl.h"
#include "include/constants.h"
#include "class/ompi_list.h"
#include "mca/mca.h"
#include "mca/base/base.h"
/*
* Private types
*/
struct repository_item_t {
ompi_list_item_t super;
char ri_type[MCA_BASE_MAX_TYPE_NAME_LEN];
lt_dlhandle ri_dlhandle;
const mca_base_module_t *ri_module_struct;
int ri_refcount;
ompi_list_t ri_dependencies;
};
typedef struct repository_item_t repository_item_t;
struct dependency_item_t {
ompi_list_item_t super;
repository_item_t *di_repository_entry;
};
typedef struct dependency_item_t dependency_item_t;
/*
* Private variables
*/
static bool initialized = false;
static ompi_list_t repository;
/*
* Private functions
*/
static repository_item_t *find_module(const char *type, const char *name);
static int link_items(repository_item_t *src, repository_item_t *depend);
static void release_repository_item(repository_item_t *ri);
/*
* Initialize the repository
*/
int mca_base_module_repository_initialize(void)
{
/* Setup internal structures */
if (!initialized) {
/* Initialize libltdl */
if (lt_dlinit() != 0)
return OMPI_ERR_OUT_OF_RESOURCE;
OBJ_CONSTRUCT(&repository, ompi_list_t);
initialized = true;
}
/* All done */
return OMPI_SUCCESS;
}
/*
* Add a newly-opened dyanmic module to the repository of open modules.
* The module's type, handle, and public struct are saved.
*/
int mca_base_module_repository_retain(char *type, lt_dlhandle module_handle,
const mca_base_module_t *module_struct)
{
repository_item_t *ri;
/* Allocate a new repository item */
ri = malloc(sizeof(repository_item_t));
if (NULL == ri)
return OMPI_ERR_OUT_OF_RESOURCE;
/* Initialize the repository item */
OBJ_CONSTRUCT(ri, ompi_list_item_t);
strcpy(ri->ri_type, type);
ri->ri_dlhandle = module_handle;
ri->ri_module_struct = module_struct;
ri->ri_refcount = 1;
OBJ_CONSTRUCT(&ri->ri_dependencies, ompi_list_t);
/* Append the new item to the repository */
ompi_list_append(&repository, (ompi_list_item_t *) ri);
/* All done */
return OMPI_SUCCESS;
}
/*
* Create a dependency from one module entry to another
*/
int mca_base_module_repository_link(const char *src_type,
const char *src_name,
const char *depend_type,
const char *depend_name)
{
repository_item_t *src, *depend;
/* Look up the two modules */
src = find_module(src_type, src_name);
if (NULL == src)
return OMPI_ERR_BAD_PARAM;
depend = find_module(depend_type, depend_name);
if (NULL == depend)
return OMPI_ERR_BAD_PARAM;
/* Link them */
return link_items(src, depend);
}
/*
* If it's in the registr, close a specified module and remove it from
* the repository.
*/
void mca_base_module_repository_release(const mca_base_module_t *module)
{
repository_item_t *ri = find_module(module->mca_type_name,
module->mca_module_name);
if (NULL != ri)
release_repository_item(ri);
}
/*
* Finalize the repository -- close everything that's still open.
*/
void mca_base_module_repository_finalize(void)
{
ompi_list_item_t *item;
repository_item_t *ri;
bool changed;
if (initialized) {
/* Have to be slightly careful about this because of dependencies,
particularly on OS's where it matters (i.e., closing a module
that is depended on by other modules actually causes missing
symbols because the OS actually does unload it from memory!),
such as OS X.
So instead of just blindly closing everything, we have iterate
over the array of open modules releasing everything with a
refcount of 1 -- skip anything with a refcount of more than 1.
Repeat this procedure until either we have nothing open or we
made one full pass and no refcounts went to 1 (which is
technically an error). */
do {
changed = false;
for (item = ompi_list_get_first(&repository);
ompi_list_get_end(&repository) != item && changed;
item = ompi_list_get_next(item)) {
ri = (repository_item_t *) ri;
if (ri->ri_refcount == 1) {
release_repository_item(ri);
changed = true;
}
}
} while (ompi_list_get_size(&repository) > 0 && changed);
/* Close down libltdl */
lt_dlexit();
initialized = false;
}
}
static repository_item_t *find_module(const char *type, const char *name)
{
ompi_list_item_t *item;
repository_item_t *ri;
for (item = ompi_list_get_first(&repository);
ompi_list_get_end(&repository) != item;
item = ompi_list_get_next(item)) {
ri = (repository_item_t *) item;
if (0 == strcmp(ri->ri_type, type) &&
0 == strcmp(ri->ri_module_struct->mca_module_name, name))
return ri;
}
/* Not found */
return NULL;
}
static int link_items(repository_item_t *src, repository_item_t *depend)
{
dependency_item_t *di;
/* Bozo check */
if (NULL == src || NULL == depend)
return OMPI_ERR_BAD_PARAM;
/* Make a new depedency item */
di = malloc(sizeof(dependency_item_t));
if (NULL == di)
return OMPI_ERR_OUT_OF_RESOURCE;
/* Initialize the new dependency item */
OBJ_CONSTRUCT((ompi_list_item_t *) di, ompi_list_item_t);
di->di_repository_entry = depend;
/* Add it to the dependency list on the source repository entry */
ompi_list_append(&src->ri_dependencies, (ompi_list_item_t *) di);
/* Increment the refcount in the dependency */
++src->ri_refcount;
/* All done */
return OMPI_SUCCESS;
}
static void release_repository_item(repository_item_t *ri)
{
dependency_item_t *di;
ompi_list_item_t *item;
/* Bozo check */
if (NULL == ri)
return;
/* Decrement this module's refcount. If zero, close and free it. */
--ri->ri_refcount;
if (0 <= ri->ri_refcount) {
lt_dlclose(ri->ri_dlhandle);
/* Now go release/close (at a minimum: decrement the refcount) any
dependencies of this module */
for (item = ompi_list_remove_first(&ri->ri_dependencies);
NULL != item;
item = ompi_list_remove_first(&ri->ri_dependencies)) {
di = (dependency_item_t *) item;
--di->di_repository_entry->ri_refcount;
if (0 == di->di_repository_entry->ri_refcount) {
release_repository_item(di->di_repository_entry);
}
free(di);
}
/* It should be obvious, but I'll state it anyway because it bit
me during debugging: after the dlclose(), the mca_base_module_t
pointer is no longer valid because it has [potentially] been
unloaded from memory. So don't try to use it. :-) */
OBJ_DESTRUCT(&ri->ri_dependencies);
ompi_list_remove_item(&repository, (ompi_list_item_t *) ri);
free(ri);
}
}

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

@ -1,66 +0,0 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include "class/ompi_list.h"
#include "util/output.h"
#include "mca/mca.h"
#include "mca/base/base.h"
int mca_base_modules_close(int output_id, ompi_list_t *modules_available,
const mca_base_module_t *skip)
{
ompi_list_item_t *item;
mca_base_module_list_item_t *mli;
const mca_base_module_t *module;
/* Close and unload all modules in the available list, except the
"skip" item. This is handy to close out all non-selected
modules. It's easier to simply remove the entire list and then
simply re-add the skip entry when done. */
for (item = ompi_list_remove_first(modules_available);
NULL != item;
item = ompi_list_remove_first(modules_available)) {
mli = (mca_base_module_list_item_t *) item;
module = mli->mli_module;
if (module != skip) {
/* Close */
if (NULL != module->mca_close_module) {
module->mca_close_module();
ompi_output_verbose(10, output_id, "close: module %s closed",
module->mca_module_name);
}
/* Unload */
mca_base_module_repository_release((mca_base_module_t *) module);
ompi_output_verbose(10, output_id, "close: module %s unloaded",
module->mca_module_name);
}
free(mli);
}
/* Re-add the skipped module to the available list (see above
comment) */
if (NULL != skip) {
mli = malloc(sizeof(mca_base_module_list_item_t));
if (NULL == mli) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
mli->mli_module = skip;
ompi_list_append(modules_available, (ompi_list_item_t *) mli);
}
/* All done */
return OMPI_SUCCESS;
}

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

@ -1,268 +0,0 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "class/ompi_list.h"
#include "util/strncpy.h"
#include "util/argv.h"
#include "util/output.h"
#include "mca/mca.h"
#include "mca/base/base.h"
struct module_name_t {
ompi_list_item_t super;
char mn_name[MCA_BASE_MAX_MODULE_NAME_LEN];
};
typedef struct module_name_t module_name_t;
/*
* Local functions
*/
static int open_modules(const char *type_name, int output_id,
ompi_list_t *modules_found,
ompi_list_t *modules_available,
char **requested_module_names);
static int parse_requested(int mca_param, char ***requested_module_names);
/**
* Function for finding and opening either all MCA modules, or the one
* that was specifically requested via a MCA parameter.
*/
int mca_base_modules_open(const char *type_name, int output_id,
const mca_base_module_t **static_modules,
ompi_list_t *modules_available)
{
int ret;
ompi_list_item_t *item;
ompi_list_t modules_found;
char **requested_module_names;
int param_verbose = -1;
int param_type = -1;
int verbose_level;
/* Register MCA parameters */
param_verbose = mca_base_param_register_int(type_name, "base",
"verbose", NULL, 0);
param_type = mca_base_param_register_string(type_name, "base", NULL,
type_name, NULL);
/* Setup verbosity for this MCA type */
mca_base_param_lookup_int(param_verbose, &verbose_level);
if (output_id != 0) {
ompi_output_set_verbosity(output_id, verbose_level);
}
ompi_output_verbose(10, output_id, "open: Looking for modules");
/* Find and load all available modules */
if (OMPI_SUCCESS !=
mca_base_module_find(NULL, type_name, static_modules, &modules_found)) {
return OMPI_ERROR;
}
/* See if one or more specific modules were requested */
ret = parse_requested(param_type, &requested_module_names);
if (OMPI_SUCCESS == ret) {
ret = open_modules(type_name, output_id, &modules_found, modules_available,
requested_module_names);
}
/* Free resources */
for (item = ompi_list_remove_first(&modules_found); NULL != item;
item = ompi_list_remove_first(&modules_found)) {
free(item);
}
if (NULL != requested_module_names) {
ompi_argv_free(requested_module_names);
}
/* All done */
return ret;
}
static int parse_requested(int mca_param, char ***requested_module_names)
{
char *requested;
char *comma;
char *start;
int argc;
*requested_module_names = NULL;
/* See if the user requested anything */
if (OMPI_ERROR == mca_base_param_lookup_string(mca_param, &requested)) {
return OMPI_ERROR;
}
if (NULL == requested) {
return OMPI_SUCCESS;
}
/* Loop over all names (yes, this could be more clever, but it's
nice and obvious this way!) */
start = requested;
comma = strchr(start, ',');
while (NULL != comma) {
*comma = '\0';
ompi_argv_append(&argc, requested_module_names, start);
start = comma + 1;
comma = strchr(start, ',');
}
/* The last name */
ompi_argv_append(&argc, requested_module_names, start);
/* All done */
return OMPI_SUCCESS;
}
/*
* Traverse the entire list of found modules (a list of
* mca_base_module_t instances). If the requested_module_names array
* is empty, or the name of each module in the list of found modules
* is in the requested_modules_array, try to open it. If it opens,
* add it to the modules_available list.
*/
static int open_modules(const char *type_name, int output_id,
ompi_list_t *modules_found,
ompi_list_t *modules_available,
char **requested_module_names)
{
int i;
ompi_list_item_t *item;
const mca_base_module_t *module;
mca_base_module_list_item_t *mli;
bool acceptable;
bool called_open;
bool opened;
/* Announce */
if (NULL == requested_module_names) {
ompi_output_verbose(10, output_id,
"open: looking for any %s modules", type_name);
} else {
ompi_output_verbose(10, output_id,
"open: looking for specific %s modules:", type_name);
for (i = 0; NULL != requested_module_names[i]; ++i) {
ompi_output_verbose(10, output_id, "open: %s",
requested_module_names[i]);
}
}
/* Traverse the list of found modules */
OBJ_CONSTRUCT(modules_available, ompi_list_t);
for (item = ompi_list_get_first(modules_found);
ompi_list_get_end(modules_found) != item;
item = ompi_list_get_next(item)) {
mli = (mca_base_module_list_item_t *) item;
module = mli->mli_module;
/* Do we need to check for specific modules? */
if (NULL != requested_module_names) {
acceptable = false;
for (i = 0; NULL != requested_module_names[i]; ++i) {
if (0 == strcmp(requested_module_names[i], module->mca_module_name)) {
acceptable = true;
break;
}
}
} else {
acceptable = true;
}
/* If this is an acceptable module, try to open it */
if (acceptable) {
opened = called_open = false;
ompi_output_verbose(10, output_id, "open: found loaded module %s",
module->mca_module_name);
if (NULL == module->mca_open_module) {
opened = true;
ompi_output_verbose(10, output_id,
"open: module %s has no open function",
module->mca_module_name);
} else {
called_open = true;
if (MCA_SUCCESS == module->mca_open_module()) {
opened = true;
ompi_output_verbose(10, output_id,
"open: module %s open function successful",
module->mca_module_name);
} else {
ompi_output_verbose(10, output_id,
"open: module %s open function failed",
module->mca_module_name);
}
}
/* If it didn't open, close it out and get rid of it */
if (!opened) {
if (called_open) {
if (NULL != module->mca_close_module) {
module->mca_close_module();
}
ompi_output_verbose(10, output_id,
"open: module %s closed",
module->mca_module_name);
called_open = false;
}
mca_base_module_repository_release(module);
ompi_output_verbose(10, output_id,
"open: module %s unloaded",
module->mca_module_name);
}
/* If it did open, register its "priority" MCA parameter (if it
doesn't already have one) and save it in the opened_modules
list */
else {
if (OMPI_ERROR == mca_base_param_find(type_name,
module->mca_module_name,
"priority")) {
mca_base_param_register_int(type_name,
module->mca_module_name,
"priority", NULL, 0);
}
mli = malloc(sizeof(mca_base_module_list_item_t));
if (NULL == mli) {
return OMPI_ERROR;
}
OBJ_CONSTRUCT(&mli->super, ompi_list_item_t);
mli->mli_module = module;
ompi_list_append(modules_available, (ompi_list_item_t *) mli);
}
}
}
/* All done */
return OMPI_SUCCESS;
}

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

@ -16,7 +16,7 @@
/*
* Public variables
*/
int mca_base_param_module_path = -1;
int mca_base_param_component_path = -1;
bool mca_base_opened = false;
/*
@ -43,9 +43,9 @@ int mca_base_open(void)
/* Register some params */
mca_base_param_module_path =
mca_base_param_register_string("base", NULL, "module_path",
"module_path", OMPI_PKGLIBDIR);
mca_base_param_component_path =
mca_base_param_register_string("base", NULL, "component_path",
"component_path", OMPI_PKGLIBDIR);
param_index = mca_base_param_register_string("base", NULL, "verbose",
"verbose", NULL);
@ -61,9 +61,9 @@ int mca_base_open(void)
ompi_output_reopen(0, &lds);
ompi_output_verbose(5, 0, " Opening");
/* Open up the module repository */
/* Open up the component repository */
return mca_base_module_repository_initialize();
return mca_base_component_repository_initialize();
}

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

@ -1,16 +0,0 @@
/*
* $HEADER$
*/
#include "ompi_config.h"
#include "class/ompi_list.h"
#include "mca/base/base.h"
/*
* Class instance of the mca_base_component_priority_list_item_t class
*/
OBJ_CLASS_INSTANCE(mca_base_component_priority_list_item_t,
ompi_list_item_t, NULL, NULL);

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

@ -39,13 +39,13 @@ extern "C" {
*
* This must be the first function invoked in the coll MCA
* framework. It initializes the coll MCA framework, finds and
* opens coll modules, etc.
* opens coll components, etc.
*
* This function is invoked during ompi_mpi_init() and during the
* initialization of the special case of the laminfo command.
*
* This function fills in the internal global variable
* mca_coll_base_modules_opened, which is a list of all coll modules
* mca_coll_base_components_opened, which is a list of all coll components
* that were successfully opened. This variable should \em only be
* used by other coll base functions -- it is not considered a
* public interface member -- and is only mentioned here for
@ -54,25 +54,25 @@ extern "C" {
int mca_coll_base_open(void);
/**
* Create list of available coll modules.
* Create list of available coll components.
*
* @param allow_multi_user_threads Will be set to true if any of the
* available modules will allow multiple user threads
* available components will allow multiple user threads
* @param have_hidden_threads Will be set to true if any of the
* available modules have hidden threads.
* available components have hidden threads.
*
* @retval OMPI_SUCCESS If one or more coll modules are available.
* @retval OMPI_ERROR If no coll modules are found to be available.
* @retval OMPI_SUCCESS If one or more coll components are available.
* @retval OMPI_ERROR If no coll components are found to be available.
*
* This function is invoked during ompi_mpi_init() to query all
* successfully opened coll modules and create a list of all
* available coll modules.
* successfully opened coll components and create a list of all
* available coll components.
*
* This function traverses the (internal global variable)
* mca_coll_base_modules_opened list and queries each module to see
* mca_coll_base_components_opened list and queries each component to see
* if it ever might want to run during this MPI process. It creates
* another internal global variable list named
* mca_coll_base_modules_available, consisting of a list of modules
* mca_coll_base_components_available, consisting of a list of components
* that are available for selection when communicators are created.
* This variable should \em only be used by other coll base
* functions -- it is not considered a public interface member --
@ -82,10 +82,10 @@ extern "C" {
bool *have_hidden_threads);
/**
* Select an available module for a new communicator.
* Select an available component for a new communicator.
*
* @param comm Communicator that the module will be selected for.
* @param preferred The module that is preferred for this
* @param comm Communicator that the component will be selected for.
* @param preferred The component that is preferred for this
* communicator (or NULL).
*
* @return OMPI_SUCCESS Upon success.
@ -99,36 +99,36 @@ extern "C" {
* here in the prototype is ok.
*
* This function is invoked when a new communicator is created and a
* coll module needs to be selected for it. It should be invoked
* coll component needs to be selected for it. It should be invoked
* near the end of the communicator creation process such that
* almost everything else is functional on the communicator (e.g.,
* point-to-point communication).
*
* This function invokes the selection process for coll modules,
* This function invokes the selection process for coll components,
* which works as follows:
*
* - If the \em preferred argument is NULL, the selection set is
* defined to be all the modules found during
* defined to be all the components found during
* mca_coll_base_find_available().
* - If \em preferred is not NULL, then the selection set is just
* that module. (However, in this mode, we may make 2 passes
* that component. (However, in this mode, we may make 2 passes
* through the selection process -- more on this below).
* - All modules in the selection set are queried to see if they
* want to run with that communicator. All modules that want to
* - All components in the selection set are queried to see if they
* want to run with that communicator. All components that want to
* run are ranked by their priority and the highest priority
* module is selected. All non-selected modules have their
* component is selected. All non-selected components have their
* "unquery" function invoked to let them know that they were not
* selected.
* - The selected module will have its "init" function invoked to
* - The selected component will have its "init" function invoked to
* let it know that it was selected.
* - If we fall through this entire process and no module is
* - If we fall through this entire process and no component is
* selected \em and the \em preferred argument is not NULL, then
* run the entire process again as if the \em preferred argument
* was NULL (i.e., use the entire available set of modules).
* was NULL (i.e., use the entire available set of components).
*
* At the end of this process, we'll either have a single module
* At the end of this process, we'll either have a single component
* that is selected and initialized for the communicator, or no
* module was selected and an error is returned up the stack.
* component was selected and an error is returned up the stack.
*
* Note that new communicators may be created as a result of
* invoking this function. Specifically: this function is called in
@ -138,10 +138,10 @@ extern "C" {
* different arguments).
*/
int mca_coll_base_comm_select(struct ompi_communicator_t *comm,
struct mca_base_module_t *preferred);
struct mca_base_component_t *preferred);
/**
* Finalize a coll module on a specific communicator.
* Finalize a coll component on a specific communicator.
*
* @param comm The communicator that is being destroyed.
*
@ -155,8 +155,8 @@ extern "C" {
* ok.
*
* This function is invoked near the beginning of the destruction of
* a communicator. It finalizes the coll module associated with the
* communicator (e.g., allowing the module to clean up and free any
* a communicator. It finalizes the coll component associated with the
* communicator (e.g., allowing the component to clean up and free any
* resources allocated for that communicator). Note that similar to
* mca_coll_base_select(), as result of this function, other
* communicators may also be destroyed.
@ -205,45 +205,45 @@ extern int mca_coll_base_param;
extern int mca_coll_base_output;
/**
* JMS should this move to the basic module?
* JMS should this move to the basic component?
*/
extern int mca_coll_base_crossover;
/**
* JMS should this move to the basic module?
* JMS should this move to the basic component?
*/
extern int mca_coll_base_associative;
/**
* JMS should this move to the basic module?
* JMS should this move to the basic component?
*/
extern int mca_coll_base_reduce_crossover;
/**
* JMS should this move to the basic module?
* JMS should this move to the basic component?
*/
extern int mca_coll_base_bcast_collmaxlin;
/**
* JMS should this move to the basic module?
* JMS should this move to the basic component?
*/
extern int mca_coll_base_bcast_collmaxdim;
/**
* Indicator as to whether the list of opened coll modules is valid or
* Indicator as to whether the list of opened coll components is valid or
* not.
*/
extern bool mca_coll_base_components_opened_valid;
/**
* List of all opened modules; created when the coll framework is
* List of all opened components; created when the coll framework is
* initialized and destroyed when we reduce the list to all available
* coll modules.
* coll components.
*/
extern ompi_list_t mca_coll_base_components_opened;
/**
* Indicator as to whether the list of available coll modules is valid
* Indicator as to whether the list of available coll components is valid
* or not.
*/
extern bool mca_coll_base_components_available_valid;
/**
* List of all available modules; created by reducing the list of open
* modules to all those who indicate that they may run during this
* List of all available components; created by reducing the list of open
* components to all those who indicate that they may run during this
* process.
*/
extern ompi_list_t mca_coll_base_components_available;
@ -254,6 +254,6 @@ extern ompi_list_t mca_coll_base_components_available;
* common denominator between all coll components and may be used
* interchangably).
*/
extern const mca_coll_base_module_1_0_0_t *mca_coll_base_basic_component;
extern const mca_coll_base_component_1_0_0_t *mca_coll_base_basic_component;
#endif /* MCA_BASE_COLL_H */

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

@ -20,12 +20,12 @@ int mca_coll_base_close(void)
we're anywhere else). */
if (mca_coll_base_components_opened_valid) {
mca_base_modules_close(mca_coll_base_output,
&mca_coll_base_components_opened, NULL);
mca_base_components_close(mca_coll_base_output,
&mca_coll_base_components_opened, NULL);
mca_coll_base_components_opened_valid = false;
} else if (mca_coll_base_components_available_valid) {
mca_base_modules_close(mca_coll_base_output,
&mca_coll_base_components_available, NULL);
mca_base_components_close(mca_coll_base_output,
&mca_coll_base_components_available, NULL);
mca_coll_base_components_available_valid = false;
}

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

@ -22,11 +22,11 @@
/*
* Local variables
*/
static mca_coll_1_0_0_t null_actions = {
NULL, NULL, /* init and finalize */
/* Checkpoint / restart */
static mca_coll_base_module_1_0_0_t null_module = {
NULL, NULL, NULL, NULL,
/* Module init and finalize */
NULL, NULL,
/* Collective function pointers */
@ -43,8 +43,8 @@ struct avail_coll_t {
ompi_list_item_t super;
int ac_priority;
const mca_coll_base_module_1_0_0_t *ac_component;
const mca_coll_1_0_0_t *ac_module;
const mca_coll_base_component_1_0_0_t *ac_component;
const mca_coll_base_module_1_0_0_t *ac_module;
};
typedef struct avail_coll_t avail_coll_t;
@ -55,22 +55,22 @@ static ompi_list_t *check_components(ompi_list_t *components,
ompi_communicator_t *comm,
char **names, int num_names);
static int check_one_component(ompi_communicator_t *comm,
const mca_base_module_t *component,
const mca_coll_1_0_0_t **module);
const mca_base_component_t *component,
const mca_coll_base_module_1_0_0_t **module);
static int query(const mca_base_module_t *component,
static int query(const mca_base_component_t *component,
ompi_communicator_t *comm, int *priority,
const mca_coll_1_0_0_t **module);
static int query_1_0_0(const mca_coll_base_module_1_0_0_t *coll_component,
const mca_coll_base_module_1_0_0_t **module);
static int query_1_0_0(const mca_coll_base_component_1_0_0_t *coll_component,
ompi_communicator_t *comm, int *priority,
const mca_coll_1_0_0_t **module);
const mca_coll_base_module_1_0_0_t **module);
static void unquery(const mca_coll_base_module_1_0_0_t *coll_component,
static void unquery(const mca_coll_base_component_1_0_0_t *coll_component,
ompi_communicator_t *comm);
static void unquery_1_0_0(const mca_coll_base_module_1_0_0_t *coll_component,
static void unquery_1_0_0(const mca_coll_base_component_1_0_0_t *coll_component,
ompi_communicator_t *comm);
static int module_init(const mca_coll_1_0_0_t *module,
static int module_init(const mca_coll_base_module_1_0_0_t *module,
ompi_communicator_t *comm);
static int query_basic(ompi_communicator_t *comm);
@ -96,7 +96,7 @@ OBJ_CLASS_INSTANCE(avail_coll_t, ompi_list_item_t, NULL, NULL);
* we construct is probably ok.
*/
int mca_coll_base_comm_select(ompi_communicator_t *comm,
mca_base_module_t *preferred)
mca_base_component_t *preferred)
{
bool found, using_basic;
int err, num_names;
@ -106,8 +106,8 @@ int mca_coll_base_comm_select(ompi_communicator_t *comm,
avail_coll_t *avail;
ompi_list_t *selectable;
ompi_list_item_t *item;
const mca_coll_base_module_1_0_0_t *selected_component, *component;
const mca_coll_1_0_0_t *selected_module;
const mca_coll_base_component_1_0_0_t *selected_component, *component;
const mca_coll_base_module_1_0_0_t *selected_module;
/* Announce */
@ -121,7 +121,7 @@ int mca_coll_base_comm_select(ompi_communicator_t *comm,
/* Initialize all the relevant pointers, since they're used as
sentinel values */
comm->c_coll = null_actions;
comm->c_coll = null_module;
comm->c_coll_selected_data = NULL;
comm->c_coll_selected_module = NULL;
@ -147,7 +147,7 @@ int mca_coll_base_comm_select(ompi_communicator_t *comm,
err = OMPI_ERROR;
if (NULL != preferred) {
str = &(preferred->mca_module_name[0]);
str = &(preferred->mca_component_name[0]);
ompi_output_verbose(10, mca_coll_base_output,
"coll:base:comm_select: Checking preferred module: %s",
@ -276,7 +276,7 @@ int mca_coll_base_comm_select(ompi_communicator_t *comm,
ompi_output_verbose(10, mca_coll_base_output,
"coll:base:comm_select: Selected coll module %s",
selected_component->collm_version.mca_module_name);
selected_component->collm_version.mca_component_name);
return OMPI_SUCCESS;
}
@ -294,9 +294,9 @@ static ompi_list_t *check_components(ompi_list_t *components,
char **names, int num_names)
{
int i, priority;
const mca_base_module_t *component;
const mca_base_component_t *component;
ompi_list_item_t *item, *next, *item2;
const mca_coll_1_0_0_t *actions;
const mca_coll_base_module_1_0_0_t *actions;
bool want_to_check;
ompi_list_t *selectable;
avail_coll_t *avail, *avail2;
@ -323,7 +323,7 @@ static ompi_list_t *check_components(ompi_list_t *components,
} else {
want_to_check = false;
for (i = 0; i < num_names; ++i) {
if (0 == strcmp(names[i], component->mca_module_name)) {
if (0 == strcmp(names[i], component->mca_component_name)) {
want_to_check = true;
}
}
@ -341,7 +341,7 @@ static ompi_list_t *check_components(ompi_list_t *components,
avail = OBJ_NEW(avail_coll_t);
avail->ac_priority = 0;
avail->ac_component = (mca_coll_base_module_1_0_0_t *) component;
avail->ac_component = (mca_coll_base_component_1_0_0_t *) component;
/* Put this item on the list in priority order (highest
priority first). Should it go first? */
@ -388,8 +388,8 @@ static ompi_list_t *check_components(ompi_list_t *components,
* Check a single component
*/
static int check_one_component(ompi_communicator_t *comm,
const mca_base_module_t *component,
const mca_coll_1_0_0_t **module)
const mca_base_component_t *component,
const mca_coll_base_module_1_0_0_t **module)
{
int err;
int priority = -1;
@ -400,13 +400,13 @@ static int check_one_component(ompi_communicator_t *comm,
priority = (priority < 100) ? priority : 100;
ompi_output_verbose(10, mca_coll_base_output,
"coll:base:comm_select: component available: %s, priority: %d",
component->mca_module_name, priority);
component->mca_component_name, priority);
} else {
priority = -1;
ompi_output_verbose(10, mca_coll_base_output,
"coll:base:comm_select: component not available: %s",
component->mca_module_name);
component->mca_component_name);
}
return priority;
@ -421,9 +421,9 @@ static int check_one_component(ompi_communicator_t *comm,
* Take any version of a coll module, query it, and return the right
* actions struct
*/
static int query(const mca_base_module_t *component,
static int query(const mca_base_component_t *component,
ompi_communicator_t *comm,
int *priority, const mca_coll_1_0_0_t **module)
int *priority, const mca_coll_base_module_1_0_0_t **module)
{
/* coll v1.0.0 */
@ -431,8 +431,8 @@ static int query(const mca_base_module_t *component,
if (1 == component->mca_major_version &&
0 == component->mca_minor_version &&
0 == component->mca_release_version) {
const mca_coll_base_module_1_0_0_t *coll100 =
(mca_coll_base_module_1_0_0_t *) component;
const mca_coll_base_component_1_0_0_t *coll100 =
(mca_coll_base_component_1_0_0_t *) component;
return query_1_0_0(coll100, comm, priority, module);
}
@ -443,11 +443,11 @@ static int query(const mca_base_module_t *component,
}
static int query_1_0_0(const mca_coll_base_module_1_0_0_t *component,
static int query_1_0_0(const mca_coll_base_component_1_0_0_t *component,
ompi_communicator_t *comm, int *priority,
const mca_coll_1_0_0_t **module)
const mca_coll_base_module_1_0_0_t **module)
{
const mca_coll_1_0_0_t *ret;
const mca_coll_base_module_1_0_0_t *ret;
/* There's currently no need for conversion */
@ -465,14 +465,14 @@ static int query_1_0_0(const mca_coll_base_module_1_0_0_t *component,
* Unquery functions
**************************************************************************/
static void unquery(const mca_coll_base_module_1_0_0_t *component,
static void unquery(const mca_coll_base_component_1_0_0_t *component,
ompi_communicator_t *comm)
{
if (1 == component->collm_version.mca_major_version &&
0 == component->collm_version.mca_minor_version &&
0 == component->collm_version.mca_release_version) {
const mca_coll_base_module_1_0_0_t *coll100 =
(mca_coll_base_module_1_0_0_t *) component;
const mca_coll_base_component_1_0_0_t *coll100 =
(mca_coll_base_component_1_0_0_t *) component;
unquery_1_0_0(coll100, comm);
}
@ -482,7 +482,7 @@ static void unquery(const mca_coll_base_module_1_0_0_t *component,
}
static void unquery_1_0_0(const mca_coll_base_module_1_0_0_t *component,
static void unquery_1_0_0(const mca_coll_base_component_1_0_0_t *component,
ompi_communicator_t *comm)
{
component->collm_comm_unquery(comm);
@ -496,10 +496,10 @@ static void unquery_1_0_0(const mca_coll_base_module_1_0_0_t *component,
/*
* Initialize a module
*/
static int module_init(const mca_coll_1_0_0_t *module,
static int module_init(const mca_coll_base_module_1_0_0_t *module,
ompi_communicator_t *comm)
{
const mca_coll_1_0_0_t *ret;
const mca_coll_base_module_1_0_0_t *ret;
/* There's currently no need for conversion */
@ -530,7 +530,7 @@ static int query_basic(ompi_communicator_t *comm)
ret = OMPI_SUCCESS;
if (NULL == comm->c_coll_basic_module) {
ret = query((mca_base_module_t *) mca_coll_base_basic_component, comm,
ret = query((mca_base_component_t *) mca_coll_base_basic_component, comm,
&priority, &comm->c_coll_basic_module);
if (ret != OMPI_SUCCESS) {
comm->c_coll_basic_module = NULL;

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

@ -22,15 +22,15 @@
*/
bool mca_coll_base_components_available_valid = false;
ompi_list_t mca_coll_base_components_available;
const mca_coll_base_module_1_0_0_t *mca_coll_base_basic_component = NULL;
const mca_coll_base_component_1_0_0_t *mca_coll_base_basic_component = NULL;
/*
* Private functions
*/
static int init_query(const mca_base_module_t *ls,
static int init_query(const mca_base_component_t *ls,
mca_base_component_priority_list_item_t *entry);
static int init_query_1_0_0(const mca_base_module_t *ls,
static int init_query_1_0_0(const mca_base_component_t *ls,
mca_base_component_priority_list_item_t *entry);
/*
@ -52,7 +52,7 @@ int mca_coll_base_find_available(bool *allow_multi_user_threads,
bool found = false;
mca_base_component_priority_list_item_t *entry;
ompi_list_item_t *p;
const mca_base_module_t *component;
const mca_base_component_t *component;
/* Initialize the list */
@ -66,7 +66,7 @@ int mca_coll_base_find_available(bool *allow_multi_user_threads,
p = ompi_list_remove_first(&mca_coll_base_components_opened);
p != NULL;
p = ompi_list_remove_first(&mca_coll_base_components_opened)) {
component = ((mca_base_module_list_item_t *) p)->mli_module;
component = ((mca_base_component_list_item_t *) p)->cli_component;
/* Call a subroutine to do the work, because the component may
represent different versions of the coll MCA. */
@ -80,9 +80,9 @@ int mca_coll_base_find_available(bool *allow_multi_user_threads,
special. Keep it off the available list -- we'll use it
specially in the selection process. */
if (0 == strcmp(component->mca_module_name, "basic")) {
if (0 == strcmp(component->mca_component_name, "basic")) {
mca_coll_base_basic_component =
(mca_coll_base_module_1_0_0_t *) component;
(mca_coll_base_component_1_0_0_t *) component;
}
/* Otherwise, save the results in the list. The priority isn't
@ -106,7 +106,7 @@ int mca_coll_base_find_available(bool *allow_multi_user_threads,
already had its close() method invoked; now close it out of
the DSO repository (if it's there). */
mca_base_module_repository_release(component);
mca_base_component_repository_release(component);
OBJ_RELEASE(entry);
}
@ -143,14 +143,14 @@ int mca_coll_base_find_available(bool *allow_multi_user_threads,
* Query a component, see if it wants to run at all. If it does, save
* some information. If it doesn't, close it.
*/
static int init_query(const mca_base_module_t *m,
static int init_query(const mca_base_component_t *m,
mca_base_component_priority_list_item_t *entry)
{
int ret;
ompi_output_verbose(10, mca_coll_base_output,
"coll:find_available: querying coll component %s",
m->mca_module_name);
m->mca_component_name);
/* This component has already been successfully opened. So now query
it. */
@ -176,14 +176,14 @@ static int init_query(const mca_base_module_t *m,
if (OMPI_SUCCESS != ret) {
ompi_output_verbose(10, mca_coll_base_output,
"coll:find_available: coll component %s is not available",
m->mca_module_name);
if (NULL != m->mca_close_module) {
m->mca_close_module();
m->mca_component_name);
if (NULL != m->mca_close_component) {
m->mca_close_component();
}
} else {
ompi_output_verbose(10, mca_coll_base_output,
"coll:find_available: coll component %s is available",
m->mca_module_name);
m->mca_component_name);
}
/* All done */
@ -196,11 +196,11 @@ static int init_query(const mca_base_module_t *m,
* Query a specific component, coll v1.0.0
*/
static int
init_query_1_0_0(const mca_base_module_t *component,
init_query_1_0_0(const mca_base_component_t *component,
mca_base_component_priority_list_item_t *entry)
{
mca_coll_base_module_1_0_0_t *coll =
(mca_coll_base_module_1_0_0_t *) component;
mca_coll_base_component_1_0_0_t *coll =
(mca_coll_base_component_1_0_0_t *) component;
return coll->collm_init_query(&(entry->cpli_allow_multi_user_threads),
&(entry->cpli_have_hidden_threads));

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

@ -17,10 +17,10 @@
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_module_t struct.
* component's public mca_base_component_t struct.
*/
#include "mca/coll/base/static-modules.h"
#include "mca/coll/base/static-components.h"
/*
@ -53,9 +53,9 @@ int mca_coll_base_open(void)
/* Open up all available components */
if (OMPI_SUCCESS !=
mca_base_modules_open("coll", mca_coll_base_output,
mca_coll_base_static_modules,
&mca_coll_base_components_opened)) {
mca_base_components_open("coll", mca_coll_base_output,
mca_coll_base_static_components,
&mca_coll_base_components_opened)) {
return OMPI_ERROR;
}
mca_coll_base_components_opened_valid = true;

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

@ -1,4 +1,3 @@
# -*- makefile -*-
#
# $HEADER$
#
@ -17,9 +16,9 @@ libmca_coll_basic_la_SOURCES = \
coll_basic_alltoallw.c \
coll_basic_barrier.c \
coll_basic_bcast.c \
coll_basic_component.c \
coll_basic_gather.c \
coll_basic_gatherv.c \
coll_basic_module.c \
coll_basic_reduce.c \
coll_basic_reduce_scatter.c \
coll_basic_scan.c \

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

@ -17,20 +17,13 @@
/*
* Linear set of collective algorithms
*/
static const mca_coll_1_0_0_t intra_linear = {
static const mca_coll_base_module_1_0_0_t intra_linear = {
/* Initialization / finalization functions */
mca_coll_basic_module_init,
mca_coll_basic_module_finalize,
/* Checkpoint / restart functions */
NULL,
NULL,
NULL,
NULL,
/* Collective function pointers */
mca_coll_basic_allgather_intra,
@ -57,20 +50,13 @@ static const mca_coll_1_0_0_t intra_linear = {
* collectives have lograthmic algorithms. For example, scan will use
* the same algorithm as in the linear set.
*/
static const mca_coll_1_0_0_t intra_log = {
static const mca_coll_base_module_1_0_0_t intra_log = {
/* Initialization / finalization functions */
mca_coll_basic_module_init,
mca_coll_basic_module_finalize,
/* Checkpoint / restart functions */
NULL,
NULL,
NULL,
NULL,
/* Collective function pointers */
mca_coll_basic_allgather_intra,
@ -95,20 +81,13 @@ static const mca_coll_1_0_0_t intra_log = {
/*
* Linear set of collective algorithms for intercommunicators
*/
static const mca_coll_1_0_0_t inter_linear = {
static const mca_coll_base_module_1_0_0_t inter_linear = {
/* Initialization / finalization functions */
mca_coll_basic_module_init,
mca_coll_basic_module_finalize,
/* Checkpoint / restart functions */
NULL,
NULL,
NULL,
NULL,
/* Collective function pointers */
mca_coll_basic_allgather_inter,
@ -135,20 +114,13 @@ static const mca_coll_1_0_0_t inter_linear = {
* collectives have lograthmic algorithms. For example, scan will use
* the same algorithm as in the linear set.
*/
static const mca_coll_1_0_0_t inter_log = {
static const mca_coll_base_module_1_0_0_t inter_log = {
/* Initialization / finalization functions */
mca_coll_basic_module_init,
mca_coll_basic_module_finalize,
/* Checkpoint / restart functions */
NULL,
NULL,
NULL,
NULL,
/* Collective function pointers */
mca_coll_basic_allgather_inter,
@ -191,7 +163,7 @@ int mca_coll_basic_init_query(bool *allow_multi_user_threads,
* Look at the communicator and decide which set of functions and
* priority we want to return.
*/
const mca_coll_1_0_0_t *
const mca_coll_base_module_1_0_0_t *
mca_coll_basic_comm_query(struct ompi_communicator_t *comm, int *priority)
{
/* This module should always have the lowest available priority */
@ -227,18 +199,18 @@ mca_coll_basic_comm_query(struct ompi_communicator_t *comm, int *priority)
/*
* Init module on the communicator
*/
const struct mca_coll_1_0_0_t *
const struct mca_coll_base_module_1_0_0_t *
mca_coll_basic_module_init(struct ompi_communicator_t *comm)
{
int size;
struct mca_coll_comm_t *data;
struct mca_coll_base_comm_t *data;
/* Allocate the data that hangs off the communicator */
comm->c_coll_basic_data = NULL;
size = ompi_comm_size(comm);
data = malloc(sizeof(struct mca_coll_comm_t) +
data = malloc(sizeof(struct mca_coll_base_comm_t) +
(sizeof(ompi_request_t) * size * 2));
if (NULL == data) {

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

@ -18,7 +18,7 @@
* Globally exported variable
*/
extern const mca_coll_base_module_1_0_0_t mca_coll_basic_module;
extern const mca_coll_base_component_1_0_0_t mca_coll_basic_component;
/*
@ -33,11 +33,11 @@ extern "C" {
int mca_coll_basic_init_query(bool *allow_multi_user_threads,
bool *have_hidden_threads);
const struct mca_coll_1_0_0_t *
const struct mca_coll_base_module_1_0_0_t *
mca_coll_basic_comm_query(struct ompi_communicator_t *comm, int *priority);
int mca_coll_basic_comm_unquery(struct ompi_communicator_t *comm);
const struct mca_coll_1_0_0_t *
const struct mca_coll_base_module_1_0_0_t *
mca_coll_basic_module_init(struct ompi_communicator_t *comm);
int mca_coll_basic_module_finalize(struct ompi_communicator_t *comm);
@ -238,7 +238,7 @@ static inline void mca_coll_basic_free_reqs(ompi_request_t **reqs, int count)
/*
* Data structure for hanging data off the communicator
*/
struct mca_coll_comm_t {
struct mca_coll_base_comm_t {
ompi_request_t **mccb_reqs;
int mccb_num_reqs;
};

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

@ -5,7 +5,7 @@
* semantics. Since linkers generally pull in symbols by object
* files, keeping these symbols as the only symbols in this file
* prevents utility programs such as "ompi_info" from having to import
* entire modules just to query their version and parameters.
* entire components just to query their version and parameters.
*/
#include "ompi_config.h"
@ -16,44 +16,44 @@
#include "coll_basic.h"
/*
* Public string showing the coll ompi_basic module version number
* Public string showing the coll ompi_basic component version number
*/
const char *mca_coll_basic_module_version_string =
"OMPI/MPI basic collective MCA module version " MCA_coll_basic_FULL_VERSION;
const char *mca_coll_basic_component_version_string =
"OMPI/MPI basic collective MCA component version " MCA_coll_basic_FULL_VERSION;
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
const mca_coll_base_module_1_0_0_t mca_coll_basic_module = {
const mca_coll_base_component_1_0_0_t mca_coll_basic_component = {
/* First, the mca_module_t struct containing meta information
about the module itself */
/* First, the mca_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a coll v1.0.0 module (which also implies a
/* Indicate that we are a coll v1.0.0 component (which also implies a
specific MCA version) */
MCA_COLL_BASE_VERSION_1_0_0,
/* Module name and version */
/* Component name and version */
"basic",
MCA_coll_basic_MAJOR_VERSION,
MCA_coll_basic_MINOR_VERSION,
MCA_coll_basic_RELEASE_VERSION,
/* Module open and close functions */
/* Component open and close functions */
NULL,
NULL
},
/* Next the MCA v1.0.0 module meta data */
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the module is checkpointable or not */
/* Whether the component is checkpointable or not */
true
},

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

@ -12,179 +12,141 @@
#include "mca/base/base.h"
/*
* Coll component function typedefs
*/
typedef int (*mca_coll_base_component_init_query_fn_t)
(bool *allow_multi_user_threads, bool *have_hidden_threads);
typedef const struct mca_coll_base_module_1_0_0_t *
(*mca_coll_base_component_comm_query_1_0_0_fn_t)
(struct ompi_communicator_t *comm, int *priority);
typedef int (*mca_coll_base_component_comm_unquery_fn_t)
(struct ompi_communicator_t *comm);
/*
* Coll module function typedefs
*/
typedef int (*mca_coll_base_init_query_fn_t)(bool *allow_multi_user_threads,
bool *have_hidden_threads);
typedef const struct mca_coll_1_0_0_t *
(*mca_coll_base_comm_query_1_0_0_fn_t)(struct ompi_communicator_t *comm,
int *priority);
typedef int (*mca_coll_base_comm_unquery_fn_t)
(struct ompi_communicator_t *comm);
typedef const struct mca_coll_1_0_0_t *
typedef const struct mca_coll_base_module_1_0_0_t *
(*mca_coll_base_module_init_1_0_0_fn_t)(struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_finalize_fn_t)
(struct ompi_communicator_t *comm);
/*
* Coll interface function typedefs
*/
typedef int (*mca_coll_base_checkpoint_fn_t)(struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_continue_fn_t)(struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_restart_fn_t)(struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_interrupt_fn_t)(void);
typedef int (*mca_coll_base_allgather_fn_t)(void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_allgatherv_fn_t)(void *sbuf, int scount,
ompi_datatype_t *sdtype,
void * rbuf, int *rcounts,
int *disps,
struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_allreduce_fn_t)(void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_alltoall_fn_t)(void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void* rbuf, int rcount,
struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_alltoallv_fn_t)(void *sbuf, int *scounts,
int *sdisps,
struct ompi_datatype_t *sdtype,
void *rbuf, int *rcounts,
int *rdisps,
struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_alltoallw_fn_t)(void *sbuf, int *scounts,
int *sdisps,
struct ompi_datatype_t **sdtypes,
void *rbuf, int *rcounts,
int *rdisps,
struct ompi_datatype_t **rdtypes,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_barrier_fn_t)(struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_bcast_fn_t)(void *buff, int count,
struct ompi_datatype_t *datatype,
int root,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_exscan_fn_t)(void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_gather_fn_t)(void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype,
int root,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_gatherv_fn_t)(void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf,
int *rcounts, int *disps,
struct ompi_datatype_t *rdtype,
int root,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_reduce_fn_t)(void *sbuf, void* rbuf, int count,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op, int root,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_reduce_scatter_fn_t)(void *sbuf, void *rbuf,
int *rcounts,
struct ompi_datatype_t *dtype,
struct ompi_op_t *op,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_scan_fn_t)(void *sbuf, void *rbuf, int count,
struct ompi_datatype_t *dtype,
MPI_Op op,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_scatter_fn_t)(void *sbuf, int scount,
struct ompi_datatype_t *sdtype,
void *rbuf, int rcount,
struct ompi_datatype_t *rdtype,
int root,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_scatterv_fn_t)(void *sbuf, int *scounts,
int *disps,
struct ompi_datatype_t *sdtype,
void* rbuf, int rcount,
struct ompi_datatype_t *rdtype,
int root,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_allgather_fn_t)
(void *sbuf, int scount, struct ompi_datatype_t *sdtype,
void *rbuf, int rcount, struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_allgatherv_fn_t)
(void *sbuf, int scount, ompi_datatype_t *sdtype,
void * rbuf, int *rcounts, int *disps, struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_allreduce_fn_t)
(void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype,
struct ompi_op_t *op, struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_alltoall_fn_t)
(void *sbuf, int scount, struct ompi_datatype_t *sdtype,
void* rbuf, int rcount, struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_alltoallv_fn_t)
(void *sbuf, int *scounts, int *sdisps, struct ompi_datatype_t *sdtype,
void *rbuf, int *rcounts, int *rdisps, struct ompi_datatype_t *rdtype,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_alltoallw_fn_t)
(void *sbuf, int *scounts, int *sdisps, struct ompi_datatype_t **sdtypes,
void *rbuf, int *rcounts, int *rdisps, struct ompi_datatype_t **rdtypes,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_barrier_fn_t)
(struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_bcast_fn_t)
(void *buff, int count, struct ompi_datatype_t *datatype, int root,
struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_exscan_fn_t)
(void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype,
struct ompi_op_t *op, struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_gather_fn_t)
(void *sbuf, int scount, struct ompi_datatype_t *sdtype,
void *rbuf, int rcount, struct ompi_datatype_t *rdtype,
int root, struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_gatherv_fn_t)
(void *sbuf, int scount, struct ompi_datatype_t *sdtype,
void *rbuf, int *rcounts, int *disps, struct ompi_datatype_t *rdtype,
int root, struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_reduce_fn_t)
(void *sbuf, void* rbuf, int count, struct ompi_datatype_t *dtype,
struct ompi_op_t *op, int root, struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_reduce_scatter_fn_t)
(void *sbuf, void *rbuf, int *rcounts, struct ompi_datatype_t *dtype,
struct ompi_op_t *op, struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_scan_fn_t)
(void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype,
struct ompi_op_t *op, struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_scatter_fn_t)
(void *sbuf, int scount, struct ompi_datatype_t *sdtype,
void *rbuf, int rcount, struct ompi_datatype_t *rdtype,
int root, struct ompi_communicator_t *comm);
typedef int (*mca_coll_base_module_scatterv_fn_t)
(void *sbuf, int *scounts, int *disps, struct ompi_datatype_t *sdtype,
void* rbuf, int rcount, struct ompi_datatype_t *rdtype,
int root, struct ompi_communicator_t *comm);
/*
* Structure for coll v1.0.0 modules
* Structure for coll v1.0.0 components
* Chained to MCA v1.0.0
*/
struct mca_coll_base_module_1_0_0_t {
mca_base_module_t collm_version;
mca_base_module_data_1_0_0_t collm_data;
struct mca_coll_base_component_1_0_0_t {
mca_base_component_t collm_version;
mca_base_component_data_1_0_0_t collm_data;
/* Initialization / querying functions */
mca_coll_base_init_query_fn_t collm_init_query;
mca_coll_base_comm_query_1_0_0_fn_t collm_comm_query;
mca_coll_base_comm_unquery_fn_t collm_comm_unquery;
mca_coll_base_component_init_query_fn_t collm_init_query;
mca_coll_base_component_comm_query_1_0_0_fn_t collm_comm_query;
mca_coll_base_component_comm_unquery_fn_t collm_comm_unquery;
};
typedef struct mca_coll_base_module_1_0_0_t mca_coll_base_module_1_0_0_t;
typedef struct mca_coll_base_component_1_0_0_t mca_coll_base_component_1_0_0_t;
/*
* This struct is hung on the communicator by the winning coll module
* This struct is hung on the communicator by the winning coll component
* after the negotiation. It has pointers for all the collective
* functions, as well as a "finalize" function for when the
* communicator is freed.
*/
struct mca_coll_1_0_0_t {
struct mca_coll_base_module_1_0_0_t {
/* Per-communicator initialization and finalization functions */
mca_coll_base_module_init_1_0_0_fn_t coll_module_init;
mca_coll_base_module_finalize_fn_t coll_module_finalize;
/* Checkpoint / restart functions */
mca_coll_base_checkpoint_fn_t coll_checkpoint;
mca_coll_base_continue_fn_t coll_continue;
mca_coll_base_restart_fn_t coll_restart;
mca_coll_base_interrupt_fn_t coll_interrupt;
/* Collective function pointers */
mca_coll_base_allgather_fn_t coll_allgather;
mca_coll_base_allgatherv_fn_t coll_allgatherv;
mca_coll_base_allreduce_fn_t coll_allreduce;
mca_coll_base_alltoall_fn_t coll_alltoall;
mca_coll_base_alltoallv_fn_t coll_alltoallv;
mca_coll_base_alltoallw_fn_t coll_alltoallw;
mca_coll_base_barrier_fn_t coll_barrier;
mca_coll_base_bcast_fn_t coll_bcast;
mca_coll_base_exscan_fn_t coll_exscan;
mca_coll_base_gather_fn_t coll_gather;
mca_coll_base_gatherv_fn_t coll_gatherv;
mca_coll_base_reduce_fn_t coll_reduce;
mca_coll_base_reduce_scatter_fn_t coll_reduce_scatter;
mca_coll_base_scan_fn_t coll_scan;
mca_coll_base_scatter_fn_t coll_scatter;
mca_coll_base_scatterv_fn_t coll_scatterv;
mca_coll_base_module_allgather_fn_t coll_allgather;
mca_coll_base_module_allgatherv_fn_t coll_allgatherv;
mca_coll_base_module_allreduce_fn_t coll_allreduce;
mca_coll_base_module_alltoall_fn_t coll_alltoall;
mca_coll_base_module_alltoallv_fn_t coll_alltoallv;
mca_coll_base_module_alltoallw_fn_t coll_alltoallw;
mca_coll_base_module_barrier_fn_t coll_barrier;
mca_coll_base_module_bcast_fn_t coll_bcast;
mca_coll_base_module_exscan_fn_t coll_exscan;
mca_coll_base_module_gather_fn_t coll_gather;
mca_coll_base_module_gatherv_fn_t coll_gatherv;
mca_coll_base_module_reduce_fn_t coll_reduce;
mca_coll_base_module_reduce_scatter_fn_t coll_reduce_scatter;
mca_coll_base_module_scan_fn_t coll_scan;
mca_coll_base_module_scatter_fn_t coll_scatter;
mca_coll_base_module_scatterv_fn_t coll_scatterv;
};
typedef struct mca_coll_1_0_0_t mca_coll_1_0_0_t;
typedef struct mca_coll_base_module_1_0_0_t mca_coll_base_module_1_0_0_t;
/*
* Macro for use in modules that are of type coll v1.0.0
* Macro for use in components that are of type coll v1.0.0
*/
#define MCA_COLL_BASE_VERSION_1_0_0 \
/* coll v1.0 is chained to MCA v1.0 */ \

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

@ -71,9 +71,9 @@ extern "C" {
* globals that might be needed
*/
extern mca_gpr_t ompi_registry; /* holds selected module's function pointers */
extern mca_gpr_base_module_t ompi_registry; /* holds selected module's function pointers */
extern ompi_list_t mca_gpr_base_modules_available;
extern mca_gpr_base_module_t mca_gpr_base_selected_module;
extern mca_gpr_base_component_t mca_gpr_base_selected_component;
/*
* structures

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

@ -79,79 +79,78 @@ typedef ompi_registry_buf_t ompi_registry_object_t;
/*
* utility functions that may be provided, or use defaults
*/
typedef int (*mca_gpr_base_send_fn_t)(ompi_process_name_t *target,
typedef int (*mca_gpr_base_module_send_fn_t)(ompi_process_name_t *target,
ompi_registry_buf_t *buf);
typedef ompi_registry_buf_t (*mca_gpr_base_recv_fn_t)(void);
typedef ompi_registry_buf_t (*mca_gpr_base_module_recv_fn_t)(void);
/*
* public functions that MUST be provided
*/
typedef int (*mca_gpr_base_definesegment_fn_t)(char *segment);
typedef int (*mca_gpr_base_deletesegment_fn_t)(char *segment);
typedef int (*mca_gpr_base_put_fn_t)(ompi_registry_mode_t mode, char *segment,
typedef int (*mca_gpr_base_module_definesegment_fn_t)(char *segment);
typedef int (*mca_gpr_base_module_deletesegment_fn_t)(char *segment);
typedef int (*mca_gpr_base_module_put_fn_t)(ompi_registry_mode_t mode, char *segment,
char **tokens, ompi_registry_object_t *object,
int size);
typedef ompi_registry_value_t* (*mca_gpr_base_get_fn_t)(ompi_registry_mode_t mode,
typedef ompi_registry_value_t* (*mca_gpr_base_module_get_fn_t)(ompi_registry_mode_t mode,
char *segment, char **tokens);
typedef int (*mca_gpr_base_delete_fn_t)(ompi_registry_mode_t mode,
typedef int (*mca_gpr_base_module_delete_fn_t)(ompi_registry_mode_t mode,
char *segment, char **tokens);
typedef ompi_keytable_t* (*mca_gpr_base_index_fn_t)(char *segment);
typedef int (*mca_gpr_base_subscribe_fn_t)(ompi_registry_mode_t mode,
typedef ompi_keytable_t* (*mca_gpr_base_module_index_fn_t)(char *segment);
typedef int (*mca_gpr_base_module_subscribe_fn_t)(ompi_registry_mode_t mode,
ompi_registry_action_t action,
char *segment, char **tokens);
typedef int (*mca_gpr_base_unsubscribe_fn_t)(ompi_registry_mode_t mode,
typedef int (*mca_gpr_base_module_unsubscribe_fn_t)(ompi_registry_mode_t mode,
char *segment, char **tokens);
/*
* block functions that may be provided, or use defaults
*/
typedef ompi_registry_buf_t (*mca_gpr_base_getbuf_fn_t)(size_t size);
typedef int (*mca_gpr_base_packbuf_fn_t)(ompi_registry_buf_t *buf, void *ptr,
typedef ompi_registry_buf_t (*mca_gpr_base_module_getbuf_fn_t)(size_t size);
typedef int (*mca_gpr_base_module_packbuf_fn_t)(ompi_registry_buf_t *buf, void *ptr,
size_t num_items, ompi_registry_bufdata_t datatype);
typedef int (*mca_gpr_base_packstring_fn_t)(ompi_registry_buf_t *buf, char *string);
typedef int (*mca_gpr_base_unpackstring_fn_t)(ompi_registry_buf_t *buf, char *string, size_t maxlen);
typedef int (*mca_gpr_base_unpackbuf_fn_t)(ompi_registry_buf_t *buf, void *ptr, size_t num_items,
typedef int (*mca_gpr_base_module_packstring_fn_t)(ompi_registry_buf_t *buf, char *string);
typedef int (*mca_gpr_base_module_unpackstring_fn_t)(ompi_registry_buf_t *buf, char *string, size_t maxlen);
typedef int (*mca_gpr_base_module_unpackbuf_fn_t)(ompi_registry_buf_t *buf, void *ptr, size_t num_items,
ompi_registry_bufdata_t datatype);
typedef int (*mca_gpr_base_sendbuf_fn_t)(ompi_process_name_t *target, ompi_registry_buf_t *buf, bool freebuf);
typedef int (*mca_gpr_base_module_sendbuf_fn_t)(ompi_process_name_t *target, ompi_registry_buf_t *buf, bool freebuf);
/*
* Ver 1.0.0
*/
struct mca_gpr_base_module_1_0_0_t {
mca_base_module_t gprc_version;
mca_base_module_data_1_0_0_t gprc_data;
struct mca_gpr_base_component_1_0_0_t {
mca_base_component_t gprc_version;
mca_base_component_data_1_0_0_t gprc_data;
mca_gpr_base_init_fn_t gprc_init;
mca_gpr_base_finalize_fn_t gprc_finalize;
mca_gpr_base_component_init_fn_t gprc_init;
mca_gpr_base_component_finalize_fn_t gprc_finalize;
};
typedef struct mca_gpr_base_component_1_0_0_t mca_gpr_base_component_1_0_0_t;
typedef mca_gpr_base_component_1_0_0_t mca_gpr_base_component_t;
struct mca_gpr_base_module_1_0_0_t {
/* non-public utility functions - must be provided */
mca_gpr_base_module_send_fn_t send;
mca_gpr_base_module_recv_fn_t recv;
/* public functions - must be provided */
mca_gpr_base_module_get_fn_t get;
mca_gpr_base_module_put_fn_t put;
mca_gpr_base_module_definesegment_fn_t definesegment;
mca_gpr_base_module_deletesegment_fn_t deletesegment;
mca_gpr_base_module_subscribe_fn_t subscribe;
mca_gpr_base_module_unsubscribe_fn_t unsubscribe;
mca_gpr_base_module_delete_fn_t delete;
/* block functions - may be provided */
mca_gpr_base_module_getbuf_fn_t getbuf;
mca_gpr_base_module_packbuf_fn_t packbuf;
mca_gpr_base_module_packstring_fn_t pack_string;
mca_gpr_base_module_unpackstring_fn_t unpack_string;
mca_gpr_base_module_unpackbuf_fn_t unpack_buf;
mca_gpr_base_module_sendbuf_fn_t sendbuf;
};
typedef struct mca_gpr_base_module_1_0_0_t mca_gpr_base_module_1_0_0_t;
struct mca_gpr_1_0_0_t {
/* non-public utility functions - must be provided */
mca_gpr_base_send_fn_t send;
mca_gpr_base_recv_fn_t recv;
/* public functions - must be provided */
mca_gpr_base_get_fn_t get;
mca_gpr_base_put_fn_t put;
mca_gpr_base_definesegment_fn_t definesegment;
mca_gpr_base_deletesegment_fn_t deletesegment;
mca_gpr_base_subscribe_fn_t subscribe;
mca_gpr_base_unsubscribe_fn_t unsubscribe;
mca_gpr_base_delete_fn_t delete;
/* block functions - may be provided */
mca_gpr_base_getbuf_fn_t getbuf;
mca_gpr_base_packbuf_fn_t packbuf;
mca_gpr_base_packstring_fn_t pack_string;
mca_gpr_base_unpackstring_fn_t unpack_string;
mca_gpr_base_unpackbuf_fn_t unpack_buf;
mca_gpr_base_sendbuf_fn_t sendbuf;
};
typedef struct mca_gpr_1_0_0_t mca_gpr_1_0_0_t;
typedef mca_gpr_base_module_1_0_0_t mca_gpr_base_module_t;
typedef mca_gpr_1_0_0_t mca_gpr_t;
/*
* Macro for use in modules that are of type coll v1.0.0

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

@ -8,7 +8,7 @@
#include "mca/mca.h"
/*
* Macro for use in modules that are of type io v1.0.0
* Macro for use in components that are of type io v1.0.0
* 1-1 mapping of all MPI-IO functions
*/
#define MCA_IO_BASE_VERSION_1_0_0 \
@ -16,27 +16,24 @@
"io", 1, 0, 0
/*
* Macro for use in modules that are of type io v2.0.0
* Macro for use in components that are of type io v2.0.0
* as of yet undefined, but not 1-1 mapping of all MPI-IO functions
*/
#define MCA_IO_BASE_VERSION_2_0_0 \
MCA_BASE_VERSION_1_0_0, \
"io", 2, 0, 0
struct mca_io_base_module_1_0_0_t;
typedef struct mca_io_base_module_1_0_0_t * (*mca_io_base_component_init_fn_t)
(int *priority, int* min_thread, int* max_thread);
struct mca_io_1_0_0_t;
typedef struct mca_io_1_0_0_t * (*mca_io_base_module_init_fn_t)(
int* priority, int* min_thread, int* max_thread);
/* IO module version and interface functions. */
struct mca_io_base_module_1_0_0_t {
mca_base_module_t version;
mca_base_module_data_1_0_0_t data;
mca_io_base_module_init_fn_t init;
/* IO component version and interface functions. */
struct mca_io_base_component_1_0_0_t {
mca_base_component_t io_version;
mca_base_component_data_1_0_0_t io_data;
mca_io_base_component_init_fn_t io_init;
};
typedef struct mca_io_base_module_1_0_0_t mca_io_base_module_1_0_0_t;
typedef struct mca_io_base_component_1_0_0_t mca_io_base_component_1_0_0_t;
/*
@ -44,194 +41,238 @@ typedef struct mca_io_base_module_1_0_0_t mca_io_base_module_1_0_0_t;
* add prototypes for all MPI-IO functions to io_romio.h
* add typedefs for all MPI-IO functions to io.h
* add all functions to struct mca_io_1_0_0_t in io.h
* set all functions in struct in io_romio_module.c
* set all functions in struct in io_romio_component.c
*/
typedef int (*mca_io_base_File_open_t)(MPI_Comm comm, char *filename, int amode,
MPI_Info info, MPI_File *fh);
typedef int (*mca_io_base_File_close_t)(MPI_File *fh);
typedef int (*mca_io_base_File_delete_t)(char *filename, MPI_Info info);
typedef int (*mca_io_base_File_set_size_t)(MPI_File fh, MPI_Offset size);
typedef int (*mca_io_base_File_preallocate_t)(MPI_File fh, MPI_Offset size);
typedef int (*mca_io_base_File_get_size_t)(MPI_File fh, MPI_Offset *size);
typedef int (*mca_io_base_File_get_group_t)(MPI_File fh, MPI_Group *group);
typedef int (*mca_io_base_File_get_amode_t)(MPI_File fh, int *amode);
typedef int (*mca_io_base_File_set_info_t)(MPI_File fh, MPI_Info info);
typedef int (*mca_io_base_File_get_info_t)(MPI_File fh, MPI_Info *info_used);
typedef int (*mca_io_base_module_File_open_t)
(struct ompi_communicator_t *comm, char *filename, int amode,
struct ompi_info_t *info, struct ompi_file_t **fh);
typedef int (*mca_io_base_module_File_close_t)(struct ompi_file_t **fh);
typedef int (*mca_io_base_module_File_delete_t)
(char *filename, struct ompi_info_t *info);
typedef int (*mca_io_base_module_File_set_size_t)
(struct ompi_file_t *fh, MPI_Offset size);
typedef int (*mca_io_base_module_File_preallocate_t)
(struct ompi_file_t *fh, MPI_Offset size);
typedef int (*mca_io_base_module_File_get_size_t)
(struct ompi_file_t *fh, MPI_Offset *size);
typedef int (*mca_io_base_module_File_get_group_t)
(struct ompi_file_t *fh, struct ompi_group_t **group);
typedef int (*mca_io_base_module_File_get_amode_t)
(struct ompi_file_t *fh, int *amode);
typedef int (*mca_io_base_module_File_set_info_t)
(struct ompi_file_t *fh, struct ompi_info_t *info);
typedef int (*mca_io_base_module_File_get_info_t)
(struct ompi_file_t *fh, struct ompi_info_t **info_used);
typedef int (*mca_io_base_File_set_view_t)(MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
MPI_Datatype filetype, char *datarep, MPI_Info info);
typedef int (*mca_io_base_File_get_view_t)(MPI_File fh, MPI_Offset *disp,
MPI_Datatype *etype, MPI_Datatype *filetype, char *datarep);
typedef int (*mca_io_base_module_File_set_view_t)
(struct ompi_file_t *fh, MPI_Offset disp, struct ompi_datatype_t *etype,
struct ompi_datatype_t *filetype, char *datarep, struct ompi_info_t *info);
typedef int (*mca_io_base_module_File_get_view_t)
(struct ompi_file_t *fh, MPI_Offset *disp,
struct ompi_datatype_t **etype, struct ompi_datatype_t **filetype,
char *datarep);
typedef int (*mca_io_base_File_read_at_t)(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Status *status);
typedef int (*mca_io_base_File_read_at_all_t)(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Status *status);
typedef int (*mca_io_base_File_write_at_t)(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Status *status);
typedef int (*mca_io_base_File_write_at_all_t)(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Status *status);
typedef int (*mca_io_base_module_File_read_at_t)
(struct ompi_file_t *fh, MPI_Offset offset, void *buf,
int count, struct ompi_datatype_t *datatype,
struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_read_at_all_t)
(struct ompi_file_t *fh, MPI_Offset offset, void *buf,
int count, struct ompi_datatype_t *datatype,
struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_at_t)
(struct ompi_file_t *fh, MPI_Offset offset, void *buf,
int count, struct ompi_datatype_t *datatype,
struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_at_all_t)
(struct ompi_file_t *fh, MPI_Offset offset, void *buf,
int count, struct ompi_datatype_t *datatype,
struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_iread_at_t)
(struct ompi_file_t *fh, MPI_Offset offset, void *buf,
int count, struct ompi_datatype_t *datatype,
struct ompi_request_t **request);
typedef int (*mca_io_base_module_File_iwrite_at_t)
(struct ompi_file_t *fh, MPI_Offset offset, void *buf,
int count, struct ompi_datatype_t *datatype,
struct ompi_request_t **request);
typedef int (*mca_io_base_File_iread_at_t)(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Request *request);
typedef int (*mca_io_base_File_iwrite_at_t)(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype, MPI_Request *request);
typedef int (*mca_io_base_module_File_read_t)
(struct ompi_file_t *fh, void *buf, int count, MPI_Datatype
datatype, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_read_all_t)
(struct ompi_file_t *fh, void *buf, int count, MPI_Datatype
datatype, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_t)
(struct ompi_file_t *fh, void *buf, int count, MPI_Datatype
datatype, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_all_t)
(struct ompi_file_t *fh, void *buf, int count, MPI_Datatype
datatype, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_iread_t)
(struct ompi_file_t *fh, void *buf, int count, MPI_Datatype
datatype, struct ompi_request_t **request);
typedef int (*mca_io_base_module_File_iwrite_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype, struct ompi_request_t **request);
typedef int (*mca_io_base_File_read_t)(MPI_File fh, void *buf, int count, MPI_Datatype
datatype, MPI_Status *status);
typedef int (*mca_io_base_File_read_all_t)(MPI_File fh, void *buf, int count, MPI_Datatype
datatype, MPI_Status *status);
typedef int (*mca_io_base_File_write_t)(MPI_File fh, void *buf, int count, MPI_Datatype
datatype, MPI_Status *status);
typedef int (*mca_io_base_File_write_all_t)(MPI_File fh, void *buf, int count, MPI_Datatype
datatype, MPI_Status *status);
typedef int (*mca_io_base_module_File_seek_t)
(struct ompi_file_t *fh, MPI_Offset offset, int whence);
typedef int (*mca_io_base_module_File_get_position_t)
(struct ompi_file_t *fh, MPI_Offset *offset);
typedef int (*mca_io_base_module_File_get_byte_offset_t)
(struct ompi_file_t *fh, MPI_Offset offset, MPI_Offset *disp);
typedef int (*mca_io_base_module_File_read_shared_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_shared_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_iread_shared_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype, struct ompi_request_t **request);
typedef int (*mca_io_base_module_File_iwrite_shared_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype, struct ompi_request_t **request);
typedef int (*mca_io_base_module_File_read_ordered_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_ordered_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_seek_shared_t)
(struct ompi_file_t *fh, MPI_Offset offset, int whence);
typedef int (*mca_io_base_module_File_get_position_shared_t)
(struct ompi_file_t *fh, MPI_Offset *offset);
typedef int (*mca_io_base_File_iread_t)(MPI_File fh, void *buf, int count, MPI_Datatype
datatype, MPI_Request *request);
typedef int (*mca_io_base_File_iwrite_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Request *request);
typedef int (*mca_io_base_module_File_read_at_all_begin_t)
(struct ompi_file_t *fh, MPI_Offset offset, void *buf,
int count, struct ompi_datatype_t *datatype);
typedef int (*mca_io_base_module_File_read_at_all_end_t)
(struct ompi_file_t *fh, void *buf, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_at_all_begin_t)
(struct ompi_file_t *fh, MPI_Offset offset, void *buf,
int count, struct ompi_datatype_t *datatype);
typedef int (*mca_io_base_module_File_write_at_all_end_t)
(struct ompi_file_t *fh, void *buf, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_read_all_begin_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype);
typedef int (*mca_io_base_module_File_read_all_end_t)
(struct ompi_file_t *fh, void *buf, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_all_begin_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype);
typedef int (*mca_io_base_module_File_write_all_end_t)
(struct ompi_file_t *fh, void *buf, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_read_ordered_begin_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype);
typedef int (*mca_io_base_module_File_read_ordered_end_t)
(struct ompi_file_t *fh, void *buf, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_write_ordered_begin_t)
(struct ompi_file_t *fh, void *buf, int count,
struct ompi_datatype_t *datatype);
typedef int (*mca_io_base_module_File_write_ordered_end_t)
(struct ompi_file_t *fh, void *buf, struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_File_get_type_extent_t)
(struct ompi_file_t *fh, struct ompi_datatype_t *datatype,
MPI_Aint *extent);
typedef int (*mca_io_base_File_seek_t)(MPI_File fh, MPI_Offset offset, int whence);
typedef int (*mca_io_base_File_get_position_t)(MPI_File fh, MPI_Offset *offset);
typedef int (*mca_io_base_File_get_byte_offset_t)(MPI_File fh, MPI_Offset offset,
MPI_Offset *disp);
typedef int (*mca_io_base_module_File_set_atomicity_t)
(struct ompi_file_t *fh, int flag);
typedef int (*mca_io_base_module_File_get_atomicity_t)
(struct ompi_file_t *fh, int *flag);
typedef int (*mca_io_base_module_File_sync_t)(struct ompi_file_t *fh);
typedef int (*mca_io_base_File_read_shared_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status);
typedef int (*mca_io_base_File_write_shared_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status);
typedef int (*mca_io_base_File_iread_shared_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Request *request);
typedef int (*mca_io_base_File_iwrite_shared_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Request *request);
typedef int (*mca_io_base_File_read_ordered_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status);
typedef int (*mca_io_base_File_write_ordered_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status);
typedef int (*mca_io_base_File_seek_shared_t)(MPI_File fh, MPI_Offset offset, int whence);
typedef int (*mca_io_base_File_get_position_shared_t)(MPI_File fh, MPI_Offset *offset);
typedef int (*mca_io_base_module_File_set_errhandler_t)
(struct ompi_file_t *fh, MPI_Errhandler e);
typedef int (*mca_io_base_module_File_get_errhandler_t)
(struct ompi_file_t *fh, MPI_Errhandler *e );
typedef int (*mca_io_base_File_read_at_all_begin_t)(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype);
typedef int (*mca_io_base_File_read_at_all_end_t)(MPI_File fh, void *buf, MPI_Status *status);
typedef int (*mca_io_base_File_write_at_all_begin_t)(MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype);
typedef int (*mca_io_base_File_write_at_all_end_t)(MPI_File fh, void *buf, MPI_Status *status);
typedef int (*mca_io_base_File_read_all_begin_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype);
typedef int (*mca_io_base_File_read_all_end_t)(MPI_File fh, void *buf, MPI_Status *status);
typedef int (*mca_io_base_File_write_all_begin_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype);
typedef int (*mca_io_base_File_write_all_end_t)(MPI_File fh, void *buf, MPI_Status *status);
typedef int (*mca_io_base_File_read_ordered_begin_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype);
typedef int (*mca_io_base_File_read_ordered_end_t)(MPI_File fh, void *buf, MPI_Status *status);
typedef int (*mca_io_base_File_write_ordered_begin_t)(MPI_File fh, void *buf, int count,
MPI_Datatype datatype);
typedef int (*mca_io_base_File_write_ordered_end_t)(MPI_File fh, void *buf, MPI_Status *status);
typedef int (*mca_io_base_module_Test_t)
(struct ompi_request_t **request, int *flag,
struct ompi_status_public_t *status);
typedef int (*mca_io_base_module_Wait_t)
(struct ompi_request_t **request, struct ompi_status_public_t *status);
typedef int (*mca_io_base_File_get_type_extent_t)(MPI_File fh, MPI_Datatype datatype,
MPI_Aint *extent);
struct mca_io_base_module_1_0_0_t {
mca_io_base_module_File_open_t mca_io_File_open;
mca_io_base_module_File_close_t mca_io_File_close;
mca_io_base_module_File_delete_t mca_io_File_delete;
mca_io_base_module_File_set_size_t mca_io_File_set_size;
mca_io_base_module_File_preallocate_t mca_io_File_preallocate;
mca_io_base_module_File_get_size_t mca_io_File_get_size;
mca_io_base_module_File_get_group_t mca_io_File_get_group;
mca_io_base_module_File_get_amode_t mca_io_File_get_amode;
mca_io_base_module_File_set_info_t mca_io_File_set_info;
mca_io_base_module_File_get_info_t mca_io_File_get_info;
typedef int (*mca_io_base_File_set_atomicity_t)(MPI_File fh, int flag);
typedef int (*mca_io_base_File_get_atomicity_t)(MPI_File fh, int *flag);
typedef int (*mca_io_base_File_sync_t)(MPI_File fh);
mca_io_base_module_File_set_view_t mca_io_File_set_view;
mca_io_base_module_File_get_view_t mca_io_File_get_view;
typedef int (*mca_io_base_File_set_errhandler_t)(MPI_File fh, MPI_Errhandler e);
typedef int (*mca_io_base_File_get_errhandler_t)(MPI_File fh, MPI_Errhandler *e );
mca_io_base_module_File_read_at_t mca_io_File_read_at;
mca_io_base_module_File_read_at_all_t mca_io_File_read_at_all;
mca_io_base_module_File_write_at_t mca_io_File_write_at;
mca_io_base_module_File_write_at_all_t mca_io_File_write_at_all;
typedef int (*mca_io_base_Test_t)(MPI_Request *request, int *flag, MPI_Status *status);
typedef int (*mca_io_base_Wait_t)(MPI_Request *request, MPI_Status *status);
mca_io_base_module_File_iread_at_t mca_io_File_iread_at;
mca_io_base_module_File_iwrite_at_t mca_io_File_iwrite_at;
mca_io_base_module_File_read_t mca_io_File_read;
mca_io_base_module_File_read_all_t mca_io_File_read_all;
mca_io_base_module_File_write_t mca_io_File_write;
mca_io_base_module_File_write_all_t mca_io_File_write_all;
mca_io_base_module_File_iread_t mca_io_File_iread;
mca_io_base_module_File_iwrite_t mca_io_File_iwrite;
mca_io_base_module_File_seek_t mca_io_File_seek;
mca_io_base_module_File_get_position_t mca_io_File_get_position;
mca_io_base_module_File_get_byte_offset_t mca_io_File_get_byte_offset;
mca_io_base_module_File_read_shared_t mca_io_File_read_shared;
mca_io_base_module_File_write_shared_t mca_io_File_write_shared;
mca_io_base_module_File_iread_shared_t mca_io_File_iread_shared;
mca_io_base_module_File_iwrite_shared_t mca_io_File_iwrite_shared;
mca_io_base_module_File_read_ordered_t mca_io_File_read_ordered;
mca_io_base_module_File_write_ordered_t mca_io_File_write_ordered;
mca_io_base_module_File_seek_shared_t mca_io_File_seek_shared;
mca_io_base_module_File_get_position_shared_t mca_io_File_get_position_shared;
struct mca_io_1_0_0_t {
mca_io_base_File_open_t mca_io_File_open;
mca_io_base_File_close_t mca_io_File_close;
mca_io_base_File_delete_t mca_io_File_delete;
mca_io_base_File_set_size_t mca_io_File_set_size;
mca_io_base_File_preallocate_t mca_io_File_preallocate;
mca_io_base_File_get_size_t mca_io_File_get_size;
mca_io_base_File_get_group_t mca_io_File_get_group;
mca_io_base_File_get_amode_t mca_io_File_get_amode;
mca_io_base_File_set_info_t mca_io_File_set_info;
mca_io_base_File_get_info_t mca_io_File_get_info;
mca_io_base_module_File_read_at_all_begin_t mca_io_File_read_at_all_begin;
mca_io_base_module_File_read_at_all_end_t mca_io_File_read_at_all_end;
mca_io_base_module_File_write_at_all_begin_t mca_io_File_write_at_all_begin;
mca_io_base_module_File_write_at_all_end_t mca_io_File_write_at_all_end;
mca_io_base_module_File_read_all_begin_t mca_io_File_read_all_begin;
mca_io_base_module_File_read_all_end_t mca_io_File_read_all_end;
mca_io_base_module_File_write_all_begin_t mca_io_File_write_all_begin;
mca_io_base_module_File_write_all_end_t mca_io_File_write_all_end;
mca_io_base_module_File_read_ordered_begin_t mca_io_File_read_ordered_begin;
mca_io_base_module_File_read_ordered_end_t mca_io_File_read_ordered_end;
mca_io_base_module_File_write_ordered_begin_t mca_io_File_write_ordered_begin;
mca_io_base_module_File_write_ordered_end_t mca_io_File_write_ordered_end;
mca_io_base_File_set_view_t mca_io_File_set_view;
mca_io_base_File_get_view_t mca_io_File_get_view;
mca_io_base_module_File_get_type_extent_t mca_io_File_get_type_extent;
mca_io_base_File_read_at_t mca_io_File_read_at;
mca_io_base_File_read_at_all_t mca_io_File_read_at_all;
mca_io_base_File_write_at_t mca_io_File_write_at;
mca_io_base_File_write_at_all_t mca_io_File_write_at_all;
mca_io_base_module_File_set_atomicity_t mca_io_File_set_atomicity;
mca_io_base_module_File_get_atomicity_t mca_io_File_get_atomicity;
mca_io_base_module_File_sync_t mca_io_File_sync;
mca_io_base_File_iread_at_t mca_io_File_iread_at;
mca_io_base_File_iwrite_at_t mca_io_File_iwrite_at;
mca_io_base_File_read_t mca_io_File_read;
mca_io_base_File_read_all_t mca_io_File_read_all;
mca_io_base_File_write_t mca_io_File_write;
mca_io_base_File_write_all_t mca_io_File_write_all;
mca_io_base_File_iread_t mca_io_File_iread;
mca_io_base_File_iwrite_t mca_io_File_iwrite;
mca_io_base_File_seek_t mca_io_File_seek;
mca_io_base_File_get_position_t mca_io_File_get_position;
mca_io_base_File_get_byte_offset_t mca_io_File_get_byte_offset;
mca_io_base_File_read_shared_t mca_io_File_read_shared;
mca_io_base_File_write_shared_t mca_io_File_write_shared;
mca_io_base_File_iread_shared_t mca_io_File_iread_shared;
mca_io_base_File_iwrite_shared_t mca_io_File_iwrite_shared;
mca_io_base_File_read_ordered_t mca_io_File_read_ordered;
mca_io_base_File_write_ordered_t mca_io_File_write_ordered;
mca_io_base_File_seek_shared_t mca_io_File_seek_shared;
mca_io_base_File_get_position_shared_t mca_io_File_get_position_shared;
mca_io_base_File_read_at_all_begin_t mca_io_File_read_at_all_begin;
mca_io_base_File_read_at_all_end_t mca_io_File_read_at_all_end;
mca_io_base_File_write_at_all_begin_t mca_io_File_write_at_all_begin;
mca_io_base_File_write_at_all_end_t mca_io_File_write_at_all_end;
mca_io_base_File_read_all_begin_t mca_io_File_read_all_begin;
mca_io_base_File_read_all_end_t mca_io_File_read_all_end;
mca_io_base_File_write_all_begin_t mca_io_File_write_all_begin;
mca_io_base_File_write_all_end_t mca_io_File_write_all_end;
mca_io_base_File_read_ordered_begin_t mca_io_File_read_ordered_begin;
mca_io_base_File_read_ordered_end_t mca_io_File_read_ordered_end;
mca_io_base_File_write_ordered_begin_t mca_io_File_write_ordered_begin;
mca_io_base_File_write_ordered_end_t mca_io_File_write_ordered_end;
mca_io_base_File_get_type_extent_t mca_io_File_get_type_extent;
mca_io_base_File_set_atomicity_t mca_io_File_set_atomicity;
mca_io_base_File_get_atomicity_t mca_io_File_get_atomicity;
mca_io_base_File_sync_t mca_io_File_sync;
mca_io_base_File_set_errhandler_t mca_io_File_set_errhandler;
mca_io_base_File_get_errhandler_t mca_io_File_get_errhandler;
mca_io_base_Test_t mca_io_Test;
mca_io_base_Wait_t mca_io_Wait;
mca_io_base_module_File_set_errhandler_t mca_io_File_set_errhandler;
mca_io_base_module_File_get_errhandler_t mca_io_File_get_errhandler;
mca_io_base_module_Test_t mca_io_Test;
mca_io_base_module_Wait_t mca_io_Wait;
};
typedef struct mca_io_1_0_0_t mca_io_1_0_0_t;
typedef struct mca_io_base_module_1_0_0_t mca_io_base_module_1_0_0_t;
#endif /* MCA_IO_H */

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

@ -14,7 +14,7 @@ libmca_io_romio_la_SOURCES = \
io_romio.h \
io_romio_conv.h \
io_romio_global.c \
io_romio_module.c \
io_romio_component.c \
io_romio_file_open.c \
io_romio_file_read.c \
io_romio_file_request.c \

51
src/mca/io/romio/src/io_romio_component.c Обычный файл
Просмотреть файл

@ -0,0 +1,51 @@
/*
* $HEADER$
*/
#include "mpi.h"
#include "mca/io/io.h"
#include "io_romio.h"
mca_io_1_0_0_t *mca_io_romio_component_init (int *priority,
int *min_thread,
int *max_thread);
mca_io_base_component_1_0_0_t mca_io_romio_component = {
/* First, the mca_base_component_t struct containing meta information
about the component itself */
{
/* Indicate that we are a io v1.0.0 component (which also implies a
specific MCA version) */
MCA_IO_BASE_VERSION_1_0_0,
"romio", /* MCA component name */
1, /* MCA component major version */
0, /* MCA component minor version */
0, /* MCA component release version */
NULL,
NULL
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
false
},
mca_io_romio_component_init /* component init */
};
mca_io_1_0_0_t *
mca_io_romio_component_init (int *priority,
int *min_thread,
int *max_thread)
{
*priority = 10;
*min_thread = MPI_THREAD_SINGLE;
*max_thread = MPI_THREAD_SERIALIZED;
return &mca_io_romio_ops;
}

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

@ -1,51 +0,0 @@
/*
* $HEADER$
*/
#include "mpi.h"
#include "mca/io/io.h"
#include "io_romio.h"
mca_io_1_0_0_t *mca_io_romio_module_init (int *priority,
int *min_thread,
int *max_thread);
mca_io_base_module_1_0_0_t mca_io_romio_module = {
/* First, the mca_base_module_t struct containing meta information
about the module itself */
{
/* Indicate that we are a io v1.0.0 module (which also implies a
specific MCA version) */
MCA_IO_BASE_VERSION_1_0_0,
"romio", /* MCA module name */
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
NULL,
NULL
},
/* Next the MCA v1.0.0 module meta data */
{
/* Whether the module is checkpointable or not */
false
},
mca_io_romio_module_init /* module init */
};
mca_io_1_0_0_t *
mca_io_romio_module_init (int *priority,
int *min_thread,
int *max_thread)
{
*priority = 10;
*min_thread = MPI_THREAD_SINGLE;
*max_thread = MPI_THREAD_SERIALIZED;
return &mca_io_romio_ops;
}

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

@ -17,13 +17,13 @@
/**
* MCA component open function.
*
* @retval MCA_SUCCESS This module can be used in the process.
* @retval MCA_SUCCESS This component can be used in the process.
*
* @retval anything_else The MCA will ignore this module for the
* @retval anything_else The MCA will ignore this component for the
* duration of the process.
*
* All MCA components can have an "open" function that is invoked once
* per process, when the module is located and loaded. This function
* per process, when the component is located and loaded. This function
* should register any MCA parameters (using
* mca_base_param_register_int() and mca_base_param_register_string())
* that will be used by the component. Parameter registrations should
@ -37,7 +37,7 @@
*
* This function should return MCA_SUCCESS if it wishes to remain
* loaded in the process. Any other return value will cause the MCA
* base to unload the module. Although most components do not use
* base to unload the component. Although most components do not use
* this mechanism to force themselves to be unloaded (because if they
* are immediately unloaded, ompi_info will not display them), the
* mechanism is available should the need arise.
@ -48,7 +48,7 @@
* function. In this cause, the MCA will act as if it called the open
* function and it returned MCA_SUCCESS.
*/
typedef int (*mca_base_open_module_fn_t)(void);
typedef int (*mca_base_open_component_fn_t)(void);
/** MCA component close function
*
@ -70,7 +70,7 @@ typedef int (*mca_base_open_module_fn_t)(void);
* this function. In this case, the MCA will act as if it called the
* close function and it returned MCA_SUCCESS.
*/
typedef int (*mca_base_close_module_fn_t)(void);
typedef int (*mca_base_close_component_fn_t)(void);
/**
@ -80,7 +80,7 @@ typedef int (*mca_base_close_module_fn_t)(void);
/**
* Maximum length of MCA component string names.
*/
#define MCA_BASE_MAX_MODULE_NAME_LEN 64
#define MCA_BASE_MAX_COMPONENT_NAME_LEN 64
/**
* Common type for all MCA components.
@ -90,7 +90,7 @@ typedef int (*mca_base_close_module_fn_t)(void);
* particular version of a specific framework, and to publish its own
* name and version.
*/
struct mca_base_module_t {
struct mca_base_component_t {
int mca_major_version;
/**< Major number of the MCA. */
@ -111,36 +111,36 @@ struct mca_base_module_t {
/**< Release version number of the framework that this component
belongs to. */
char mca_module_name[MCA_BASE_MAX_MODULE_NAME_LEN];
char mca_component_name[MCA_BASE_MAX_COMPONENT_NAME_LEN];
/**< This comopnent's string name. */
int mca_module_major_version;
int mca_component_major_version;
/**< This component's major version number. */
int mca_module_minor_version;
int mca_component_minor_version;
/**< This component's minor version number. */
int mca_module_release_version;
int mca_component_release_version;
/**< This component's release version number. */
mca_base_open_module_fn_t mca_open_module;
/**< Method for opening this module. */
mca_base_close_module_fn_t mca_close_module;
/**< Method for closing this module. */
mca_base_open_component_fn_t mca_open_component;
/**< Method for opening this component. */
mca_base_close_component_fn_t mca_close_component;
/**< Method for closing this component. */
};
/**
* Convenience typedef.
*/
typedef struct mca_base_module_t mca_base_module_t;
typedef struct mca_base_component_t mca_base_component_t;
/**
* Meta data for MCA v1.0.0 modules.
* Meta data for MCA v1.0.0 components.
*/
struct mca_base_module_data_1_0_0_t {
struct mca_base_component_data_1_0_0_t {
bool mca_is_checkpointable;
/**< Indicates whether this module is checkpointable or not. */
/**< Indicates whether this component is checkpointable or not. */
};
/**
* Convenience typedef.
*/
typedef struct mca_base_module_data_1_0_0_t mca_base_module_data_1_0_0_t;
typedef struct mca_base_component_data_1_0_0_t mca_base_component_data_1_0_0_t;
/**
* Macro for framework author convenience.

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

@ -17,7 +17,7 @@
struct mca_mpool_base_selected_module_t {
ompi_list_item_t super;
mca_mpool_base_component_t *mpool_component;
mca_mpool_t *mpool_module;
mca_mpool_base_module_t *mpool_module;
};
typedef struct mca_mpool_base_selected_module_t mca_mpool_base_selected_module_t;
@ -34,7 +34,7 @@ extern "C" {
int mca_mpool_base_init(bool *allow_multi_user_threads);
int mca_mpool_base_close(void);
mca_mpool_base_component_t* mca_mpool_component_lookup(const char* name);
mca_mpool_t* mca_mpool_module_lookup(const char* name);
mca_mpool_base_module_t* mca_mpool_module_lookup(const char* name);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

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

@ -18,25 +18,26 @@ int mca_mpool_base_close(void)
ompi_list_item_t *item;
mca_mpool_base_selected_module_t *sm;
/* Finalize all the mpool modules and free their list items */
/* Finalize all the mpool components and free their list items */
for (item = ompi_list_remove_first(&mca_mpool_base_modules);
for (item = ompi_list_remove_first(&mca_mpool_base_components);
NULL != item;
item = ompi_list_remove_first(&mca_mpool_base_modules)) {
item = ompi_list_remove_first(&mca_mpool_base_components)) {
sm = (mca_mpool_base_selected_module_t *) item;
/* Blatently ignore the return code (what would we do to recover,
anyway? This module is going away, so errors don't matter
anyway? This component is going away, so errors don't matter
anymore) */
sm->mpool_module->mpool_finalize(sm->mpool_module);
free(sm);
}
/* Close all remaining available modules (may be one if this is a
/* Close all remaining available components (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
mca_base_modules_close(mca_mpool_base_output, &mca_mpool_base_components, NULL);
mca_base_components_close(mca_mpool_base_output,
&mca_mpool_base_components, NULL);
/* All done */

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

@ -27,9 +27,9 @@ int mca_mpool_base_init(bool *allow_multi_user_threads)
{
bool user_threads;
ompi_list_item_t *item;
mca_base_module_list_item_t *mli;
mca_base_component_list_item_t *cli;
mca_mpool_base_component_t *component;
mca_mpool_t *module;
mca_mpool_base_module_t *module;
mca_mpool_base_selected_module_t *sm;
/* Default to true in case there's no modules selected */
@ -42,16 +42,16 @@ int mca_mpool_base_init(bool *allow_multi_user_threads)
for (item = ompi_list_get_first(&mca_mpool_base_components);
ompi_list_get_end(&mca_mpool_base_components) != item;
item = ompi_list_get_next(item)) {
mli = (mca_base_module_list_item_t *) item;
component = (mca_mpool_base_component_t *) mli->mli_module;
cli = (mca_base_component_list_item_t *) item;
component = (mca_mpool_base_component_t *) cli->cli_component;
ompi_output_verbose(10, mca_mpool_base_output,
"select: initializing %s module %s",
component->mpool_version.mca_type_name,
component->mpool_version.mca_module_name);
"select: initializing %s module %s",
component->mpool_version.mca_type_name,
component->mpool_version.mca_component_name);
if (NULL == component->mpool_init) {
ompi_output_verbose(10, mca_mpool_base_output,
"select: no init function; ignoring module");
"select: no init function; ignoring module");
} else {
module = component->mpool_init(&user_threads);
@ -59,12 +59,12 @@ int mca_mpool_base_init(bool *allow_multi_user_threads)
if (NULL == module) {
ompi_output_verbose(10, mca_mpool_base_output,
"select: init returned failure");
"select: init returned failure");
mca_base_module_repository_release((mca_base_module_t *) component);
mca_base_component_repository_release((mca_base_component_t *) component);
ompi_output_verbose(10, mca_mpool_base_output,
"select: component %s unloaded",
component->mpool_version.mca_module_name);
"select: component %s unloaded",
component->mpool_version.mca_component_name);
}
/* Otherwise, it initialized properly. Save it. */

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

@ -11,6 +11,7 @@
#include "mca/mpool/mpool.h"
#include "mca/mpool/base/base.h"
mca_mpool_base_component_t* mca_mpool_component_lookup(const char* name)
{
/* Traverse the list of available modules; call their init functions. */
@ -18,9 +19,11 @@ mca_mpool_base_component_t* mca_mpool_component_lookup(const char* name)
for (item = ompi_list_get_first(&mca_mpool_base_components);
item != ompi_list_get_end(&mca_mpool_base_components);
item = ompi_list_get_next(item)) {
mca_base_module_list_item_t *mli = (mca_base_module_list_item_t *) item;
mca_mpool_base_component_t* component = (mca_mpool_base_component_t *) mli->mli_module;
if(strcmp(component->mpool_version.mca_module_name,name) == 0) {
mca_base_component_list_item_t *cli =
(mca_base_component_list_item_t *) item;
mca_mpool_base_component_t* component =
(mca_mpool_base_component_t *) cli->cli_component;
if(strcmp(component->mpool_version.mca_component_name, name) == 0) {
return component;
}
}
@ -28,7 +31,7 @@ mca_mpool_base_component_t* mca_mpool_component_lookup(const char* name)
}
mca_mpool_t* mca_mpool_module_lookup(const char* name)
mca_mpool_base_module_t* mca_mpool_module_lookup(const char* name)
{
/* Finalize all the mpool modules and free their list items */
ompi_list_item_t *item;
@ -36,7 +39,8 @@ mca_mpool_t* mca_mpool_module_lookup(const char* name)
item != ompi_list_get_end(&mca_mpool_base_modules);
item = ompi_list_get_next(item)) {
mca_mpool_base_selected_module_t *sm = (mca_mpool_base_selected_module_t *) item;
if(strcmp(sm->mpool_component->mpool_version.mca_module_name,name) == 0) {
if(strcmp(sm->mpool_component->mpool_version.mca_component_name,
name) == 0) {
return sm->mpool_module;
}
}

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

@ -15,10 +15,10 @@
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* module's public mca_base_module_t struct.
* component's public mca_base_component_t struct.
*/
#include "mca/mpool/base/static-modules.h"
#include "mca/mpool/base/static-components.h"
/*
@ -30,16 +30,16 @@ ompi_list_t mca_mpool_base_modules;
/**
* Function for finding and opening either all MCA modules, or the one
* Function for finding and opening either all MCA components, or the one
* that was specifically requested via a MCA parameter.
*/
int mca_mpool_base_open(void)
{
/* Open up all available modules */
/* Open up all available components */
if (OMPI_SUCCESS !=
mca_base_modules_open("mpool", 0, mca_mpool_base_static_modules,
&mca_mpool_base_components)) {
mca_base_components_open("mpool", 0, mca_mpool_base_static_components,
&mca_mpool_base_components)) {
return OMPI_ERROR;
}
@ -47,7 +47,7 @@ int mca_mpool_base_open(void)
iterate over it (even if it's empty, as in the case of
ompi_info) */
OBJ_CONSTRUCT(&mca_mpool_base_modules, ompi_list_t);
OBJ_CONSTRUCT(&mca_mpool_base_components, ompi_list_t);
/* All done */

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

@ -12,60 +12,62 @@
struct mca_mpool_t;
/**
* component initialize
*/
typedef struct mca_mpool_base_module_t* (*mca_mpool_base_component_init_fn_t)
(bool *allow_multi_user_threads);
/**
* if appropriate - returns base address of memory pool
*/
typedef void* (*mca_mpool_base_address_fn_t)(void);
typedef void* (*mca_mpool_base_module_address_fn_t)(void);
/**
* allocate function typedef
*/
typedef void* (*mca_mpool_base_alloc_fn_t)(size_t size, size_t align);
typedef void* (*mca_mpool_base_module_alloc_fn_t)(size_t size, size_t align);
/**
* allocate function typedef
*/
typedef void* (*mca_mpool_base_alloc_and_register_fn_t)(size_t size, size_t align, void* user);
typedef void* (*mca_mpool_base_module_alloc_and_register_fn_t)(size_t size, size_t align, void* user);
/**
* realloc function typedef
*/
typedef void* (*mca_mpool_base_realloc_fn_t)(void* addr, size_t size);
typedef void* (*mca_mpool_base_module_realloc_fn_t)(void* addr, size_t size);
/**
* free function typedef
*/
typedef void (*mca_mpool_base_free_fn_t)(void *);
typedef void (*mca_mpool_base_module_free_fn_t)(void *);
/**
* register memory
*/
typedef int (*mca_mpool_base_register_fn_t)(void * addr, size_t size, void* user);
typedef int (*mca_mpool_base_module_register_fn_t)(void * addr, size_t size, void* user);
/**
* deregister memory
*/
typedef int (*mca_mpool_base_deregister_fn_t)(void * addr, size_t size);
typedef int (*mca_mpool_base_module_deregister_fn_t)(void * addr, size_t size);
/**
* finalize
*/
typedef void (*mca_mpool_base_finalize_fn_t)(struct mca_mpool_t*);
typedef void (*mca_mpool_base_module_finalize_fn_t)(struct mca_mpool_base_module_t*);
/**
* initialize
*/
typedef struct mca_mpool_t* (*mca_mpool_base_init_fn_t)(bool *allow_multi_user_threads);
/**
* mpool component descriptor. Contains component version information
* and open/close/init functions.
*/
struct mca_mpool_base_component_1_0_0_t {
mca_base_module_t mpool_version; /**< version */
mca_base_module_data_1_0_0_t mpool_data;/**< metadata */
mca_mpool_base_init_fn_t mpool_init; /**< init function */
mca_base_component_t mpool_version; /**< version */
mca_base_component_data_1_0_0_t mpool_data;/**< metadata */
mca_mpool_base_component_init_fn_t mpool_init; /**< init function */
};
/**
* Convenience typedef.
@ -80,23 +82,23 @@ typedef struct mca_mpool_base_component_1_0_0_t mca_mpool_base_component_t;
* mpool module descriptor. Contains functions exported
* by the component.
*/
struct mca_mpool_t {
struct mca_mpool_base_module_t {
mca_mpool_base_component_t *mpool_component; /**< component stuct */
mca_mpool_base_address_fn_t mpool_base; /**< returns the base address */
mca_mpool_base_alloc_fn_t mpool_alloc; /**< allocate function */
mca_mpool_base_realloc_fn_t mpool_realloc; /**< reallocate function */
mca_mpool_base_free_fn_t mpool_free; /**< free function */
mca_mpool_base_register_fn_t mpool_register; /**< register memory */
mca_mpool_base_deregister_fn_t mpool_deregister; /**< deregister memory */
mca_mpool_base_finalize_fn_t mpool_finalize; /**< finalize */
mca_mpool_base_module_address_fn_t mpool_base; /**< returns the base address */
mca_mpool_base_module_alloc_fn_t mpool_alloc; /**< allocate function */
mca_mpool_base_module_realloc_fn_t mpool_realloc; /**< reallocate function */
mca_mpool_base_module_free_fn_t mpool_free; /**< free function */
mca_mpool_base_module_register_fn_t mpool_register; /**< register memory */
mca_mpool_base_module_deregister_fn_t mpool_deregister; /**< deregister memory */
mca_mpool_base_module_finalize_fn_t mpool_finalize; /**< finalize */
};
/**
* Convenience typedef
*/
typedef struct mca_mpool_t mca_mpool_t;
typedef struct mca_mpool_base_module_t mca_mpool_base_module_t;
/**
* Macro for use in modules that are of type mpool v1.0.0
* Macro for use in components that are of type mpool v1.0.0
*/
#define MCA_MPOOL_BASE_VERSION_1_0_0 \
/* mpool v1.0 is chained to MCA v1.0 */ \

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

@ -7,10 +7,10 @@
include $(top_ompi_srcdir)/config/Makefile.options
sources = \
mpool_sm.c \
mpool_sm.h \
mpool_sm_mmap.c \
mpool_sm_mmap.h \
mpool_sm_module.c \
mpool_sm_component.c
# Make the output library in this directory, and name it either

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

@ -1,53 +0,0 @@
/*
* $HEADER$
*/
#include <string.h>
#include "util/output.h"
#include "mca/mpool/sm/mpool_sm.h"
#include "mca/mpool/sm/mpool_sm_mmap.h"
mca_mpool_t mca_mpool_sm = {
&mca_mpool_sm_module.super,
mca_mpool_sm_base,
mca_mpool_sm_alloc,
mca_mpool_sm_realloc,
mca_mpool_sm_free,
NULL,
NULL
};
/*
* base address of shared memory mapping
*/
void* mca_mpool_sm_base()
{
return (mca_mpool_sm_module.sm_mmap != NULL) ? mca_mpool_sm_module.sm_mmap->map_addr : NULL;
}
/**
* allocate function
*/
void* mca_mpool_sm_alloc(size_t size, size_t align)
{
return mca_mpool_sm_module.sm_allocator->alc_alloc(mca_mpool_sm_module.sm_allocator, size, align);
}
/**
* realloc function
*/
void* mca_mpool_sm_realloc(void* addr, size_t size)
{
return mca_mpool_sm_module.sm_allocator->alc_realloc(mca_mpool_sm_module.sm_allocator, addr, size);
}
/**
* free function
*/
void mca_mpool_sm_free(void * addr)
{
mca_mpool_sm_module.sm_allocator->alc_free(mca_mpool_sm_module.sm_allocator, addr);
}

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

@ -16,45 +16,36 @@
struct mca_mpool_sm_component_t {
mca_mpool_base_component_t super;
mca_allocator_t* sm_allocator;
mca_allocator_base_module_t* sm_allocator;
char* sm_allocator_name;
size_t sm_size;
struct mca_mpool_sm_mmap_t *sm_mmap;
};
typedef struct mca_mpool_sm_component_t mca_mpool_sm_component_t;
extern mca_mpool_sm_component_t mca_mpool_sm_module;
extern mca_mpool_t mca_mpool_sm;
extern mca_mpool_sm_component_t mca_mpool_sm_component;
extern mca_mpool_base_module_t mca_mpool_sm_module;
/*
* Returns base address of shared memory mapping.
*/
void* mca_mpool_sm_base(void);
/**
* Allocate block of shared memory.
*/
void* mca_mpool_sm_alloc(size_t size, size_t align);
/**
* realloc function typedef
*/
void* mca_mpool_sm_realloc(void* addr, size_t size);
/**
* free function typedef
*/
void mca_mpool_sm_free(void *);
/**
* component open/close/init function
*/
int mca_mpool_sm_open(void);
int mca_mpool_sm_close(void);
mca_mpool_t* mca_mpool_sm_init(bool *allow_multi_user_threads);
#endif

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

@ -1,3 +1,7 @@
/*
* $HEADER$
*/
#include "util/output.h"
#include "mca/base/base.h"
#include "mca/base/mca_base_param.h"
@ -5,43 +9,44 @@
#include "mpool_sm.h"
#include "mpool_sm_mmap.h"
/*
* Local functions
*/
static int mca_mpool_sm_open(void);
static mca_mpool_base_module_t* mca_mpool_sm_init(bool *allow_multi_user_threads);
mca_mpool_sm_component_t mca_mpool_sm_module = {
mca_mpool_sm_component_t mca_mpool_sm_component = {
{
/* First, the mca_base_module_t struct containing meta information
about the module itself */
{
/* Indicate that we are a mpool v1.0.0 component (which also implies a
specific MCA version) */
MCA_MPOOL_BASE_VERSION_1_0_0,
"sm", /* MCA component name */
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
mca_mpool_sm_open, /* component open */
mca_mpool_sm_close /* component close */
},
/* Next the MCA v1.0.0 module meta data */
{
/* Whether the module is checkpointable or not */
false
},
mca_mpool_sm_init
/* First, the mca_base_component_t struct containing meta
information about the component itself */
{
/* Indicate that we are a mpool v1.0.0 component (which also
implies a specific MCA version) */
MCA_MPOOL_BASE_VERSION_1_0_0,
"sm", /* MCA component name */
1, /* MCA component major version */
0, /* MCA component minor version */
0, /* MCA component release version */
mca_mpool_sm_open, /* component open */
NULL
},
/* Next the MCA v1.0.0 component meta data */
{
/* Whether the component is checkpointable or not */
false
},
mca_mpool_sm_init
}
};
static inline char* mca_mpool_sm_param_register_string(
static char* mca_mpool_sm_param_register_string(
const char* param_name,
const char* default_value)
{
@ -50,8 +55,8 @@ static inline char* mca_mpool_sm_param_register_string(
mca_base_param_lookup_string(id, &param_value);
return param_value;
}
static inline int mca_mpool_sm_param_register_int(
static int mca_mpool_sm_param_register_int(
const char* param_name,
int default_value)
{
@ -65,61 +70,55 @@ static inline int mca_mpool_sm_param_register_int(
/**
* component open/close/init function
*/
int mca_mpool_sm_open(void)
static int mca_mpool_sm_open(void)
{
/* register SM module parameters */
mca_mpool_sm_module.sm_size =
/* register SM component parameters */
mca_mpool_sm_component.sm_size =
mca_mpool_sm_param_register_int("size", 512*1024*1024);
mca_mpool_sm_module.sm_allocator_name =
mca_mpool_sm_component.sm_allocator_name =
mca_mpool_sm_param_register_string("allocator", "bucket");
return OMPI_SUCCESS;
}
int mca_mpool_sm_close(void)
static mca_mpool_base_module_t*
mca_mpool_sm_init(bool *allow_multi_user_threads)
{
return OMPI_SUCCESS;
}
mca_mpool_t* mca_mpool_sm_init(bool *allow_multi_user_threads)
{
mca_allocator_base_module_t* allocator_component = mca_allocator_component_lookup(
mca_mpool_sm_module.sm_allocator_name);
mca_allocator_base_component_t* allocator_component = mca_allocator_component_lookup(
mca_mpool_sm_component.sm_allocator_name);
/* if specified allocator cannout be loaded - look for an alternative */
if(NULL == allocator_component) {
if(ompi_list_get_size(&mca_allocator_base_components) == 0) {
mca_base_module_list_item_t* item = (mca_base_module_list_item_t*)
mca_base_component_list_item_t* item = (mca_base_component_list_item_t*)
ompi_list_get_first(&mca_allocator_base_components);
allocator_component = (mca_allocator_base_module_t*)item->mli_module;
allocator_component = (mca_allocator_base_component_t*)item->cli_component;
ompi_output(0, "mca_mpool_sm_init: unable to locate allocator: %s - using %s\n",
mca_mpool_sm_module.sm_allocator_name, allocator_component->allocator_version.mca_module_name);
mca_mpool_sm_component.sm_allocator_name, allocator_component->allocator_version.mca_component_name);
} else {
ompi_output(0, "mca_mpool_sm_init: unable to locate allocator: %s\n",
mca_mpool_sm_module.sm_allocator_name);
mca_mpool_sm_component.sm_allocator_name);
return NULL;
}
}
/* create initial shared memory mapping */
if(NULL == (mca_mpool_sm_module.sm_mmap = mca_mpool_sm_mmap_init(mca_mpool_sm_module.sm_size))) {
if(NULL == (mca_mpool_sm_component.sm_mmap = mca_mpool_sm_mmap_init(mca_mpool_sm_component.sm_size))) {
ompi_output(0, "mca_mpool_sm_init: unable to create shared memory mapping");
return NULL;
}
/* setup allocator */
mca_mpool_sm_module.sm_allocator = allocator_component->allocator_init(
mca_mpool_sm_component.sm_allocator = allocator_component->allocator_init(
allow_multi_user_threads,
mca_mpool_sm_mmap_alloc,
NULL
);
if(NULL == mca_mpool_sm_module.sm_allocator) {
if(NULL == mca_mpool_sm_component.sm_allocator) {
ompi_output(0, "mca_mpool_sm_init: unable to initialize allocator");
return NULL;
}
*allow_multi_user_threads = true;
return &mca_mpool_sm;
return &mca_mpool_sm_module;
}

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

@ -126,7 +126,7 @@ mca_mpool_sm_mmap_t* mca_mpool_sm_mmap_init(size_t size)
void* mca_mpool_sm_mmap_alloc(size_t* size)
{
mca_mpool_sm_mmap_t* map = mca_mpool_sm_module.sm_mmap;
mca_mpool_sm_mmap_t* map = mca_mpool_sm_component.sm_mmap;
mca_mpool_sm_segment_t* seg = map->map_seg;
void* addr;

52
src/mca/mpool/sm/mpool_sm_module.c Обычный файл
Просмотреть файл

@ -0,0 +1,52 @@
/*
* $HEADER$
*/
#include <string.h>
#include "util/output.h"
#include "mca/mpool/sm/mpool_sm.h"
#include "mca/mpool/sm/mpool_sm_mmap.h"
mca_mpool_base_module_t mca_mpool_sm = {
&mca_mpool_sm_component.super,
mca_mpool_sm_base,
mca_mpool_sm_alloc,
mca_mpool_sm_realloc,
mca_mpool_sm_free,
NULL,
NULL
};
/*
* base address of shared memory mapping
*/
void* mca_mpool_sm_base(void)
{
return (mca_mpool_sm_component.sm_mmap != NULL) ? mca_mpool_sm_component.sm_mmap->map_addr : NULL;
}
/**
* allocate function
*/
void* mca_mpool_sm_alloc(size_t size, size_t align)
{
return mca_mpool_sm_component.sm_allocator->alc_alloc(mca_mpool_sm_component.sm_allocator, size, align);
}
/**
* realloc function
*/
void* mca_mpool_sm_realloc(void* addr, size_t size)
{
return mca_mpool_sm_component.sm_allocator->alc_realloc(mca_mpool_sm_component.sm_allocator, addr, size);
}
/**
* free function
*/
void mca_mpool_sm_free(void * addr)
{
mca_mpool_sm_component.sm_allocator->alc_free(mca_mpool_sm_component.sm_allocator, addr);
}

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

@ -71,7 +71,7 @@ extern "C" {
*/
extern int mca_ns_base_output;
extern mca_ns_t ompi_name_server; /* holds selected module's function pointers */
extern mca_ns_base_module_t ompi_name_server; /* holds selected module's function pointers */
extern ompi_process_name_t mca_ns_my_replica;
extern bool mca_ns_base_selected;
extern ompi_list_t mca_ns_base_components_available;

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

@ -23,8 +23,8 @@ int mca_ns_base_close(void)
/* Close all remaining available components (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
mca_base_modules_close(mca_ns_base_output,
&mca_ns_base_components_available, NULL);
mca_base_components_close(mca_ns_base_output,
&mca_ns_base_components_available, NULL);
/* All done */

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

@ -13,10 +13,10 @@
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* component's public mca_base_module_t struct.
* component's public mca_base_component_t struct.
*/
#include "mca/ns/base/static-modules.h"
#include "mca/ns/base/static-components.h"
/*
* globals
@ -46,7 +46,7 @@ OBJ_CLASS_INSTANCE(
* Global variables
*/
int mca_ns_base_output = -1;
mca_ns_t ompi_name_server;
mca_ns_base_module_t ompi_name_server;
ompi_process_name_t mca_ns_my_replica;
bool mca_ns_base_selected = false;
ompi_list_t mca_ns_base_components_available;
@ -63,8 +63,8 @@ int mca_ns_base_open(void)
/* Open up all available components */
if (OMPI_SUCCESS !=
mca_base_modules_open("ns", 0, mca_ns_base_static_modules,
&mca_ns_base_components_available)) {
mca_base_components_open("ns", 0, mca_ns_base_static_components,
&mca_ns_base_components_available)) {
return OMPI_ERROR;
}

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

@ -27,9 +27,9 @@ int mca_ns_base_select(bool *allow_multi_user_threads,
bool *have_hidden_threads)
{
ompi_list_item_t *item;
mca_base_module_list_item_t *mli;
mca_base_component_list_item_t *cli;
mca_ns_base_component_t *component, *best_component = NULL;
mca_ns_t *module, *best_module = NULL;
mca_ns_base_module_t *module, *best_module = NULL;
bool multi, hidden;
int priority, best_priority = -1;
@ -38,8 +38,8 @@ int mca_ns_base_select(bool *allow_multi_user_threads,
for (item = ompi_list_get_first(&mca_ns_base_components_available);
item != ompi_list_get_end(&mca_ns_base_components_available);
item = ompi_list_get_next(item)) {
mli = (mca_base_module_list_item_t *) item;
component = (mca_ns_base_component_t *) mli->mli_module;
cli = (mca_base_component_list_item_t *) item;
component = (mca_ns_base_component_t *) cli->cli_component;
/* Call the component's init function and see if it wants to be
selected */

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

@ -1,430 +1,431 @@
/*
* $HEADER$
*/
/** @file:
*
* The Open MPI Name Server
*
* The Open MPI Name Server provides unique name ranges for processes
* within the universe. Each universe will have one name server
* running within the seed daemon. This is done to prevent the
* inadvertent duplication of names.
*/
#ifndef MCA_NS_H
#define MCA_NS_H
/*
* includes
*/
#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
#include "ompi_config.h"
#include "include/types.h"
#include "class/ompi_list.h"
#include "mca/mca.h"
/*
* useful defines for bit-masks
*/
#define OMPI_NS_CMP_CELLID 0x01
#define OMPI_NS_CMP_JOBID 0x02
#define OMPI_NS_CMP_VPID 0x04
#define OMPI_NS_CMP_ALL 0Xff
/*
* define maximum value for id's in any field
*/
#define OMPI_NAME_SERVICE_MAX UINT32_MAX
/*
* general typedefs & structures
/*
* $HEADER$
*/
/** @file:
*
* The Open MPI Name Server
*
* The Open MPI Name Server provides unique name ranges for processes
* within the universe. Each universe will have one name server
* running within the seed daemon. This is done to prevent the
* inadvertent duplication of names.
*/
#ifndef MCA_NS_H
#define MCA_NS_H
/*
* includes
*/
#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
#include "ompi_config.h"
#include "include/types.h"
#include "class/ompi_list.h"
#include "mca/mca.h"
/*
* useful defines for bit-masks
*/
#define OMPI_NS_CMP_CELLID 0x01
#define OMPI_NS_CMP_JOBID 0x02
#define OMPI_NS_CMP_VPID 0x04
#define OMPI_NS_CMP_ALL 0Xff
/*
* define maximum value for id's in any field
*/
#define OMPI_NAME_SERVICE_MAX UINT32_MAX
/*
* general typedefs & structures
*/
/**< Set the allowed range for ids in each space */
typedef uint32_t mca_ns_base_jobid_t;
typedef uint32_t mca_ns_base_cellid_t;
typedef uint32_t mca_ns_base_vpid_t;
typedef uint8_t ompi_ns_cmp_bitmask_t; /**< Bit mask for comparing process names */
struct ompi_process_name_t {
mca_ns_base_cellid_t cellid; /**< Cell number */
mca_ns_base_jobid_t jobid; /**< Job number */
mca_ns_base_vpid_t vpid; /**< Process number */
};
typedef struct ompi_process_name_t ompi_process_name_t;
/* declare the class */
OBJ_CLASS_DECLARATION(ompi_process_name_t);
/*
* define the command names/ids for use in OOB buffers.
* only needed for remotely executed commands.
*/
#define OMPI_NS_CREATE_CELLID 0x01
#define OMPI_NS_CREATE_JOBID 0x02
#define OMPI_NS_RESERVE_RANGE 0x04
#define OMPI_NS_FREE_NAME 0x08
typedef uint8_t ompi_ns_cmd_bitmask_t;
/*
* define the actual name server message buffer
*/
struct ompi_ns_msg_buffer_t {
ompi_ns_cmd_bitmask_t command;
int buflen;
uint8_t *buf;
};
typedef struct ompi_ns_msg_buffer_t ompi_ns_msg_buffer_t;
/*
* Component functions - all MUST be provided!
*/
/**
* Create a new cell id.
* The create_cellid() function allocates a new cell id for use by the caller.
* The function checks to find the next available cell id, reserves it, and returns that
* number. No memory for names is allocated by this process.
*
* @param None
* @retval cellid The ompi_process_id_t value of the allocated cell id. There currently
* is no error indication that a cell id could not be allocated - this represents a very unlikely
* event meaning that the system ran out of cell id's. This probably indicates
* an error in the calling program as the number of available cell id's is extremely large.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* new_cellid = ompi_name_server.create_cellid()
* @endcode
*/
typedef mca_ns_base_cellid_t (*mca_ns_create_cellid_fn_t)(void);
/**
* Create a new job id.
* The create_jobid() function allocates a new job id for use by the caller.
* The function checks to find the next available job id, reserves it, and returns that
* number. No memory for names is allocated by this process.
*
* The 0 job id is reserved for daemons within the system and will not be allocated.
* Developers should therefore assume that the daemon job id is automatically allocated
* and proceed to request names against it.
*
* @param None
* @retval jobid The ompi_process_id_t value of the allocated job id. There currently
* is no error indication that a job id could not be allocated - this represents a very unlikely
* event meaning that the system ran out of job id's. This probably indicates
* an error in the calling program as the number of available job id's is extremely large.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* new_jobid = ompi_name_server.create_jobid()
* @endcode
*/
typedef mca_ns_base_jobid_t (*mca_ns_create_jobid_fn_t)(void);
/**
* Obtain a single new process name.
* The create_process_name() function creates a single process name structure and fills the
* fields with the provided values.
*
* @param cell The cell for which the process name is intended. Usually, this is
* the id of the cell where the process is initially planning to be spawned.
* @param job The id of the job to which the process will belong. Process id's are
* tracked according to jobid, but not cellid. Thus, two processes
* can have the same process id if and only if they have different jobid's. However,
* two processes in the same jobid cannot have the same process id, regardless
* of whether or not they are in the same cell.
* @param vpid The virtual process id for the name. Note that no check is made for uniqueness -
* the caller is responsible for ensuring that the requested name is, in fact, unique
* by first requesting reservation of an appropriate range of virtual process id's.
*
* @retval *name Pointer to an ompi_process_name_t structure containing the name.
* @retval NULL Indicates an error, probably due to inability to allocate memory for
* the name structure.
*
* @code
* new_name = ompi_name_server.create_process_name(cell, job, vpid);
* @endcode
*/
typedef ompi_process_name_t* (*mca_ns_create_proc_name_fn_t)(mca_ns_base_cellid_t cell, mca_ns_base_jobid_t job, mca_ns_base_vpid_t vpid);
/**
* Reserve a range of process id's.
* The reserve_range() function reserves a range of vpid's for the given jobid.
* Note that the cellid does not factor into this request - jobid's span the entire universe,
* hence the cell where the process is currently executing is irrelevant to this request.
*
* @param jobid The id of the job for which the vpid's are to be reserved.
* @param range The number of vpid's to be reserved. The function will find the
* next available process id and assign range-number of sequential id's to the caller.
* These id's will be reserved - i.e., they cannot be assigned to any subsequent caller.
*
* @retval startid The starting value of the reserved range of vpid's. At this time,
* no means for returning an error condition is available. This will be rectified in the
* near future.
*
* @code
* starting_procid = ompi_name_server.reserve_range(jobid, range)
* @endcode
*/
typedef mca_ns_base_vpid_t (*mca_ns_reserve_range_fn_t)(mca_ns_base_jobid_t job, mca_ns_base_vpid_t range);
/**
* Free (release) a process name.
* The free_name() function releases the process name from the "used" list
* maintained within the name server for the jobid contained in the specified
* name. The memory for the name is also released at that time.
*
* Name values are currently \em not re-used. Hence, free-ing a name
* does not provide any noticeable benefit other than releasing the memory. In
* the future, names may be re-used if this becomes desirable.
*
* @param *name A pointer to the name structure containing the name being released.
*
* @retval OMPI_SUCCESS Indicates the release was succesfully accomplished.
* @retval OMPI_ERROR Indicates the release failed - most likely due to an
* error when free-ing the memory allocation.
*
* @code
* if (OMPI_ERROR == ompi_name_server.free_name(&name) {
* report error
* }
* @endcode
*/
typedef int (*mca_ns_free_name_fn_t)(ompi_process_name_t *name);
/**
* Get the process name as a character string.
* The get_proc_name_string() function returns the entire process name in a
* character string representation. The string is created by expressing each
* field in hexadecimal separated by periods, as follows:
*
* sprintf(string_name, "%x.%x.%x", cellid, jobid, vpid)
*
* The memory required for the string is allocated by the function - releasing
* that allocation is the responsibility of the calling program.
*
* @param *name A pointer to the name structure containing the name to be
* "translated" to a string.
*
* @retval *name_string A pointer to the character string representation of the
* full name.
* @retval NULL Indicates an error occurred - either no memory could be allocated
* or the caller provided an incorrect name pointer (e.g., NULL).
*
* @code
* name-string = ompi_name_server.get_proc_name_string(&name)
* @endcode
*/
typedef char* (*mca_ns_get_proc_name_string_fn_t)(const ompi_process_name_t *name);
/**
* Get the virtual process id as a character string.
* The get_vpid_string() function returns the vpid in a character string
* representation. The string is created by expressing the field in hexadecimal. Memory
* for the string is allocated by the function - releasing that allocation is the
* responsibility of the calling program.
*
* @param *name A pointer to the name structure containing the name to be
* "translated" to a string.
*
* @retval *name_string A pointer to the character string representation of the
* vpid.
* @retval NULL Indicates an error occurred - either no memory could be allocated
* or the caller provided an incorrect name pointer (e.g., NULL).
*
* @code
* vpid-string = ompi_name_server.get_vpid_string(&name)
* @endcode
*/
typedef char* (*mca_ns_get_vpid_string_fn_t)(const ompi_process_name_t *name);
/**
* Get the job id as a character string.
* The get_jobid_string() function returns the job id in a character string
* representation. The string is created by expressing the field in hexadecimal. Memory
* for the string is allocated by the function - releasing that allocation is the
* responsibility of the calling program.
*
* @param *name A pointer to the name structure containing the name to be
* "translated" to a string.
*
* @retval *name_string A pointer to the character string representation of the
* job id.
* @retval NULL Indicates an error occurred - either no memory could be allocated
* or the caller provided an incorrect name pointer (e.g., NULL).
*
* @code
* jobid-string = ompi_name_server.get_jobid_string(&name)
* @endcode
*/
typedef char* (*mca_ns_get_jobid_string_fn_t)(const ompi_process_name_t *name);
/**
* Get the cell id as a character string.
* The get_cellid_string() function returns the cell id in a character string
* representation. The string is created by expressing the field in hexadecimal. Memory
* for the string is allocated by the function - releasing that allocation is the
* responsibility of the calling program.
*
* @param *name A pointer to the name structure containing the name to be
* "translated" to a string.
*
* @retval *name_string A pointer to the character string representation of the
* cell id.
* @retval NULL Indicates an error occurred - either no memory could be allocated
* or the caller provided an incorrect name pointer (e.g., NULL).
*
* @code
* cellid-string = ompi_name_server.get_cellid_string(&name)
* @endcode
*/
typedef char* (*mca_ns_get_cellid_string_fn_t)(const ompi_process_name_t *name);
/**
* Get the virtual process id as an ompi_process_id_t value.
* The get_vpid() function returns the vpid in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval vpid The vpid field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* vpid = ompi_name_server.get_vpid(&name)
* @endcode
*/
typedef mca_ns_base_vpid_t (*mca_ns_get_vpid_fn_t)(const ompi_process_name_t *name);
/**
* Get the job id as an ompi_process_id_t value.
* The get_jobid() function returns the job id in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval jobid The job id field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* jobid = ompi_name_server.get_jobid(&name)
* @endcode
*/
typedef mca_ns_base_jobid_t (*mca_ns_get_jobid_fn_t)(const ompi_process_name_t *name);
/**
* Get the cell id as an ompi_process_id_t value.
* The get_cellid() function returns the cell id in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval cellid The cell id field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* cellid = ompi_name_server.get_cellid(&name)
* @endcode
*/
typedef mca_ns_base_cellid_t (*mca_ns_get_cellid_fn_t)(const ompi_process_name_t *name);
/**
* Compare two name values.
* The compare() function checks the value of the fields in the two
* provided names, and returns a value indicating if the first one is less than, greater
* than, or equal to the second. The value of each field is compared in a hierarchical
* fashion, with cellid first, followed by jobid and vpid in sequence. The bit-mask
* indicates which fields are to be included in the comparison. Fields not included via the
* bit-mask are ignored. Thus, the caller may request that any combination of the three fields
* be included in the comparison.
*
* @param fields A bit-mask indicating which fields are to be included in the comparison. The
* comparison is performed on a hierarchical basis, with cellid being first, followed by
* jobid and then vpid. Each field can be included separately, thus allowing the caller
* to configure the comparison to meet their needs.
* @param *name1 A pointer to the first name structure.
* @param *name2 A pointer to the second name structure.
*
* @retval -1 The indicated fields of the first provided name are less than the same
* fields of the second provided name.
* @retval 0 The indicated fields of the two provided names are equal.
* @retval +1 The indicated fields of the first provided name is greater than the same
* fields of the second provided name.
*
* The function returns a large negative value if there is an error.
*
* @code
* result = ompi_name_server.compare(bit_mask, &name1, &name2)
* @endcode
*/
typedef int (*mca_ns_compare_fn_t)(ompi_ns_cmp_bitmask_t fields, const ompi_process_name_t *name1, const ompi_process_name_t *name2);
/*
* Ver 1.0.0
*/
struct mca_ns_1_0_0_t {
mca_ns_create_cellid_fn_t create_cellid;
mca_ns_create_jobid_fn_t create_jobid;
mca_ns_create_proc_name_fn_t create_process_name;
mca_ns_reserve_range_fn_t reserve_range;
mca_ns_free_name_fn_t free_name;
mca_ns_get_proc_name_string_fn_t get_proc_name_string;
mca_ns_get_vpid_string_fn_t get_vpid_string;
mca_ns_get_jobid_string_fn_t get_jobid_string;
mca_ns_get_cellid_string_fn_t get_cellid_string;
mca_ns_get_vpid_fn_t get_vpid;
mca_ns_get_jobid_fn_t get_jobid;
mca_ns_get_cellid_fn_t get_cellid;
mca_ns_compare_fn_t compare;
};
typedef struct mca_ns_1_0_0_t mca_ns_1_0_0_t;
typedef mca_ns_1_0_0_t mca_ns_t;
/*
* NS Component
*/
typedef mca_ns_t* (*mca_ns_base_init_fn_t)(
bool *allow_multi_user_threads,
bool *have_hidden_threads,
int *priority);
typedef int (*mca_ns_base_finalize_fn_t)(void);
/*
* the standard component data structure
*/
struct mca_ns_base_component_1_0_0_t {
mca_base_module_t ns_version;
mca_base_module_data_1_0_0_t ns_data;
mca_ns_base_init_fn_t ns_init;
mca_ns_base_finalize_fn_t ns_finalize;
};
typedef struct mca_ns_base_component_1_0_0_t mca_ns_base_component_1_0_0_t;
typedef mca_ns_base_component_1_0_0_t mca_ns_base_component_t;
/*
* Macro for use in components that are of type ns v1.0.0
*/
#define MCA_NS_BASE_VERSION_1_0_0 \
/* ns v1.0 is chained to MCA v1.0 */ \
MCA_BASE_VERSION_1_0_0, \
/* ns v1.0 */ \
"ns", 1, 0, 0
#endif
typedef uint32_t mca_ns_base_vpid_t;
typedef uint8_t ompi_ns_cmp_bitmask_t; /**< Bit mask for comparing process names */
struct ompi_process_name_t {
mca_ns_base_cellid_t cellid; /**< Cell number */
mca_ns_base_jobid_t jobid; /**< Job number */
mca_ns_base_vpid_t vpid; /**< Process number */
};
typedef struct ompi_process_name_t ompi_process_name_t;
/* declare the class */
OBJ_CLASS_DECLARATION(ompi_process_name_t);
/*
* define the command names/ids for use in OOB buffers.
* only needed for remotely executed commands.
*/
#define OMPI_NS_CREATE_CELLID 0x01
#define OMPI_NS_CREATE_JOBID 0x02
#define OMPI_NS_RESERVE_RANGE 0x04
#define OMPI_NS_FREE_NAME 0x08
typedef uint8_t ompi_ns_cmd_bitmask_t;
/*
* define the actual name server message buffer
*/
struct ompi_ns_msg_buffer_t {
ompi_ns_cmd_bitmask_t command;
int buflen;
uint8_t *buf;
};
typedef struct ompi_ns_msg_buffer_t ompi_ns_msg_buffer_t;
/*
* Component functions - all MUST be provided!
*/
/**
* Create a new cell id.
* The create_cellid() function allocates a new cell id for use by the caller.
* The function checks to find the next available cell id, reserves it, and returns that
* number. No memory for names is allocated by this process.
*
* @param None
* @retval cellid The ompi_process_id_t value of the allocated cell id. There currently
* is no error indication that a cell id could not be allocated - this represents a very unlikely
* event meaning that the system ran out of cell id's. This probably indicates
* an error in the calling program as the number of available cell id's is extremely large.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* new_cellid = ompi_name_server.create_cellid()
* @endcode
*/
typedef mca_ns_base_cellid_t (*mca_ns_base_module_create_cellid_fn_t)(void);
/**
* Create a new job id.
* The create_jobid() function allocates a new job id for use by the caller.
* The function checks to find the next available job id, reserves it, and returns that
* number. No memory for names is allocated by this process.
*
* The 0 job id is reserved for daemons within the system and will not be allocated.
* Developers should therefore assume that the daemon job id is automatically allocated
* and proceed to request names against it.
*
* @param None
* @retval jobid The ompi_process_id_t value of the allocated job id. There currently
* is no error indication that a job id could not be allocated - this represents a very unlikely
* event meaning that the system ran out of job id's. This probably indicates
* an error in the calling program as the number of available job id's is extremely large.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* new_jobid = ompi_name_server.create_jobid()
* @endcode
*/
typedef mca_ns_base_jobid_t (*mca_ns_base_module_create_jobid_fn_t)(void);
/**
* Obtain a single new process name.
* The create_process_name() function creates a single process name structure and fills the
* fields with the provided values.
*
* @param cell The cell for which the process name is intended. Usually, this is
* the id of the cell where the process is initially planning to be spawned.
* @param job The id of the job to which the process will belong. Process id's are
* tracked according to jobid, but not cellid. Thus, two processes
* can have the same process id if and only if they have different jobid's. However,
* two processes in the same jobid cannot have the same process id, regardless
* of whether or not they are in the same cell.
* @param vpid The virtual process id for the name. Note that no check is made for uniqueness -
* the caller is responsible for ensuring that the requested name is, in fact, unique
* by first requesting reservation of an appropriate range of virtual process id's.
*
* @retval *name Pointer to an ompi_process_name_t structure containing the name.
* @retval NULL Indicates an error, probably due to inability to allocate memory for
* the name structure.
*
* @code
* new_name = ompi_name_server.create_process_name(cell, job, vpid);
* @endcode
*/
typedef ompi_process_name_t* (*mca_ns_base_module_create_proc_name_fn_t)(mca_ns_base_cellid_t cell, mca_ns_base_jobid_t job, mca_ns_base_vpid_t vpid);
/**
* Reserve a range of process id's.
* The reserve_range() function reserves a range of vpid's for the given jobid.
* Note that the cellid does not factor into this request - jobid's span the entire universe,
* hence the cell where the process is currently executing is irrelevant to this request.
*
* @param jobid The id of the job for which the vpid's are to be reserved.
* @param range The number of vpid's to be reserved. The function will find the
* next available process id and assign range-number of sequential id's to the caller.
* These id's will be reserved - i.e., they cannot be assigned to any subsequent caller.
*
* @retval startid The starting value of the reserved range of vpid's. At this time,
* no means for returning an error condition is available. This will be rectified in the
* near future.
*
* @code
* starting_procid = ompi_name_server.reserve_range(jobid, range)
* @endcode
*/
typedef mca_ns_base_vpid_t (*mca_ns_base_module_reserve_range_fn_t)(mca_ns_base_jobid_t job, mca_ns_base_vpid_t range);
/**
* Free (release) a process name.
* The free_name() function releases the process name from the "used" list
* maintained within the name server for the jobid contained in the specified
* name. The memory for the name is also released at that time.
*
* Name values are currently \em not re-used. Hence, free-ing a name
* does not provide any noticeable benefit other than releasing the memory. In
* the future, names may be re-used if this becomes desirable.
*
* @param *name A pointer to the name structure containing the name being released.
*
* @retval OMPI_SUCCESS Indicates the release was succesfully accomplished.
* @retval OMPI_ERROR Indicates the release failed - most likely due to an
* error when free-ing the memory allocation.
*
* @code
* if (OMPI_ERROR == ompi_name_server.free_name(&name) {
* report error
* }
* @endcode
*/
typedef int (*mca_ns_base_module_free_name_fn_t)(ompi_process_name_t *name);
/**
* Get the process name as a character string.
* The get_proc_name_string() function returns the entire process name in a
* character string representation. The string is created by expressing each
* field in hexadecimal separated by periods, as follows:
*
* sprintf(string_name, "%x.%x.%x", cellid, jobid, vpid)
*
* The memory required for the string is allocated by the function - releasing
* that allocation is the responsibility of the calling program.
*
* @param *name A pointer to the name structure containing the name to be
* "translated" to a string.
*
* @retval *name_string A pointer to the character string representation of the
* full name.
* @retval NULL Indicates an error occurred - either no memory could be allocated
* or the caller provided an incorrect name pointer (e.g., NULL).
*
* @code
* name-string = ompi_name_server.get_proc_name_string(&name)
* @endcode
*/
typedef char* (*mca_ns_base_module_get_proc_name_string_fn_t)(const ompi_process_name_t *name);
/**
* Get the virtual process id as a character string.
* The get_vpid_string() function returns the vpid in a character string
* representation. The string is created by expressing the field in hexadecimal. Memory
* for the string is allocated by the function - releasing that allocation is the
* responsibility of the calling program.
*
* @param *name A pointer to the name structure containing the name to be
* "translated" to a string.
*
* @retval *name_string A pointer to the character string representation of the
* vpid.
* @retval NULL Indicates an error occurred - either no memory could be allocated
* or the caller provided an incorrect name pointer (e.g., NULL).
*
* @code
* vpid-string = ompi_name_server.get_vpid_string(&name)
* @endcode
*/
typedef char* (*mca_ns_base_module_get_vpid_string_fn_t)(const ompi_process_name_t *name);
/**
* Get the job id as a character string.
* The get_jobid_string() function returns the job id in a character string
* representation. The string is created by expressing the field in hexadecimal. Memory
* for the string is allocated by the function - releasing that allocation is the
* responsibility of the calling program.
*
* @param *name A pointer to the name structure containing the name to be
* "translated" to a string.
*
* @retval *name_string A pointer to the character string representation of the
* job id.
* @retval NULL Indicates an error occurred - either no memory could be allocated
* or the caller provided an incorrect name pointer (e.g., NULL).
*
* @code
* jobid-string = ompi_name_server.get_jobid_string(&name)
* @endcode
*/
typedef char* (*mca_ns_base_module_get_jobid_string_fn_t)(const ompi_process_name_t *name);
/**
* Get the cell id as a character string.
* The get_cellid_string() function returns the cell id in a character string
* representation. The string is created by expressing the field in hexadecimal. Memory
* for the string is allocated by the function - releasing that allocation is the
* responsibility of the calling program.
*
* @param *name A pointer to the name structure containing the name to be
* "translated" to a string.
*
* @retval *name_string A pointer to the character string representation of the
* cell id.
* @retval NULL Indicates an error occurred - either no memory could be allocated
* or the caller provided an incorrect name pointer (e.g., NULL).
*
* @code
* cellid-string = ompi_name_server.get_cellid_string(&name)
* @endcode
*/
typedef char* (*mca_ns_base_module_get_cellid_string_fn_t)(const ompi_process_name_t *name);
/**
* Get the virtual process id as an ompi_process_id_t value.
* The get_vpid() function returns the vpid in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval vpid The vpid field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* vpid = ompi_name_server.get_vpid(&name)
* @endcode
*/
typedef mca_ns_base_vpid_t (*mca_ns_base_module_get_vpid_fn_t)(const ompi_process_name_t *name);
/**
* Get the job id as an ompi_process_id_t value.
* The get_jobid() function returns the job id in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval jobid The job id field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* jobid = ompi_name_server.get_jobid(&name)
* @endcode
*/
typedef mca_ns_base_jobid_t (*mca_ns_base_module_get_jobid_fn_t)(const ompi_process_name_t *name);
/**
* Get the cell id as an ompi_process_id_t value.
* The get_cellid() function returns the cell id in an ompi_process_id_t representation -
* i.e., in an integer form.
*
* @param *name A pointer to the name structure containing the name.
*
* @retval cellid The cell id field of the provided name. There currently
* is no error indication that this function failed.
* Some means of returning a value indicative of an error will be devised in the future.
*
* @code
* cellid = ompi_name_server.get_cellid(&name)
* @endcode
*/
typedef mca_ns_base_cellid_t (*mca_ns_base_module_get_cellid_fn_t)(const ompi_process_name_t *name);
/**
* Compare two name values.
* The compare() function checks the value of the fields in the two
* provided names, and returns a value indicating if the first one is less than, greater
* than, or equal to the second. The value of each field is compared in a hierarchical
* fashion, with cellid first, followed by jobid and vpid in sequence. The bit-mask
* indicates which fields are to be included in the comparison. Fields not included via the
* bit-mask are ignored. Thus, the caller may request that any combination of the three fields
* be included in the comparison.
*
* @param fields A bit-mask indicating which fields are to be included in the comparison. The
* comparison is performed on a hierarchical basis, with cellid being first, followed by
* jobid and then vpid. Each field can be included separately, thus allowing the caller
* to configure the comparison to meet their needs.
* @param *name1 A pointer to the first name structure.
* @param *name2 A pointer to the second name structure.
*
* @retval -1 The indicated fields of the first provided name are less than the same
* fields of the second provided name.
* @retval 0 The indicated fields of the two provided names are equal.
* @retval +1 The indicated fields of the first provided name is greater than the same
* fields of the second provided name.
*
* The function returns a large negative value if there is an error.
*
* @code
* result = ompi_name_server.compare(bit_mask, &name1, &name2)
* @endcode
*/
typedef int (*mca_ns_base_module_compare_fn_t)(ompi_ns_cmp_bitmask_t fields, const ompi_process_name_t *name1, const ompi_process_name_t *name2);
/*
* Ver 1.0.0
*/
struct mca_ns_base_module_1_0_0_t {
mca_ns_base_module_create_cellid_fn_t create_cellid;
mca_ns_base_module_create_jobid_fn_t create_jobid;
mca_ns_base_module_create_proc_name_fn_t create_process_name;
mca_ns_base_module_reserve_range_fn_t reserve_range;
mca_ns_base_module_free_name_fn_t free_name;
mca_ns_base_module_get_proc_name_string_fn_t get_proc_name_string;
mca_ns_base_module_get_vpid_string_fn_t get_vpid_string;
mca_ns_base_module_get_jobid_string_fn_t get_jobid_string;
mca_ns_base_module_get_cellid_string_fn_t get_cellid_string;
mca_ns_base_module_get_vpid_fn_t get_vpid;
mca_ns_base_module_get_jobid_fn_t get_jobid;
mca_ns_base_module_get_cellid_fn_t get_cellid;
mca_ns_base_module_compare_fn_t compare;
};
typedef struct mca_ns_base_module_1_0_0_t mca_ns_base_module_1_0_0_t;
typedef mca_ns_base_module_1_0_0_t mca_ns_base_module_t;
/*
* NS Component
*/
typedef mca_ns_base_module_t* (*mca_ns_base_component_init_fn_t)(
bool *allow_multi_user_threads,
bool *have_hidden_threads,
int *priority);
typedef int (*mca_ns_base_component_finalize_fn_t)(void);
/*
* the standard component data structure
*/
struct mca_ns_base_component_1_0_0_t {
mca_base_component_t ns_version;
mca_base_component_data_1_0_0_t ns_data;
mca_ns_base_component_init_fn_t ns_init;
mca_ns_base_component_finalize_fn_t ns_finalize;
};
typedef struct mca_ns_base_component_1_0_0_t mca_ns_base_component_1_0_0_t;
typedef mca_ns_base_component_1_0_0_t mca_ns_base_component_t;
/*
* Macro for use in components that are of type ns v1.0.0
*/
#define MCA_NS_BASE_VERSION_1_0_0 \
/* ns v1.0 is chained to MCA v1.0 */ \
MCA_BASE_VERSION_1_0_0, \
/* ns v1.0 */ \
"ns", 1, 0, 0
#endif

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

@ -7,5 +7,4 @@ include $(top_ompi_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_ns_proxy.la
libmca_ns_proxy_la_SOURCES = \
ns_proxy.h \
ns_proxy_module.c
ns_proxy_component.c

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

@ -23,7 +23,7 @@ int mca_ns_proxy_close(void);
/*
* Startup / Shutdown
*/
mca_ns_t* mca_ns_proxy_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority);
mca_ns_base_module_t* mca_ns_proxy_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority);
int mca_ns_proxy_finalize(void);
/*

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

@ -28,7 +28,7 @@
/*
* Struct of function pointers that need to be initialized
*/
mca_ns_base_component_t mca_ns_proxy_module = {
mca_ns_base_component_t mca_ns_proxy_component = {
{
MCA_NS_BASE_VERSION_1_0_0,
@ -49,7 +49,7 @@ mca_ns_base_component_t mca_ns_proxy_module = {
/*
* setup the function pointers for the module
*/
static mca_ns_t mca_ns_proxy = {
static mca_ns_base_module_t mca_ns_proxy = {
ns_base_create_cellid,
ns_base_create_jobid,
ns_base_create_process_name,
@ -92,7 +92,7 @@ int mca_ns_proxy_close(void)
return OMPI_SUCCESS;
}
mca_ns_t* mca_ns_proxy_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority)
mca_ns_base_module_t* mca_ns_proxy_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority)
{
/* If we're NOT the seed, then we want to be selected, so do all
the setup and return the module */

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

@ -8,5 +8,5 @@ noinst_LTLIBRARIES = libmca_ns_replica.la
libmca_ns_replica_la_SOURCES = \
ns_replica.h \
ns_replica.c \
ns_replica_module.c
ns_replica_component.c

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

@ -45,7 +45,7 @@ int mca_ns_replica_close(void);
/*
* Startup / Shutdown
*/
mca_ns_t* mca_ns_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority);
mca_ns_base_module_t* mca_ns_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority);
int mca_ns_replica_finalize(void);
/*

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

@ -29,7 +29,7 @@
/*
* Struct of function pointers that need to be initialized
*/
mca_ns_base_component_t mca_ns_replica_module = {
mca_ns_base_component_t mca_ns_replica_component = {
{
MCA_NS_BASE_VERSION_1_0_0,
@ -50,7 +50,7 @@ mca_ns_base_component_t mca_ns_replica_module = {
/*
* setup the function pointers for the module
*/
static mca_ns_t mca_ns_replica = {
static mca_ns_base_module_t mca_ns_replica = {
ns_replica_create_cellid,
ns_replica_create_jobid,
ns_base_create_process_name,
@ -115,7 +115,7 @@ int mca_ns_replica_close(void)
return OMPI_SUCCESS;
}
mca_ns_t* mca_ns_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority)
mca_ns_base_module_t* mca_ns_replica_init(bool *allow_multi_user_threads, bool *have_hidden_threads, int *priority)
{
/* If we're the seed, then we want to be selected, so do all the
setup and return the module */

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

@ -4,7 +4,3 @@
include $(top_srcdir)/config/Makefile.options
# For VPATH builds, have to specify where static-modules.h will be found
AM_CPPFLAGS = -I$(top_builddir)/src

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

@ -19,22 +19,22 @@
* This is the first module on the list. This is here temporarily
* to make things work
*/
extern mca_oob_t mca_oob;
extern mca_oob_base_module_t mca_oob;
/**
* the module data structure
* associate a component and a module that belongs to it
*/
struct mca_oob_base_module_t {
struct mca_oob_base_info_t {
ompi_list_item_t super;
mca_oob_base_component_t *oob_component;
mca_oob_t *oob_module;
mca_oob_base_module_t *oob_module;
};
typedef struct mca_oob_base_module_t mca_oob_base_module_t;
typedef struct mca_oob_base_info_t mca_oob_base_info_t;
/**
* declare the module structure as a class
* declare the association structure as a class
*/
OBJ_CLASS_DECLARATION(mca_oob_base_module_t);
OBJ_CLASS_DECLARATION(mca_oob_base_info_t);
/*

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

@ -17,8 +17,11 @@ int mca_oob_base_close(void)
/* Close all remaining available modules (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
mca_base_components_close(mca_oob_base_output, &mca_oob_base_components,
NULL);
OBJ_DESTRUCT(&mca_oob_base_modules);
mca_base_modules_close(mca_oob_base_output, &mca_oob_base_components, NULL);
OBJ_DESTRUCT(&mca_oob_base_components);
/* All done */
return OMPI_SUCCESS;

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

@ -21,9 +21,15 @@ OBJ_CLASS_INSTANCE(
NULL,
NULL
);
OBJ_CLASS_INSTANCE(
mca_oob_base_info_t,
ompi_list_item_t,
NULL,
NULL
);
ompi_process_name_t mca_oob_base_self;
ompi_process_name_t mca_oob_base_any;
ompi_process_name_t mca_oob_base_any;
/**
* Function for selecting one module from all those that are
@ -34,11 +40,11 @@ ompi_process_name_t mca_oob_base_any;
int mca_oob_base_init(bool *user_threads, bool *hidden_threads)
{
ompi_list_item_t *item;
mca_base_module_list_item_t *mli;
mca_oob_base_module_t * first;
mca_base_component_list_item_t *cli;
mca_oob_base_info_t * first;
mca_oob_base_component_t *component;
mca_oob_t *module;
extern ompi_list_t mca_oob_base_modules;
mca_oob_base_module_t *module;
extern ompi_list_t mca_oob_base_components;
ompi_process_name_t *self;
/* setup local name */
@ -57,10 +63,10 @@ int mca_oob_base_init(bool *user_threads, bool *hidden_threads)
for (item = ompi_list_get_first(&mca_oob_base_components);
item != ompi_list_get_end(&mca_oob_base_components);
item = ompi_list_get_next(item)) {
mca_oob_base_module_t *inited;
mca_oob_base_info_t *inited;
mli = (mca_base_module_list_item_t *) item;
component = (mca_oob_base_component_t *) mli->mli_module;
cli = (mca_base_component_list_item_t *) item;
component = (mca_oob_base_component_t *) cli->cli_component;
if (NULL == component->oob_init) {
ompi_output_verbose(10, mca_oob_base_output, "mca_oob_base_init: no init function; ignoring component");
@ -69,7 +75,7 @@ int mca_oob_base_init(bool *user_threads, bool *hidden_threads)
if (NULL == module) {
ompi_output_verbose(10, mca_oob_base_output, "mca_oob_base_init: oob_init returned failure");
} else {
inited = OBJ_NEW(mca_oob_base_module_t);
inited = OBJ_NEW(mca_oob_base_info_t);
inited->oob_component = component;
inited->oob_module = module;
ompi_list_append(&mca_oob_base_modules, &inited->super);
@ -78,7 +84,7 @@ int mca_oob_base_init(bool *user_threads, bool *hidden_threads)
}
/* set the global variable to point to the first initialize module */
if (0 < ompi_list_get_size(&mca_oob_base_modules)) {
first = (mca_oob_base_module_t *) ompi_list_get_first(&mca_oob_base_modules);
first = (mca_oob_base_info_t *) ompi_list_get_first(&mca_oob_base_modules);
mca_oob = *first->oob_module;
return OMPI_SUCCESS;
} else {

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

@ -12,37 +12,39 @@
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* module's public mca_base_module_t struct.
* component's public mca_base_component_t struct.
*/
#include "mca/oob/base/static-modules.h"
#include "mca/oob/base/static-components.h"
/*
* Global variables
*/
mca_oob_t mca_oob;
mca_oob_base_module_t mca_oob;
int mca_oob_base_output = -1;
ompi_list_t mca_oob_base_components;
ompi_list_t mca_oob_base_modules;
/**
* Function for finding and opening either all MCA modules, or the one
* Function for finding and opening either all MCA components, or the one
* that was specifically requested via a MCA parameter.
*/
int mca_oob_base_open(void)
{
/* Open up all available modules */
/* Open up all available components */
if (OMPI_SUCCESS !=
mca_base_modules_open("oob", 0, mca_oob_base_static_modules,
&mca_oob_base_components)) {
mca_base_components_open("oob", 0, mca_oob_base_static_components,
&mca_oob_base_components)) {
return OMPI_ERROR;
}
OBJ_CONSTRUCT(&mca_oob_base_components, ompi_list_t);
OBJ_CONSTRUCT(&mca_oob_base_modules, ompi_list_t);
/* All done */
OBJ_CONSTRUCT(&mca_oob_base_modules, ompi_list_t);
return OMPI_SUCCESS;
}

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

@ -7,6 +7,6 @@ include $(top_ompi_srcdir)/config/Makefile.options
noinst_LTLIBRARIES = libmca_oob_cofs.la
libmca_oob_cofs_la_SOURCES = \
oob_cofs.h \
oob_cofs_module.c \
oob_cofs.c
oob_cofs.c \
oob_cofs_component.c

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

@ -20,7 +20,7 @@ int mca_oob_cofs_close(void);
/*
* Startup / Shutdown
*/
mca_oob_t* mca_oob_cofs_init(bool *allow_multi_user_threads, bool *have_hidden_threads);
mca_oob_base_module_t* mca_oob_cofs_init(bool *allow_multi_user_threads, bool *have_hidden_threads);
int mca_oob_cofs_finalize(void);

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

@ -20,12 +20,10 @@
#include <unistd.h>
/*
* Struct of function pointers and all that to let us be initialized
*/
mca_oob_base_component_1_0_0_t mca_oob_cofs_module = {
mca_oob_base_component_1_0_0_t mca_oob_cofs_component = {
{
MCA_OOB_BASE_VERSION_1_0_0,
@ -33,8 +31,8 @@ mca_oob_base_component_1_0_0_t mca_oob_cofs_module = {
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
mca_oob_cofs_open, /* module open */
mca_oob_cofs_close /* module close */
NULL,
NULL,
},
{
false /* checkpoint / restart */
@ -43,7 +41,7 @@ mca_oob_base_component_1_0_0_t mca_oob_cofs_module = {
mca_oob_cofs_finalize
};
mca_oob_t mca_oob_cofs = {
mca_oob_base_module_t mca_oob_cofs = {
mca_oob_cofs_send,
mca_oob_cofs_recv,
mca_oob_cofs_send_nb,
@ -55,21 +53,8 @@ int mca_oob_cofs_my_jobid;
int mca_oob_cofs_my_procid;
uint64_t mca_oob_cofs_serial;
int
mca_oob_cofs_open(void)
{
return OMPI_SUCCESS;
}
int
mca_oob_cofs_close(void)
{
return OMPI_SUCCESS;
}
struct mca_oob_1_0_0_t*
struct mca_oob_base_module_1_0_0_t*
mca_oob_cofs_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
{
int len;
@ -106,8 +91,7 @@ mca_oob_cofs_init(bool *allow_multi_user_threads, bool *have_hidden_threads)
}
int
mca_oob_cofs_finalize(void)
int mca_oob_cofs_finalize(void)
{
return OMPI_SUCCESS;
}

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

@ -247,7 +247,7 @@ int mca_oob_recv_ntoh_nb(
* @return OMPI error code (<0) on error number of bytes actually sent.
*/
typedef int (*mca_oob_base_send_fn_t)(
typedef int (*mca_oob_base_module_send_fn_t)(
const ompi_process_name_t* peer,
const struct iovec *msg,
int count,
@ -266,7 +266,7 @@ typedef int (*mca_oob_base_send_fn_t)(
* @return OMPI error code (<0) on error or number of bytes actually received.
*/
typedef int (*mca_oob_base_recv_fn_t)(
typedef int (*mca_oob_base_module_recv_fn_t)(
ompi_process_name_t* peer,
const struct iovec *msg,
int count,
@ -285,7 +285,7 @@ typedef int (*mca_oob_base_recv_fn_t)(
*
*/
typedef int (*mca_oob_base_send_nb_fn_t)(
typedef int (*mca_oob_base_module_send_nb_fn_t)(
const ompi_process_name_t* peer,
const struct iovec* msg,
int count,
@ -305,7 +305,7 @@ typedef int (*mca_oob_base_send_nb_fn_t)(
* @return OMPI error code (<0) on error or number of bytes actually received.
*/
typedef int (*mca_oob_base_recv_nb_fn_t)(
typedef int (*mca_oob_base_module_recv_nb_fn_t)(
ompi_process_name_t* peer,
const struct iovec* msg,
int count,
@ -316,34 +316,35 @@ typedef int (*mca_oob_base_recv_nb_fn_t)(
/*
* OOB Module
*/
struct mca_oob_1_0_0_t {
mca_oob_base_send_fn_t oob_send;
mca_oob_base_recv_fn_t oob_recv;
mca_oob_base_send_nb_fn_t oob_send_nb;
mca_oob_base_recv_nb_fn_t oob_recv_nb;
struct mca_oob_base_module_1_0_0_t {
mca_oob_base_module_send_fn_t oob_send;
mca_oob_base_module_recv_fn_t oob_recv;
mca_oob_base_module_send_nb_fn_t oob_send_nb;
mca_oob_base_module_recv_nb_fn_t oob_recv_nb;
};
typedef struct mca_oob_1_0_0_t mca_oob_1_0_0_t;
typedef struct mca_oob_1_0_0_t mca_oob_t;
typedef struct mca_oob_base_module_1_0_0_t mca_oob_base_module_1_0_0_t;
typedef struct mca_oob_base_module_1_0_0_t mca_oob_base_module_t;
/**
* OOB Component
*/
typedef mca_oob_t* (*mca_oob_base_init_fn_t)(
typedef mca_oob_base_module_t* (*mca_oob_base_component_init_fn_t)(
bool *allow_multi_user_threads,
bool *have_hidden_threads);
typedef int (*mca_oob_base_finalize_fn_t)(void);
typedef int (*mca_oob_base_component_finalize_fn_t)(void);
/**
* the standard component data structure
*/
struct mca_oob_base_component_1_0_0_t {
mca_base_module_t oob_version;
mca_base_module_data_1_0_0_t oob_data;
mca_oob_base_init_fn_t oob_init;
mca_oob_base_finalize_fn_t oob_finalize;
mca_base_component_t oob_version;
mca_base_component_data_1_0_0_t oob_data;
mca_oob_base_component_init_fn_t oob_init;
mca_oob_base_component_finalize_fn_t oob_finalize;
};
typedef struct mca_oob_base_component_1_0_0_t mca_oob_base_component_1_0_0_t;
typedef mca_oob_base_component_1_0_0_t mca_oob_base_component_t;

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

@ -9,8 +9,8 @@
/*
* Struct of function pointers and all that to let us be initialized
*/
mca_oob_tcp_component_t mca_oob_tcp_module = {
{
mca_oob_tcp_component_t mca_oob_tcp_component = {
{
{
MCA_OOB_BASE_VERSION_1_0_0,
"tcp", /* MCA module name */
@ -25,10 +25,10 @@ mca_oob_tcp_component_t mca_oob_tcp_module = {
},
mca_oob_tcp_init, /* module init */
mca_oob_tcp_finalize
}
}
};
static struct mca_oob_1_0_0_t mca_oob_tcp = {
static struct mca_oob_base_module_1_0_0_t mca_oob_tcp = {
mca_oob_tcp_send,
mca_oob_tcp_recv,
mca_oob_tcp_send_nb,
@ -85,7 +85,8 @@ int mca_oob_tcp_close(void)
* when process names are used as indices.
*/
static int ompi_process_name_compare(ompi_process_name_t* n1, ompi_process_name_t* n2)
static int ompi_process_name_compare(ompi_process_name_t* n1,
ompi_process_name_t* n2)
{
if(n1->cellid < n2->cellid)
return -1;
@ -106,8 +107,8 @@ static int ompi_process_name_compare(ompi_process_name_t* n1, ompi_process_name_
/*
* this function will temporarily return NULL so we don't use it
*/
struct mca_oob_1_0_0_t* mca_oob_tcp_init(bool *allow_multi_user_threads,
bool *have_hidden_threads)
struct mca_oob_base_module_1_0_0_t* mca_oob_tcp_init(bool *allow_multi_user_threads,
bool *have_hidden_threads)
{
#if 0
/* initialize data structures */

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

@ -29,8 +29,8 @@ extern "C" {
*/
int mca_oob_tcp_open(void);
int mca_oob_tcp_close(void);
struct mca_oob_1_0_0_t* mca_oob_tcp_init(bool *allow_multi_user_threads,
bool *have_hidden_threads);
struct mca_oob_base_module_1_0_0_t* mca_oob_tcp_init(bool *allow_multi_user_threads,
bool *have_hidden_threads);
int mca_oob_tcp_finalize(void);
@ -117,7 +117,7 @@ struct mca_oob_tcp_component_t {
};
typedef struct mca_oob_tcp_component_t mca_oob_tcp_component_t;
extern mca_oob_tcp_component_t mca_oob_tcp_module;
extern mca_oob_tcp_component_t mca_oob_tcp_component;
#if defined(c_plusplus) || defined(__cplusplus)

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

@ -46,7 +46,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_msg_t);
#define MCA_OOB_TCP_MSG_ALLOC(msg, rc) \
{ \
ompi_list_item_t* item; \
OMPI_FREE_LIST_GET(&mca_oob_tcp_module.tcp_msgs, item, rc); \
OMPI_FREE_LIST_GET(&mca_oob_tcp_component.tcp_msgs, item, rc); \
msg = (mca_oob_tcp_msg_t*)item; \
}
@ -57,7 +57,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_msg_t);
{ \
/* frees the iovec allocated during the send/recieve */ \
if(NULL != msg->msg_iov) free(msg->msg_iov); \
OMPI_FREE_LIST_RETURN(&mca_oob_tcp_module.tcp_msgs, (ompi_list_item_t*)msg); \
OMPI_FREE_LIST_RETURN(&mca_oob_tcp_component.tcp_msgs, (ompi_list_item_t*)msg); \
}
/**

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

@ -135,13 +135,13 @@ mca_oob_tcp_peer_t * mca_oob_tcp_peer_lookup(const ompi_process_name_t* name, bo
mca_oob_tcp_peer_t * peer, * old;
if(get_lock) {
OMPI_THREAD_LOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
}
peer = (mca_oob_tcp_peer_t*)ompi_rb_tree_find(&mca_oob_tcp_module.tcp_peer_tree,
peer = (mca_oob_tcp_peer_t*)ompi_rb_tree_find(&mca_oob_tcp_component.tcp_peer_tree,
(ompi_process_name_t *) name);
if(NULL != peer) {
if(get_lock) {
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
}
return peer;
}
@ -149,7 +149,7 @@ mca_oob_tcp_peer_t * mca_oob_tcp_peer_lookup(const ompi_process_name_t* name, bo
MCA_OOB_TCP_PEER_ALLOC(peer, rc);
if(NULL == peer) {
if(get_lock) {
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
}
return NULL;
}
@ -160,24 +160,24 @@ mca_oob_tcp_peer_t * mca_oob_tcp_peer_lookup(const ompi_process_name_t* name, bo
******/
if(OMPI_SUCCESS != ompi_rb_tree_insert(&mca_oob_tcp_module.tcp_peer_tree,
if(OMPI_SUCCESS != ompi_rb_tree_insert(&mca_oob_tcp_component.tcp_peer_tree,
(ompi_process_name_t *) name, peer)) {
MCA_OOB_TCP_PEER_RETURN(peer);
if(get_lock) {
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
}
return NULL;
}
ompi_list_prepend(&mca_oob_tcp_module.tcp_peer_list, (ompi_list_item_t *) peer);
ompi_list_prepend(&mca_oob_tcp_component.tcp_peer_list, (ompi_list_item_t *) peer);
/* if the peer list is over the maximum size, remove one unsed peer */
if(ompi_list_get_size(&mca_oob_tcp_module.tcp_peer_list) >
mca_oob_tcp_module.tcp_cache_size) {
if(ompi_list_get_size(&mca_oob_tcp_component.tcp_peer_list) >
mca_oob_tcp_component.tcp_cache_size) {
old = (mca_oob_tcp_peer_t *)
ompi_list_get_last(&mca_oob_tcp_module.tcp_peer_list);
ompi_list_get_last(&mca_oob_tcp_component.tcp_peer_list);
while(1) {
if(0 == ompi_list_get_size(&(old->peer_send_queue)) &&
NULL == peer->peer_recv_msg) {
ompi_list_remove_item(&mca_oob_tcp_module.tcp_peer_list,
ompi_list_remove_item(&mca_oob_tcp_component.tcp_peer_list,
(ompi_list_item_t *) old);
MCA_OOB_TCP_PEER_RETURN(old);
break;
@ -192,7 +192,7 @@ mca_oob_tcp_peer_t * mca_oob_tcp_peer_lookup(const ompi_process_name_t* name, bo
}
}
if(get_lock) {
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
}
return peer;
}

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

@ -54,7 +54,7 @@ typedef struct mca_oob_tcp_peer_t mca_oob_tcp_peer_t;
#define MCA_OOB_TCP_PEER_ALLOC(peer, rc) \
{ \
ompi_list_item_t* item; \
OMPI_FREE_LIST_GET(&mca_oob_tcp_module.tcp_peer_free, item, rc); \
OMPI_FREE_LIST_GET(&mca_oob_tcp_component.tcp_peer_free, item, rc); \
peer = (mca_oob_tcp_peer_t*)item; \
}
@ -63,7 +63,7 @@ typedef struct mca_oob_tcp_peer_t mca_oob_tcp_peer_t;
*/
#define MCA_OOB_TCP_PEER_RETURN(peer) \
{ \
OMPI_FREE_LIST_RETURN(&mca_oob_tcp_module.tcp_peer_free, (ompi_list_item_t*)peer); \
OMPI_FREE_LIST_RETURN(&mca_oob_tcp_component.tcp_peer_free, (ompi_list_item_t*)peer); \
}
#if defined(c_plusplus) || defined(__cplusplus)

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

@ -14,14 +14,14 @@
int mca_oob_tcp_recv(ompi_process_name_t* peer, const struct iovec *iov, int count, int flags)
{
mca_oob_tcp_msg_t * msg = (mca_oob_tcp_msg_t *)
ompi_list_get_first(&mca_oob_tcp_module.tcp_msg_recv);
ompi_list_get_first(&mca_oob_tcp_component.tcp_msg_recv);
int i, amount, read, size = 0;
char * base;
for(i = 0; i < count; i++) {
size += iov[i].iov_len;
}
/* lock the tcp struct */
OMPI_THREAD_LOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
/* check to see if a matching recieve is on the list */
while(NULL != msg) {
if(MCA_OOB_BASE_ANY == peer ||
@ -39,7 +39,7 @@ int mca_oob_tcp_recv(ompi_process_name_t* peer, const struct iovec *iov, int cou
base +=amount;
read += amount;
}
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
return read;
}
/* what are we going to define as matching? we don't know the number
@ -55,10 +55,10 @@ int mca_oob_tcp_recv(ompi_process_name_t* peer, const struct iovec *iov, int cou
base +=amount;
read += amount;
}
ompi_list_remove_item(&mca_oob_tcp_module.tcp_msg_recv,
ompi_list_remove_item(&mca_oob_tcp_component.tcp_msg_recv,
(ompi_list_item_t *) msg);
MCA_OOB_TCP_MSG_RETURN(msg);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
return read;
}
msg = (mca_oob_tcp_msg_t *) ompi_list_get_next(msg);
@ -67,7 +67,7 @@ int mca_oob_tcp_recv(ompi_process_name_t* peer, const struct iovec *iov, int cou
/* the message has not already been recieved. So we add it to the recieve queue */
MCA_OOB_TCP_MSG_ALLOC(msg, i);
if(NULL == msg) {
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
return i;
}
/* fill in the struct */
@ -85,8 +85,8 @@ int mca_oob_tcp_recv(ompi_process_name_t* peer, const struct iovec *iov, int cou
msg->msg_peer = &other->peer_name;
}
/* add to list */
ompi_list_append(&mca_oob_tcp_module.tcp_msg_recv, (ompi_list_item_t *) msg);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
ompi_list_append(&mca_oob_tcp_component.tcp_msg_recv, (ompi_list_item_t *) msg);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
/* wait for the recieve to complete */
mca_oob_tcp_msg_wait(msg, &read);
return read;
@ -107,14 +107,14 @@ int mca_oob_tcp_recv_nb(ompi_process_name_t* peer, const struct iovec* iov, int
int flags, mca_oob_callback_fn_t cbfunc, void* cbdata)
{
mca_oob_tcp_msg_t * msg = (mca_oob_tcp_msg_t *)
ompi_list_get_first(&mca_oob_tcp_module.tcp_msg_recv);
ompi_list_get_first(&mca_oob_tcp_component.tcp_msg_recv);
int i, amount, read, size = 0;
char * base;
for(i = 0; i < count; i++) {
size += iov[i].iov_len;
}
/* lock the tcp struct */
OMPI_THREAD_LOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_LOCK(&mca_oob_tcp_component.tcp_lock);
/* check to see if a matching recieve is on the list */
while(NULL != msg) {
if(MCA_OOB_BASE_ANY == peer ||
@ -133,7 +133,7 @@ int mca_oob_tcp_recv_nb(ompi_process_name_t* peer, const struct iovec* iov, int
read += amount;
}
cbfunc(read, peer, iov, count, cbdata);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
return read;
}
/* what are we going to define as matching? we don't know the number
@ -149,10 +149,10 @@ int mca_oob_tcp_recv_nb(ompi_process_name_t* peer, const struct iovec* iov, int
base +=amount;
read += amount;
}
ompi_list_remove_item(&mca_oob_tcp_module.tcp_msg_recv,
ompi_list_remove_item(&mca_oob_tcp_component.tcp_msg_recv,
(ompi_list_item_t *) msg);
MCA_OOB_TCP_MSG_RETURN(msg);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
cbfunc(read, peer, iov, count, cbdata);
return read;
}
@ -162,7 +162,7 @@ int mca_oob_tcp_recv_nb(ompi_process_name_t* peer, const struct iovec* iov, int
/* the message has not already been recieved. So we add it to the recieve queue */
MCA_OOB_TCP_MSG_ALLOC(msg, i);
if(NULL == msg) {
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
return i;
}
/* fill in the struct */
@ -181,8 +181,8 @@ int mca_oob_tcp_recv_nb(ompi_process_name_t* peer, const struct iovec* iov, int
}
msg->msg_complete = false;
/* add to list */
ompi_list_append(&mca_oob_tcp_module.tcp_msg_recv, (ompi_list_item_t *) msg);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_module.tcp_lock);
ompi_list_append(&mca_oob_tcp_component.tcp_msg_recv, (ompi_list_item_t *) msg);
OMPI_THREAD_UNLOCK(&mca_oob_tcp_component.tcp_lock);
return OMPI_SUCCESS;
}

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

@ -39,7 +39,7 @@ extern "C" {
*/
extern int mca_pcm_base_output;
extern ompi_list_t mca_pcm_base_modules_available;
extern mca_pcm_base_module_t mca_pcm_base_selected_module;
extern mca_pcm_t mca_pcm;
extern mca_pcm_base_component_t mca_pcm_base_selected_component;
extern mca_pcm_base_module_t mca_pcm;
#endif /* MCA_PCM_BASE_H */

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

@ -17,8 +17,8 @@ int mca_pcm_base_close(void)
/* Close all remaining available modules (may be one if this is a
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
mca_base_modules_close(mca_pcm_base_output,
&mca_pcm_base_modules_available, NULL);
mca_base_components_close(mca_pcm_base_output,
&mca_pcm_base_components_available, NULL);
/* All done */

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

@ -12,32 +12,32 @@
/*
* The following file was created by configure. It contains extern
* statements and the definition of an array of pointers to each
* module's public mca_base_module_t struct.
* component's public mca_base_component_t struct.
*/
#include "mca/pcm/base/static-modules.h"
#include "mca/pcm/base/static-components.h"
/*
* Global variables
*/
int mca_pcm_base_output = -1;
mca_pcm_t mca_pcm;
ompi_list_t mca_pcm_base_modules_available;
mca_pcm_base_module_t mca_pcm_base_selected_module;
mca_pcm_base_module_t mca_pcm;
ompi_list_t mca_pcm_base_components_available;
mca_pcm_base_component_t mca_pcm_base_selected_component;
/**
* Function for finding and opening either all MCA modules, or the one
* Function for finding and opening either all MCA components, or the one
* that was specifically requested via a MCA parameter.
*/
int mca_pcm_base_open(void)
{
/* Open up all available modules */
/* Open up all available components */
if (OMPI_SUCCESS !=
mca_base_modules_open("pcm", 0, mca_pcm_base_static_modules,
&mca_pcm_base_modules_available)) {
mca_base_components_open("pcm", 0, mca_pcm_base_static_components,
&mca_pcm_base_components_available)) {
return OMPI_ERROR;
}

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

@ -28,32 +28,32 @@ int mca_pcm_base_select(bool *allow_multi_user_threads,
bool user_threads, hidden_threads;
bool best_user_threads, best_hidden_threads;
ompi_list_item_t *item;
mca_base_module_list_item_t *mli;
mca_base_component_list_item_t *cli;
mca_pcm_base_component_t *component, *best_component;
mca_pcm_base_module_t *module, *best_module;
mca_pcm_t *actions, *best_actions;
extern ompi_list_t mca_pcm_base_modules_available;
extern ompi_list_t mca_pcm_base_components_available;
/* Traverse the list of available modules; call their init
/* Traverse the list of available components; call their init
functions. */
best_priority = -1;
best_module = NULL;
for (item = ompi_list_get_first(&mca_pcm_base_modules_available);
ompi_list_get_end(&mca_pcm_base_modules_available) != item;
best_component = NULL;
for (item = ompi_list_get_first(&mca_pcm_base_components_available);
ompi_list_get_end(&mca_pcm_base_components_available) != item;
item = ompi_list_get_next(item)) {
mli = (mca_base_module_list_item_t *) item;
module = (mca_pcm_base_module_t *) mli->mli_module;
cli = (mca_base_component_list_item_t *) item;
component = (mca_pcm_base_component_t *) cli->cli_component;
ompi_output_verbose(10, mca_pcm_base_output,
"select: initializing %s module %s",
module->pcmm_version.mca_type_name,
module->pcmm_version.mca_module_name);
if (NULL == module->pcmm_init) {
"select: initializing %s component %s",
component->pcmm_version.mca_type_name,
component->pcmm_version.mca_component_name);
if (NULL == component->pcmm_init) {
ompi_output_verbose(10, mca_pcm_base_output,
"select: no init function; ignoring module");
"select: no init function; ignoring component");
} else {
actions = module->pcmm_init(&priority, &user_threads, &hidden_threads);
if (NULL == actions) {
module = component->pcmm_init(&priority, &user_threads, &hidden_threads);
if (NULL == module) {
ompi_output_verbose(10, mca_pcm_base_output,
"select: init returned failure");
} else {
@ -63,62 +63,62 @@ int mca_pcm_base_select(bool *allow_multi_user_threads,
best_priority = priority;
best_user_threads = user_threads;
best_hidden_threads = hidden_threads;
best_component = component;
best_module = module;
best_actions = actions;
}
}
}
}
/* Finished querying all modules. Check for the bozo case. */
/* Finished querying all components. Check for the bozo case. */
if (NULL == best_module) {
if (NULL == best_component) {
/* JMS Replace with show_help */
ompi_abort(1, "No PCM module available. This shouldn't happen.");
ompi_abort(1, "No PCM component available. This shouldn't happen.");
}
/* Finalize all non-selected modules */
/* Finalize all non-selected components */
for (item = ompi_list_get_first(&mca_pcm_base_modules_available);
ompi_list_get_end(&mca_pcm_base_modules_available) != item;
for (item = ompi_list_get_first(&mca_pcm_base_components_available);
ompi_list_get_end(&mca_pcm_base_components_available) != item;
item = ompi_list_get_next(item)) {
mli = (mca_base_module_list_item_t *) item;
module = (mca_pcm_base_module_t *) mli->mli_module;
cli = (mca_base_component_list_item_t *) item;
component = (mca_pcm_base_component_t *) cli->cli_component;
if (module != best_module) {
if (component != best_component) {
/* Finalize */
if (NULL != module->pcmm_finalize) {
if (NULL != component->pcmm_finalize) {
/* Blatently ignore the return code (what would we do to
recover, anyway? This module is going away, so errors
recover, anyway? This component is going away, so errors
don't matter anymore) */
module->pcmm_finalize();
component->pcmm_finalize();
ompi_output_verbose(10, mca_pcm_base_output,
"select: module %s finalized",
module->pcmm_version.mca_module_name);
"select: component %s finalized",
component->pcmm_version.mca_component_name);
}
}
}
/* This base function closes, unloads, and removes from the
available list all unselected modules. The available list will
contain only the selected module. */
available list all unselected components. The available list will
contain only the selected component. */
mca_base_modules_close(mca_pcm_base_output, &mca_pcm_base_modules_available,
(mca_base_module_t *) best_module);
mca_base_components_close(mca_pcm_base_output, &mca_pcm_base_components_available,
(mca_base_component_t *) best_component);
/* Save the winner */
mca_pcm_base_selected_module = *best_module;
mca_pcm = *best_actions;
mca_pcm_base_selected_component = *best_component;
mca_pcm = *best_module;
*allow_multi_user_threads = best_user_threads;
*have_hidden_threads = best_hidden_threads;
ompi_output_verbose(10, mca_pcm_base_output,
"select: module %s initialized",
module->pcmm_version.mca_module_name);
"select: component %s initialized",
component->pcmm_version.mca_component_name);
/* All done */

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

@ -17,7 +17,7 @@ int mca_pcm_cofs_close(void);
/*
* Startup / Shutdown
*/
struct mca_pcm_1_0_0_t* mca_pcm_cofs_init(int *priority, bool *allow_multi_user_threads, bool *have_hidden_threads);
struct mca_pcm_base_module_1_0_0_t* mca_pcm_cofs_init(int *priority, bool *allow_multi_user_threads, bool *have_hidden_threads);
int mca_pcm_cofs_finalize(void);

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

@ -22,26 +22,26 @@
/*
* Struct of function pointers and all that to let us be initialized
*/
mca_pcm_base_module_1_0_0_t mca_pcm_cofs_module = {
mca_pcm_base_component_1_0_0_t mca_pcm_cofs_component = {
{
MCA_PCM_BASE_VERSION_1_0_0,
"cofs", /* MCA module name */
1, /* MCA module major version */
0, /* MCA module minor version */
0, /* MCA module release version */
mca_pcm_cofs_open, /* module open */
mca_pcm_cofs_close /* module close */
"cofs", /* MCA component name */
1, /* MCA component major version */
0, /* MCA component minor version */
0, /* MCA component release version */
mca_pcm_cofs_open, /* component open */
mca_pcm_cofs_close /* component close */
},
{
false /* checkpoint / restart */
},
mca_pcm_cofs_init, /* module init */
mca_pcm_cofs_init, /* component init */
mca_pcm_cofs_finalize
};
struct mca_pcm_1_0_0_t mca_pcm_cofs_1_0_0 = {
struct mca_pcm_base_module_1_0_0_t mca_pcm_cofs_1_0_0 = {
mca_pcm_cofs_get_peers,
mca_pcm_cofs_get_self
};
@ -75,7 +75,7 @@ mca_pcm_cofs_close(void)
}
struct mca_pcm_1_0_0_t *
struct mca_pcm_base_module_1_0_0_t *
mca_pcm_cofs_init(int *priority, bool *allow_multi_user_threads,
bool *have_hidden_threads)
{

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

@ -62,30 +62,36 @@
#include <sys/param.h>
typedef int (*mca_pcm_base_get_peers_fn_t)(ompi_process_name_t **peers, size_t *npeers);
/* Module functions */
typedef ompi_process_name_t* (*mca_pcm_base_get_self_fn_t)(void);
typedef int (*mca_pcm_base_module_get_peers_fn_t)
(ompi_process_name_t **peers, size_t *npeers);
typedef ompi_process_name_t* (*mca_pcm_base_module_get_self_fn_t)(void);
typedef struct mca_pcm_1_0_0_t *
(*mca_pcm_base_init_fn_t)(int *priority, bool *allow_multi_user_threads,
bool *have_hidden_threads);
/* Component functions */
typedef struct mca_pcm_base_module_1_0_0_t *(*mca_pcm_base_component_init_fn_t)
(int *priority, bool *allow_multi_user_threads,
bool *have_hidden_threads);
typedef int (*mca_pcm_base_component_finalize_fn_t)(void);
typedef int (*mca_pcm_base_finalize_fn_t)(void);
/* Ver 1.0.0 */
struct mca_pcm_base_component_1_0_0_t {
mca_base_component_t pcmm_version;
mca_base_component_data_1_0_0_t pcmm_data;
mca_pcm_base_component_init_fn_t pcmm_init;
mca_pcm_base_component_finalize_fn_t pcmm_finalize;
};
typedef struct mca_pcm_base_component_1_0_0_t mca_pcm_base_component_1_0_0_t;
typedef struct mca_pcm_base_component_1_0_0_t mca_pcm_base_component_t;
struct mca_pcm_base_module_1_0_0_t {
mca_base_module_t pcmm_version;
mca_base_module_data_1_0_0_t pcmm_data;
mca_pcm_base_init_fn_t pcmm_init;
mca_pcm_base_finalize_fn_t pcmm_finalize;
mca_pcm_base_module_get_peers_fn_t pcm_peers;
mca_pcm_base_module_get_self_fn_t pcm_self;
};
typedef struct mca_pcm_base_module_1_0_0_t mca_pcm_base_module_1_0_0_t;
struct mca_pcm_1_0_0_t {
mca_pcm_base_get_peers_fn_t pcm_peers;
mca_pcm_base_get_self_fn_t pcm_self;
};
typedef struct mca_pcm_1_0_0_t mca_pcm_1_0_0_t;
typedef struct mca_pcm_base_module_1_0_0_t mca_pcm_base_module_t;
/*
* Macro for use in modules that are of type pcm v1.0.0
@ -96,9 +102,6 @@ typedef struct mca_pcm_1_0_0_t mca_pcm_1_0_0_t;
/* pcm v1.0 */ \
"pcm", 1, 0, 0
typedef struct mca_pcm_base_module_1_0_0_t mca_pcm_base_module_t;
typedef struct mca_pcm_1_0_0_t mca_pcm_t;
/*
* Global functions for MCA overall collective open and close
*/
@ -128,8 +131,8 @@ extern "C" {
* Globals
*/
extern int mca_pcm_base_output;
extern ompi_list_t mca_pcm_base_modules_available;
extern mca_pcm_base_module_t mca_pcm_base_selected_module;
extern mca_pcm_t mca_pcm;
extern ompi_list_t mca_pcm_base_components_available;
extern mca_pcm_base_component_t mca_pcm_base_selected_component;
extern mca_pcm_base_module_t mca_pcm;
#endif

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