1
1

orte/common/alps: add an alps common lib to orte

Add an alps common lib to orte.  Add a function
to determine whether or not a process is in a
PAGG container.

Note: we need a better naming convention for
common libs, since right now they use a "flat"
naming convention.
Этот коммит содержится в:
Howard Pritchard 2014-11-22 12:51:56 -08:00
родитель a753c3ece0
Коммит e0487e7702
10 изменённых файлов: 231 добавлений и 47 удалений

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

@ -107,3 +107,6 @@ libmca_common_verbs_so_version=0:0:0
# OPAL layer
libmca_opal_common_pmi_so_version=0:0:0
# ORTE layer
libmca_common_alps_so_version=0:0:0

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

@ -157,6 +157,7 @@ AC_SUBST(libmca_common_ofacm_so_version)
AC_SUBST(libmca_common_sm_so_version)
AC_SUBST(libmca_common_ugni_so_version)
AC_SUBST(libmca_common_verbs_so_version)
AC_SUBST(libmca_common_alps_so_version)
#
# Get the versions of the autotools that were used to bootstrap us

66
orte/mca/common/alps/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,66 @@
#
# Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
# Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
# Copyright (c) 2012-2014 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
AM_CPPFLAGS = $(common_alps_CPPFLAGS)
headers = \
common_alps.h
sources = \
common_alps.c
lib_LTLIBRARIES =
noinst_LTLIBRARIES =
comp_inst = lib@ORTE_LIB_PREFIX@mca_common_alps.la
comp_noinst = lib@ORTE_LIB_PREFIX@mca_common_alps_noinst.la
if MCA_BUILD_orte_common_alps_DSO
lib_LTLIBRARIES += $(comp_inst)
else
noinst_LTLIBRARIES += $(comp_noinst)
endif
lib@ORTE_LIB_PREFIX@mca_common_alps_la_SOURCES = $(headers) $(sources)
lib@ORTE_LIB_PREFIX@mca_common_alps_la_CPPFLAGS = $(common_alps_CPPFLAGS)
lib@ORTE_LIB_PREFIX@mca_common_alps_la_LDFLAGS = \
-version-info $(libmca_common_alps_so_version) \
$(common_alps_LDFLAGS)
lib@ORTE_LIB_PREFIX@mca_common_alps_la_LIBADD = $(common_alps_LIBS)
lib@ORTE_LIB_PREFIX@mca_common_alps_noinst_la_SOURCES = $(headers) $(sources)
# Conditionally install the header files
if WANT_INSTALL_HEADERS
opaldir = $(opalincludedir)/opal/mca/common/common_alps.h
opal_HEADERS = $(headers)
else
opaldir = $(includedir)
endif
# These two rules will sym link the "noinst" libtool library filename
# to the installable libtool library filename in the case where we are
# compiling this component statically (case 2), described above).
V=0
OMPI_V_LN_SCOMP = $(ompi__v_LN_SCOMP_$V)
ompi__v_LN_SCOMP_ = $(ompi__v_LN_SCOMP_$AM_DEFAULT_VERBOSITY)
ompi__v_LN_SCOMP_0 = @echo " LN_S " `basename $(comp_inst)`;
all-local:
$(OMPI_V_LN_SCOMP) if test -z "$(lib_LTLIBRARIES)"; then \
rm -f "$(comp_inst)"; \
$(LN_S) "$(comp_noinst)" "$(comp_inst)"; \
fi
clean-local:
if test -z "$(lib_LTLIBRARIES)"; then \
rm -f "$(comp_inst)"; \
fi

72
orte/mca/common/alps/common_alps.c Обычный файл
Просмотреть файл

