File: reachable.h

package info (click to toggle)
openmpi 5.0.8-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,684 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (110 lines) | stat: -rw-r--r-- 3,766 bytes parent folder | download | duplicates (4)
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
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
 * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
 *                         reserved.
 * Copyright (c) 2017-2019 Amazon.com, Inc. or its affiliates.
 *                         All Rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#ifndef OPAL_REACHABLE_H
#define OPAL_REACHABLE_H

#include "opal_config.h"
#include "opal/class/opal_object.h"
#include "opal/types.h"

#include "opal/mca/if/if.h"
#include "opal/mca/mca.h"

BEGIN_C_DECLS

/**
 * Reachability matrix between endpoints of a given pair of hosts
 *
 * The output of the reachable() call is a opal_reachable_t, which
 * gives an matrix of the connectivity between local and remote
 * ethernet endpoints.  Any given value in weights is the connectivity
 * between the local endpoint index (first index) and the remote
 * endpoint index (second index), and is a value between 0 and INT_MAX
 * representing a relative connectivity.
 */
struct opal_reachable_t {
    opal_object_t super;
    /** number of local interfaces passed to reachable() */
    int num_local;
    /** number of remote interfaces passed to reachable() */
    int num_remote;
    /** matric of connectivity weights */
    int **weights;
    /** \internal */
    void *memory;
};
typedef struct opal_reachable_t opal_reachable_t;
OBJ_CLASS_DECLARATION(opal_reachable_t);

/* Init */
typedef int (*opal_reachable_base_module_init_fn_t)(void);

/* Finalize */
typedef int (*opal_reachable_base_module_fini_fn_t)(void);

/* Build reachability matrix between local and remote ethernet
 * interfaces
 *
 * @param local_ifs (IN)     Local list of opal_if_t objects
 *                           The opal_if_t objects must be fully populated
 * @param remote_ifs (IN)    Remote list of opal_if_t objects
 *                           The opal_if_t objects must have the following fields populated:
 *                              uint16_t                 af_family;
 *                              struct sockaddr_storage  if_addr;
 *                              uint32_t                 if_mask;
 *                              uint32_t                 if_bandwidth;
 * @return opal_reachable_t  The reachability matrix was successfully created
 * @return NULL              The reachability matrix could not be constructed
 *
 * Given a list of local interfaces and remote interfaces from a
 * single peer, build a reachability matrix between the two peers.
 * This function does not select the best pairing of local and remote
 * interfaces, but only a (comparable) reachability between any pair
 * of local/remote interfaces.
 *
 * This function will show an identical local and remote interface as
 * reachable.
 *
 */
typedef opal_reachable_t *(*opal_reachable_base_module_reachable_fn_t)(opal_list_t *local_ifs,
                                                                       opal_list_t *remote_ifs);

/*
 * the standard public API data structure
 */
typedef struct {
    /* currently used APIs */
    opal_reachable_base_module_init_fn_t init;
    opal_reachable_base_module_fini_fn_t finalize;
    opal_reachable_base_module_reachable_fn_t reachable;
} opal_reachable_base_module_t;

typedef struct {
    mca_base_component_t base_version;
    mca_base_component_data_t base_data;
    int priority;
} opal_reachable_base_component_t;

/*
 * Macro for use in components that are of type reachable
 */
#define OPAL_REACHABLE_BASE_VERSION_2_0_0 OPAL_MCA_BASE_VERSION_2_1_0("reachable", 2, 0, 0)

/* Global structure for accessing reachability functions */
OPAL_DECLSPEC extern opal_reachable_base_module_t opal_reachable;

END_C_DECLS

#endif