1
1
openmpi/orte/mca/ess/alps/ess_alps_component.c
Howard Pritchard a753c3ece0 ess/alps: add initial alps ess component
Note this alps ess component has nothing to do
with the old CNOS alps component used on
Cray Seastar/Portals3 (Cray XT) systems.

To work properly, changes need to be made to the
open method of the ess/pmi component to keep it
from selecting, and thus initializing, the opal/pmix/cray
component.
2014-12-03 09:44:17 -07:00

124 строки
3.8 KiB
C

/*
* Copyright (c) 2004-2008 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) 2011-2012 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 "orte_config.h"
#include "orte/constants.h"
#include "orte/runtime/orte_globals.h"
#include "orte/util/proc_info.h"
#include "orte/mca/ess/ess.h"
#include "orte/mca/ess/base/base.h"
#include "orte/mca/ess/alps/ess_alps.h"
#include <sys/syscall.h>
/*
* Instantiate the public struct with all of our public information
* and pointers to our public functions in it
*/
orte_ess_base_component_t mca_ess_alps_component = {
/* First, the mca_component_t struct containing meta information
about the component itself */
{
ORTE_ESS_BASE_VERSION_3_0_0,
/* Component name and version */
"alps",
ORTE_MAJOR_VERSION,
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
/* Component open and close functions */
orte_ess_alps_component_open,
orte_ess_alps_component_close,
orte_ess_alps_component_query
},
{
/* The component is not checkpoint ready */
MCA_BASE_METADATA_PARAM_NONE
}
};
int
orte_ess_alps_component_open(void)
{
return ORTE_SUCCESS;
}
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];
/*
* don't use the alps ess component if an app proc
*/
if (ORTE_PROC_IS_APP) {
*priority = 0;
*module = NULL;
return ORTE_ERROR;
}
/*
* make sure we're in a Cray PAGG container, and that we are also on
* a compute node (i.e. we are thought of as an application task by
* 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);
}
return rc;
}
int
orte_ess_alps_component_close(void)
{
return ORTE_SUCCESS;
}