File: bml_base_init.c

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (96 lines) | stat: -rw-r--r-- 3,537 bytes parent folder | download | duplicates (2)
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
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2004-2007 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-2007 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2004-2006 The Regents of the University of California.
 *                         All rights reserved.
 * Copyright (c) 2015      Research Organization for Information Science
 *                         and Technology (RIST). All rights reserved.
 * Copyright (c) 2016      Los Alamos National Security, LLC. All rights
 *                         reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "ompi_config.h"
#include "ompi/mca/bml/base/base.h"
#include "opal/mca/base/base.h"

#include "ompi/mca/mca.h"
#include "opal/runtime/opal.h"

mca_bml_base_module_t mca_bml = {
    NULL,                    /* bml_component */
    NULL,                    /* bml_add_procs */
    NULL,                    /* bml_del_procs */
    NULL,                    /* bml_add_btl */
    NULL,                    /* bml_del_btl */
    NULL,                    /* bml_del_proc_btl */
    NULL,                    /* bml_register */
    NULL,                    /* bml_register_error */
    NULL,                    /* bml_finalize*/
    NULL                     /* FT event */
};
mca_bml_base_component_t mca_bml_component = {{0}};

bool mca_bml_component_init_called = false;

bool
mca_bml_base_inited(void)
{
    return mca_bml_component_init_called;
}

int mca_bml_base_init( bool enable_progress_threads,
                       bool enable_mpi_threads) {
    mca_bml_base_component_t *component = NULL, *best_component = NULL;
    mca_bml_base_module_t *module = NULL, *best_module = NULL;
    int priority = 0, best_priority = -1;
    mca_base_component_list_item_t *cli = NULL;

    if (true == mca_bml_component_init_called) {
        return OPAL_SUCCESS;
    }

    mca_bml_component_init_called = true;

    OPAL_LIST_FOREACH(cli, &ompi_bml_base_framework.framework_components, mca_base_component_list_item_t) {
        component = (mca_bml_base_component_t*) cli->cli_component;
        if(NULL == component->bml_init) {
            opal_output_verbose( 10, ompi_bml_base_framework.framework_output,
                                 "select: no init function; ignoring component %s",
                                 component->bml_version.mca_component_name );
            continue;
        }
        module = component->bml_init(&priority,
                                     enable_progress_threads,
                                     enable_mpi_threads);

        if(NULL == module) {
            continue;
        }
        if(priority > best_priority) {
            best_priority = priority;
            best_component = component;
            best_module = module;
        }

    }
    if(NULL == best_module) {
        return OMPI_SUCCESS;
    }

    mca_bml_component = *best_component;
    mca_bml = *best_module;
    return mca_base_framework_components_close(&ompi_bml_base_framework,
                                               (mca_base_component_t*) best_component);
}