@ -0,0 +1,72 @@
/*
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* These symbols are in a file by themselves to provide nice linker
* 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 components just to query their version and parameters.
*/
#include "opal/types.h"
#include "orte_config.h"
#include "orte/constants.h"
#include "orte/mca/common/alps/common_alps.h"
#include <unistd.h>
#include <sys/syscall.h>
/*
* determine whether or not calling process is in a Cray PAGG container
*/
int orte_common_alps_proc_in_pagg(bool *flag)
{
int rc = ORTE_SUCCESS;
const char proc_job_file[]="/proc/job";
FILE *fd = NULL, *fd_task_is_app = NULL;
char task_is_app_fname[PATH_MAX];
if (flag == NULL) {
return ORTE_ERR_BAD_PARAM;
}
fd = fopen(proc_job_file, "r");
if (fd == NULL) {
*flag = 0;
} else {
snprintf(task_is_app_fname,sizeof(task_is_app_fname),
"/proc/self/task/%ld/task_is_app",syscall(SYS_gettid));
fd_task_is_app = fopen(task_is_app_fname, "r");
if (fd_task_is_app != NULL) { /* okay we're in a PAGG container,
and we are an app task (not just a process
running on a mom node, for example), */
*flag = 1;
fclose(fd_task_is_app);
} else {
*flag = 0;
}
fclose(fd);
}
return rc;
}

32
orte/mca/common/alps/common_alps.h Обычный файл
Просмотреть файл

@ -0,0 +1,32 @@
/*
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* All rights reserved.
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2012-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#ifndef _COMMON_ALPS_H_
#define _COMMON_ALPS_H_
#include "opal_config.h"
BEGIN_C_DECLS
/**
* Determine if calling process is in a Cray PAGG job container.
* flag set to TRUE if the process is in a PAGG, otherwise FALSE.
*/
OPAL_DECLSPEC int orte_common_alps_proc_in_pagg(bool *flag);
END_C_DECLS
#endif

41
orte/mca/common/alps/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,41 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
# Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# MCA_orte_common_alps_CONFIG([action-if-can-compile],
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([MCA_orte_common_alps_CONFIG],[
AC_CONFIG_FILES([orte/mca/common/alps/Makefile])
common_verbs_happy="no"
OPAL_CHECK_OPENFABRICS([common_verbs],
[common_verbs_happy="yes"])
AS_IF([test "$common_verbs_happy" = "yes"],
[$1],
[$2])
# substitute in the things needed to build openib
AC_SUBST([common_alps_CFLAGS])
AC_SUBST([common_alps_CPPFLAGS])
AC_SUBST([common_alps_LDFLAGS])
AC_SUBST([common_alps_LIBS])
])dnl

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

@ -40,7 +40,8 @@ mcacomponent_LTLIBRARIES = $(component_install)
mca_ess_alps_la_SOURCES = $(sources)
mca_ess_alps_la_CPPFLAGS = $(ess_alps_CPPFLAGS) -fno-ident
mca_ess_alps_la_LDFLAGS = -module -avoid-version $(ess_alps_LDFLAGS)
mca_ess_alps_la_LIBADD = $(ess_alps_LDFLAGS)
mca_ess_alps_la_LIBADD = $(ess_alps_LDFLAGS) \
$(ORTE_TOP_BUILDDIR)/orte/mca/common/alps/lib@ORTE_LIB_PREFIX@mca_common_alps.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_ess_alps_la_SOURCES =$(sources)

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

