1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2011 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2006 Sandia National Laboratories. All rights
13 * reserved.
14 * Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 */
21
22 #ifndef MCA_BTL_USNIC_PROC_H
23 #define MCA_BTL_USNIC_PROC_H
24
25 #include "opal/class/opal_object.h"
26
27 #include "btl_usnic.h"
28 #include "btl_usnic_endpoint.h"
29
30 BEGIN_C_DECLS
31
32 /**
33 * Represents the state of a remote process and the set of addresses
34 * that it exports. An array of these are cached on the usnic
35 * component (not the usnic module).
36 *
37 * Also cache an instance of mca_btl_base_endpoint_t for each BTL
38 * module that attempts to open a connection to the process.
39 */
40 typedef struct opal_btl_usnic_proc_t {
41 /** allow proc to be placed on a list */
42 opal_list_item_t super;
43
44 /** pointer to corresponding opal_proc_t */
45 opal_proc_t *proc_opal;
46
47 /** Addresses received via modex for this remote proc */
48 opal_btl_usnic_modex_t* proc_modex;
49 /** Number of entries in the proc_modex array */
50 size_t proc_modex_count;
51 /** Whether the modex entry is "claimed" by a module or not */
52 bool *proc_modex_claimed;
53
54 /** Array of endpoints that have been created to access this proc */
55 struct mca_btl_base_endpoint_t **proc_endpoints;
56 /** Number of entries in the proc_endpoints array */
57 size_t proc_endpoint_count;
58
59 /**
60 * A table giving the chosen pairing between modules and endpoint
61 * addresses. It has size mca_btl_usnic_component.num_modules.
62 * j=proc_ep_match_table[i] means that
63 * mca_btl_usnic_component.usnic_active_modules[i] should be paired with
64 * proc_modex[j]. If there is no pairing for proc_modex[i] then
65 * proc_ep_match_table[i] will be set to -1
66 *
67 * If matchings have not yet been computed for this proc, the pointer will
68 * be NULL.
69 */
70 int *proc_ep_match_table;
71
72 /**
73 * true iff proc_ep_match_table != NULL and it contains at least one entry
74 * that is not equal to -1.
75 */
76 bool proc_match_exists;
77 } opal_btl_usnic_proc_t;
78
79 OBJ_CLASS_DECLARATION(opal_btl_usnic_proc_t);
80
81
82 opal_btl_usnic_proc_t *opal_btl_usnic_proc_lookup_ompi(opal_proc_t* opal_proc);
83
84 struct opal_btl_usnic_module_t;
85
86 opal_btl_usnic_endpoint_t *
87 opal_btl_usnic_proc_lookup_endpoint(struct opal_btl_usnic_module_t *receiver,
88 uint64_t sender_hashed_rte_name);
89
90 int opal_btl_usnic_proc_match(opal_proc_t* opal_proc,
91 struct opal_btl_usnic_module_t *module,
92 opal_btl_usnic_proc_t **proc);
93 int
94 opal_btl_usnic_create_endpoint(struct opal_btl_usnic_module_t *module,
95 opal_btl_usnic_proc_t *proc,
96 opal_btl_usnic_endpoint_t **endpoint_o);
97
98 END_C_DECLS
99
100 #endif