root/mpich2/trunk/src/pm/hydra/bootstrap/src/bsci_init.c.in @ 4887

Revision 4887, 2.0 KB (checked in by balaji, 5 months ago)

Warning stomp.

Line 
1/* -*- Mode: C; c-basic-offset:4 ; -*- */
2/*
3 *  (C) 2008 by Argonne National Laboratory.
4 *      See COPYRIGHT in top-level directory.
5 */
6
7#include "hydra_utils.h"
8#include "bsci.h"
9#include "bscu.h"
10
11struct HYD_BSCI_fns HYD_BSCI_fns = { 0 };
12const char *HYD_BSCI_comp_array[] = { @hydra_bss_name_array@ };
13HYD_Status(*HYD_BSCI_comp_init[])(void) = { @hydra_bss_init_array@ };
14struct HYD_BSCI_info HYD_BSCI_info = { 0 };
15
16HYD_Status HYD_BSCI_init(char *bootstrap, char *bootstrap_exec, int enablex, int debug)
17{
18    int i;
19    HYD_Status status = HYD_SUCCESS;
20
21    HYDU_FUNC_ENTER();
22
23    for (i = 0; HYD_BSCI_comp_array[i]; i++) {
24        if (!strcmp(bootstrap, HYD_BSCI_comp_array[i])) {
25            status = (*HYD_BSCI_comp_init[i])();
26            HYDU_ERR_POP(status, "bootstrap device returned error initializing\n");
27            break;
28        }
29    }
30
31    /* Set the appropriate info */
32    HYD_BSCI_info.bootstrap_exec = bootstrap_exec;
33    HYD_BSCI_info.enablex = enablex;
34    HYD_BSCI_info.debug = debug;
35
36    if (HYD_BSCI_comp_array[i] == NULL)
37        HYDU_ERR_SETANDJUMP1(status, HYD_INTERNAL_ERROR,
38                             "unrecognized bootstrap server: %s\n", bootstrap);
39
40    /* This function is mandatory */
41    if (HYD_BSCI_fns.launch_procs == NULL)
42        HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR,
43                            "mandatory bootstrap launch function undefined\n");
44
45    if (HYD_BSCI_fns.finalize == NULL)
46        HYD_BSCI_fns.finalize = HYD_BSCU_finalize;
47    if (HYD_BSCI_fns.wait_for_completion == NULL)
48        HYD_BSCI_fns.wait_for_completion = HYD_BSCU_wait_for_completion;
49    if (HYD_BSCI_fns.query_node_list == NULL)
50        HYD_BSCI_fns.query_node_list = HYD_BSCU_query_node_list;
51    if (HYD_BSCI_fns.query_usize == NULL)
52        HYD_BSCI_fns.query_usize = HYD_BSCU_query_usize;
53    if (HYD_BSCI_fns.query_partition_id == NULL)
54        HYD_BSCI_fns.query_partition_id = HYD_BSCU_query_partition_id;
55
56  fn_exit:
57    HYDU_FUNC_EXIT();
58    return status;
59
60  fn_fail:
61    goto fn_exit;
62}
Note: See TracBrowser for help on using the browser.