@ -28,6 +28,7 @@
#include "orte/constants.h"
#include "orte/runtime/orte_globals.h"
#include "orte/util/proc_info.h"
#include "orte/mca/common/alps/common_alps.h"
#include "orte/mca/ess/ess.h"
#include "orte/mca/ess/base/base.h"
#include "orte/mca/ess/alps/ess_alps.h"
@ -71,9 +72,7 @@ orte_ess_alps_component_open(void)
int orte_ess_alps_component_query(mca_base_module_t **module, int *priority)
{
int rc = ORTE_SUCCESS;
const char proc_job_file[]="/proc/job";
FILE *fd = NULL, *fd_task_is_app = NULL;
char task_is_app_fname[PATH_MAX];
bool flag;
/*
* don't use the alps ess component if an app proc
@ -91,25 +90,10 @@ int orte_ess_alps_component_query(mca_base_module_t **module, int *priority)
* the cray job kernel module - the thing that creates the PAGG)
*/
/* disqualify ourselves if not running in a Cray PAGG container */
fd = fopen(proc_job_file, "r");
if (fd == NULL) {
*priority = 0;
*module = NULL;
rc = ORTE_ERROR;
} else {
snprintf(task_is_app_fname,sizeof(task_is_app_fname),
"/proc/self/task/%ld/task_is_app",syscall(SYS_gettid));
fd_task_is_app = fopen(task_is_app_fname, "r");
if (fd_task_is_app != NULL) { /* okay we're in a PAGG container,
and we are an app task (not just a process
running on a mom node, for example),
so we should give cray pmi a shot. */
*priority = 35; /* take precendence over base */
*module = (mca_base_module_t *) &orte_ess_alps_module;
fclose(fd_task_is_app);
}
fclose(fd);
rc = orte_common_alps_proc_in_pagg(&flag);
if ((ORTE_SUCCESS == rc) && flag) {
*priority = 35; /* take precendence over base */
*module = (mca_base_module_t *) &orte_ess_alps_module;
}
return rc;

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

@ -44,7 +44,8 @@ mcacomponent_LTLIBRARIES = $(component_install)
mca_odls_alps_la_SOURCES = $(sources)
mca_odls_alps_la_CPPFLAGS = $(odls_alps_CPPFLAGS)
mca_odls_alps_la_LDFLAGS = -module -avoid-version $(odls_alps_LDFLAGS)
mca_odls_alps_la_LIBADD = $(odls_alps_LIBS)
mca_odls_alps_la_LIBADD = $(odls_alps_LIBS) \
$(ORTE_TOP_BUILDDIR)/orte/mca/common/alps/lib@ORTE_LIB_PREFIX@mca_common_alps.la
noinst_LTLIBRARIES = $(component_noinst)
libmca_odls_alps_la_SOURCES =$(sources)

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

@ -37,6 +37,7 @@
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "orte/mca/common/alps/common_alps.h"
#include "orte/mca/odls/odls.h"
#include "orte/mca/odls/base/odls_private.h"
#include "orte/mca/odls/alps/odls_alps.h"
@ -77,9 +78,7 @@ int orte_odls_alps_component_open(void)
int orte_odls_alps_component_query(mca_base_module_t **module, int *priority)
{
int rc = ORTE_SUCCESS;
const char proc_job_file[]="/proc/job";
FILE *fd = NULL, *fd_task_is_app = NULL;
char task_is_app_fname[PATH_MAX];
bool flag;
/*
* make sure we're in a daemon process
@ -97,26 +96,10 @@ int orte_odls_alps_component_query(mca_base_module_t **module, int *priority)
* the cray job kernel module - the thing that creates the PAGG
*/
/* disqualify ourselves if not running in a Cray PAGG container */
fd = fopen(proc_job_file, "r");
if (fd == NULL) {
*priority = 0;
*module = NULL;
rc = ORTE_ERROR;
} else {
snprintf(task_is_app_fname,sizeof(task_is_app_fname),
"/proc/self/task/%ld/task_is_app",syscall(SYS_gettid));
fd_task_is_app = fopen(task_is_app_fname, "r");
if (fd_task_is_app != NULL) { /* okay we're in a PAGG container,
and we are an app task (not just a process
running on a mom node, for example),
so we should give cray pmi a shot. */
*priority = 10; /* take precendence over base */
*module = (mca_base_module_t *) &orte_odls_alps_module;
fclose(fd_task_is_app);
rc = orte_odls_alps_get_rdma_creds();
}
fclose(fd);
rc = orte_common_alps_proc_in_pagg(&flag);
if ((ORTE_SUCCESS == rc) && flag) {
*priority = 10; /* take precendence over base */
*module = (mca_base_module_t *) &orte_odls_alps_module;
}
return rc;