Skip to content

Commit

Permalink
Merge pull request #365 from rhc54/topic/plt2
Browse files Browse the repository at this point in the history
Correctly transfer default param and hostfile files
  • Loading branch information
rhc54 committed Feb 16, 2020
2 parents c92afbc + 9eb7348 commit 2d99acb
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 32 deletions.
111 changes: 109 additions & 2 deletions config/prrte_load_platform.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
dnl Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
Expand All @@ -23,14 +23,20 @@ dnl
# PRRTE_LOAD_PLATFORM()
# --------------------
AC_DEFUN([PRRTE_LOAD_PLATFORM], [
AC_ARG_WITH([platform-patches-dir],
[AC_HELP_STRING([--with-platform-patches-dir=DIR],
[Location of the platform patches directory. If you use this option, you must also use --with-platform.])])

AC_ARG_WITH([platform],
[AC_HELP_STRING([--with-platform=FILE],
[Load options for build from FILE. Options on the
command line not in FILE are used. Options on the
command line and in FILE are replaced by what is
in FILE.])])

m4_ifval([autogen_platform_file], [
if test "$with_platform" = "" ; then
with_platform=autogen_platform_file
fi])
if test "$with_platform" = "yes" ; then
AC_MSG_ERROR([--with-platform argument must include FILE option])
elif test "$with_platform" = "no" ; then
Expand Down Expand Up @@ -77,5 +83,106 @@ AC_DEFUN([PRRTE_LOAD_PLATFORM], [

# return to where we started
cd "$platform_savedir"

# define an alternate default mca param filename
platform_alt_mca_file="`basename $platform_loaded`.conf"

# look where platform file is located for platform.conf name
if test -r "${platform_file_dir}/${platform_alt_mca_file}" ; then
AC_SUBST(PRRTE_DEFAULT_MCA_PARAM_CONF, [$platform_file_dir/$platform_alt_mca_file])
AC_SUBST(PRRTE_PARAM_FROM_PLATFORM, "yes")
# if not, see if a file is there with the default name
elif test -r "${platform_file_dir}/prrte-mca-params.conf" ; then
AC_SUBST(PRRTE_DEFAULT_MCA_PARAM_CONF, [$platform_file_dir/prrte-mca-params.conf])
AC_SUBST(PRRTE_PARAM_FROM_PLATFORM, "yes")
# if not, then just use the default
else
AC_SUBST(PRRTE_DEFAULT_MCA_PARAM_CONF, [prrte-mca-params.conf])
AC_SUBST(PRRTE_PARAM_FROM_PLATFORM, "no")
fi

patch_dir="${with_platform}.patches"
if test -n "$with_platform_patches_dir"; then
if test "$with_platform_patches_dir" = "yes"; then
patch_dir="${with_platform}.patches"
elif test "$with_platform_patches_dir" = "no"; then
AC_MSG_NOTICE([Disabling platform patches on user request])
patch_dir=""
elif test -d "$with_platform_patches_dir"; then
patch_dir=$with_platform_patches_dir
else
AC_MSG_ERROR([User provided patches directory: $with_platform_patches_dir not found])
fi
fi

patch_done="${srcdir}/.platform_patches"
patch_found=no

if test -d "${patch_dir}"; then
if test ! -f "${patch_done}"; then

AC_MSG_NOTICE([Checking patches from ${patch_dir}/ directory ])
for one_patch in $patch_dir/*.patch ; do

AC_MSG_CHECKING([patch: $one_patch for errors ])
patch -d ${srcdir} -p1 -t -s --dry-run < ${one_patch}
if test "$?" != "0"; then
AC_MSG_RESULT([fail])
AC_MSG_ERROR([Platform patches failed to apply])
else
AC_MSG_RESULT([ok])
fi

AC_MSG_CHECKING([patch: $one_patch for unsupported configury changes ])
has_configury_items=$(patch -d ${srcdir} -p1 -t --dry-run < ${one_patch} 2>&1 | egrep "^patching" | egrep '*\.(am|m4)$' | wc -l)

if test $has_configury_items -ne 0; then
AC_MSG_RESULT([fail])
AC_MSG_ERROR([Platform patches should not change configury files])
else
AC_MSG_RESULT([ok])
fi
done


for one_patch in $patch_dir/*.patch ; do
AC_MSG_NOTICE([Applying patch ${one_patch}])
patch -d ${srcdir} -p1 -t -s < ${one_patch}
if test "$?" != "0"; then
AC_MSG_ERROR([Failed to apply patch ${one_patch}])
fi
patch_found=yes
done

if test "$patch_found" = "yes"; then

platform_root_short="$(basename $platform_base)"

# If platform file resides under platform/ root folder - use filename as ident
if [ test "$platform_root_short" = "platform" ]; then
platform_ident="$platform_file"
else
platform_ident="$(basename $platform_base)"
fi

# Set custom ident for platform patched PRRTE
if [ test -z "$with_ident_string" ]; then
with_ident_string="Platform: $platform_ident"
fi

AC_MSG_NOTICE([Platform patches applied, created stamp file ${patch_done}])
touch ${patch_done}
else
AC_MSG_NOTICE([No platform patches in ${patch_dir}])
fi

else
AC_MSG_WARN([Platform patches already applied, skipping. ${patch_done} can be removed to re-apply ])
fi
elif test -n "${patch_dir}"; then
AC_MSG_NOTICE([No platform patches in ${patch_dir}])
fi
else
AC_SUBST(PRRTE_DEFAULT_MCA_PARAM_CONF, [prrte-mca-params.conf])
fi
])
47 changes: 31 additions & 16 deletions src/etc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2019 Intel, Inc. All rights reserved.
# Copyright (c) 2019-2020 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

prrte_config_files = \
openmpi-default-hostfile
prrte_config_files = @PRRTE_DEFAULT_MCA_PARAM_CONF@
prrte_file_from_platform = @PRRTE_PARAM_FROM_PLATFORM@

EXTRA_DIST = $(prrte_config_files)

Expand All @@ -32,19 +32,34 @@ EXTRA_DIST = $(prrte_config_files)
install-data-local:
$(MKDIR_P) $(DESTDIR)$(sysconfdir)
@ p="$(prrte_config_files)"; \
for file in $$p; do \
if test -f $(DESTDIR)$(sysconfdir)/$$file; then \
echo "******************************* WARNING ************************************"; \
echo "*** Not installing new $$file over existing file in:"; \
echo "*** $(DESTDIR)$(sysconfdir)/$$file"; \
echo "******************************* WARNING ************************************"; \
else \
if test -f "$$file"; then d=; else d="$(srcdir)/"; fi; \
f="`echo $$file | sed -e 's|^.*/||'`"; \
echo " $(INSTALL_DATA) $$d$$file $(DESTDIR)$(sysconfdir)/$$f"; \
$(INSTALL_DATA) $$d$$file $(DESTDIR)$(sysconfdir)/$$f; \
fi; \
done
if test "$(prrte_file_from_platform)" = "yes"; then \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(sysconfdir)/prrte-mca-params.conf"; \
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(sysconfdir)/prrte-mca-params.conf; \
else \
for file in $$p; do \
if test -f $(DESTDIR)$(sysconfdir)/prrte-mca-params.conf; then \
echo "******************************* WARNING ************************************"; \
echo "*** Not installing new $$file over existing file in:"; \
echo "*** $(DESTDIR)$(sysconfdir)/$$file"; \
echo "******************************* WARNING ************************************"; \
else \
if test -f "$$file"; then d=; else d="$(srcdir)/"; fi; \
f="`echo $$file | sed -e 's|^.*/||'`"; \
echo " $(INSTALL_DATA) $$d$$file $(DESTDIR)$(sysconfdir)/$$f"; \
$(INSTALL_DATA) $$d$$file $(DESTDIR)$(sysconfdir)/$$f; \
fi; \
done \
fi; \
if test -f $(DESTDIR)$(sysconfdir)/prrte-default-hostfile; then \
echo "******************************* WARNING ************************************"; \
echo "*** Not installing new prrte-default-hostfile over existing file in:"; \
echo "*** $(DESTDIR)$(sysconfdir)/$$file"; \
echo "******************************* WARNING ************************************"; \
else \
$(INSTALL_DATA) prrte-default-hostfile $(DESTDIR)$(sysconfdir)/; \
fi;


# Only remove if exactly the same as what in our tree
# NOTE TO READER: Bourne shell if ... fi evaluates the body if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
# SLURM or PBS / Torque).
#
# If you are primarily interested in running PRRTE on one node, you
# should *not* simply list "localhost" in here (contrary to prior MPI
# implementations, such as LAM/MPI). A localhost-only node list is
# should *not* simply list "localhost" in here. A localhost-only node list is
# created by the RAS component named "localhost" if no other RAS
# components were able to find any hosts to run on (this behavior can
# be disabled by excluding the localhost RAS component by specifying
Expand Down
20 changes: 8 additions & 12 deletions src/etc/openmpi-mca-params.conf → src/etc/prrte-mca-params.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2018-2019 Intel, Inc. All rights reserved.
# Copyright (c) 2018-2020 Intel, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -21,7 +21,7 @@
# This is the default system-wide MCA parameters defaults file.
# Specifically, the MCA parameter "mca_param_files" defaults to a
# value of
# "$HOME/.openmpi/mca-params.conf:$sysconf/openmpi-mca-params.conf"
# "$HOME/.prrte/mca-params.conf:$sysconf/prrte-mca-params.conf"
# (this file is the latter of the two). So if the default value of
# mca_param_files is not changed, this file is used to set system-wide
# MCA parameters. This file can therefore be used to set system-wide
Expand All @@ -31,11 +31,7 @@
# know / care enough to investigate the proper values for them.

# Note that this file is only applicable where it is visible (in a
# filesystem sense). Specifically, MPI processes each read this file
# during their startup to determine what default values for MCA
# parameters should be used. mpirun does not bundle up the values in
# this file from the node where it was run and send them to all nodes;
# the default value decisions are effectively distributed. Hence,
# filesystem sense) by PRRTE daemons. Hence,
# these values are only applicable on nodes that "see" this file. If
# $sysconf is a directory on a local disk, it is likely that changes
# to this file will need to be propagated to other nodes. If $sysconf
Expand All @@ -46,14 +42,14 @@
# rvalue. Quoting is ignored (so if you use quotes or escape
# characters, they'll be included as part of the value). For example:

# Disable run-time MPI parameter checking
# mpi_param_check = 0
# Select a particular routing component
# routed = binomial

# Note that the value "~/" will be expanded to the current user's home
# directory. For example:

# Change component loading path
# mca_base_component_path = /usr/local/lib/openmpi:~/my_openmpi_components
# mca_base_component_path = /usr/local/lib/prrte:~/my_prrte_components

# See "ompi_info --param all all --level 9" for a full listing of Open
# MPI MCA parameters available and their default values.
# See "prrte_info --param all all --level 9" for a full listing of
# PRRTE MCA parameters available and their default values.

0 comments on commit 2d99acb

Please sign in to comment.