1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
/*
* 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) 2006-2007 Cisco Systems, Inc. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
/* This component will only be compiled on File, where we are
guaranteed to have <unistd.h> and friends */
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif /* HAVE_STDLIB_H */
#ifdef HAVE_STRING_H
#include <string.h>
#endif /* HAVE_STRING_H */
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif /* HAVE_ERRNO_H */
#include "opal/constants.h"
#include "opal/mca/base/mca_base_param.h"
#include "opal/mca/carto/carto.h"
#include "opal/mca/carto/base/base.h"
#include "opal/mca/carto/base/carto_base_graph.h"
#include "carto_auto_detect.h"
static int opal_carto_auto_detect_init(void);
static int opal_carto_auto_detect_finalize(void);
/*
* Auto detect carto module
*/
static const opal_carto_base_module_1_0_0_t loc_module = {
opal_carto_auto_detect_init,
opal_carto_base_graph_get_host_graph_fn,
opal_carto_base_free_graph_fn,
opal_carto_base_get_nodes_distance_fn,
opal_carto_base_graph_spf_fn,
opal_carto_base_graph_find_node_fn,
opal_carto_auto_detect_finalize,
};
int opal_carto_auto_detect_component_query(mca_base_module_t **module, int *priority)
{
int param;
param = mca_base_param_find("carto", "auto_detect", "priority");
mca_base_param_lookup_int(param, priority);
*module = (mca_base_module_t *)&loc_module;
return OPAL_SUCCESS;
}
/**
* Init the auto detect module. this function build an empty
* carto grap and does nothing more. to comleate this module,
* this function should read the system files and fill the
* carto graph
*
* @return int success or error
*/
static int opal_carto_auto_detect_init(void)
{
/* create an empty graph */
if (NULL == opal_carto_base_common_host_graph) {
opal_carto_base_graph_create_fn(&opal_carto_base_common_host_graph);
}
return OPAL_SUCCESS;
}
/**
* Cleans the auto detect module.
*
* @return int success or error
*/
static int opal_carto_auto_detect_finalize(void)
{
/* free the host cartography graph. */
if (NULL != opal_carto_base_common_host_graph) {
opal_carto_base_free_graph_fn(opal_carto_base_common_host_graph);
}
return OPAL_SUCCESS;
}
|