File: base.h

package info (click to toggle)
openmpi 5.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,692 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 (156 lines) | stat: -rw-r--r-- 4,864 bytes parent folder | download | duplicates (5)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
 * Copyright (c) 2014      Mellanox Technologies, Inc.
 *                         All rights reserved.
 * Copyright (c) 2015      Cisco Systems, Inc.  All rights reserved.
 * Copyright (c) 2019      Research Organization for Information Science
 *                         and Technology (RIST).  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#ifndef MCA_SSHMEM_BASE_H
#define MCA_SSHMEM_BASE_H

#include "oshmem_config.h"
#include "oshmem/mca/sshmem/sshmem.h"
#include "oshmem/proc/proc.h"

#include "opal/mca/base/mca_base_framework.h"

BEGIN_C_DECLS

extern void* mca_sshmem_base_start_address;
extern char* mca_sshmem_base_backing_file_dir;

/* ////////////////////////////////////////////////////////////////////////// */
/* Public API for the sshmem framework */
/* ////////////////////////////////////////////////////////////////////////// */
OSHMEM_DECLSPEC int
mca_sshmem_segment_create(map_segment_t *ds_buf,
                          const char *file_name,
                          size_t size, long hint);

OSHMEM_DECLSPEC void *
mca_sshmem_segment_attach(map_segment_t *ds_buf, sshmem_mkey_t *mkey);

OSHMEM_DECLSPEC int
mca_sshmem_segment_detach(map_segment_t *ds_buf, sshmem_mkey_t *mkey);

OSHMEM_DECLSPEC int
mca_sshmem_unlink(map_segment_t *ds_buf);
/* ////////////////////////////////////////////////////////////////////////// */
/* End Public API for the sshmem framework */
/* ////////////////////////////////////////////////////////////////////////// */

/*
 * Global functions for MCA overall sshmem open and close
 */

/**
 * Select an available component.
 *
 * @return OSHMEM_SUCCESS Upon success.
 * @return OSHMEM_NOT_FOUND If no component can be selected.
 * @return OSHMEM_ERROR Upon other failure.
 *
 * This function invokes the selection process for shmem components,
 * which works as follows:
 *
 * - If the \em sshmem MCA parameter is not specified, the
 *   selection set is all available shmem components.
 * - If the \em sshmem MCA parameter is specified, the
 *   selection set is just that component.
 * - All components in the selection set are queried to see if
 *   they want to run.  All components that want to run are ranked
 *   by their priority and the highest priority component is
 *   selected.  All non-selected components have their "close"
 *   function invoked to let them know that they were not selected.
 * - The selected component will have its "init" function invoked to
 *   let it know that it was selected.
 *
 * If we fall through this entire process and no component is
 * selected, then return OSHMEM_NOT_FOUND (this is not a fatal
 * error).
 *
 * At the end of this process, we'll either have a single
 * component that is selected and initialized, or no component was
 * selected.  If no component was selected, subsequent invocation
 * of the shmem wrapper functions will return an error.
 */
OSHMEM_DECLSPEC int
mca_sshmem_base_select(void);

/**
 * Shut down the sshmem MCA framework.
 *
 * @retval OSHMEM_SUCCESS Always
 *
 * This function shuts down everything in the sshmem MCA
 * framework, and is called during opal_finalize().
 *
 * It must be the last function invoked on the sshmem MCA
 * framework.
 */
OSHMEM_DECLSPEC int
mca_sshmem_base_close(void);

/**
 * Indication of whether a component was successfully selected or
 * not
 */
OSHMEM_DECLSPEC extern bool mca_sshmem_base_selected;

/**
 * Global component struct for the selected component
 */
OSHMEM_DECLSPEC extern const mca_sshmem_base_component_2_0_0_t
*mca_sshmem_base_component;

/**
 * Global module struct for the selected module
 */
OSHMEM_DECLSPEC extern const mca_sshmem_base_module_2_0_0_t
*mca_sshmem_base_module;

/**
 * Framework structure declaration
 */
OSHMEM_DECLSPEC extern mca_base_framework_t oshmem_sshmem_base_framework;

/* ******************************************************************** */
#ifdef __BASE_FILE__
#define __SSHMEM_FILE__ __BASE_FILE__
#else
#define __SSHMEM_FILE__ __FILE__
#endif

#if OPAL_ENABLE_DEBUG
#define SSHMEM_VERBOSE(level, ...) \
    oshmem_output_verbose(level, oshmem_sshmem_base_framework.framework_output, \
        "%s:%d - %s()", __SSHMEM_FILE__, __LINE__, __func__, __VA_ARGS__)
#else
#define SSHMEM_VERBOSE(level, ...)
#endif

#define SSHMEM_ERROR(...) \
    oshmem_output(oshmem_sshmem_base_framework.framework_output, \
        "Error %s:%d - %s()", __SSHMEM_FILE__, __LINE__, __func__, __VA_ARGS__)

#define SSHMEM_WARN(...) \
    oshmem_output_verbose(0, oshmem_sshmem_base_framework.framework_output, \
        "Warning %s:%d - %s()", __SSHMEM_FILE__, __LINE__, __func__, __VA_ARGS__)


OSHMEM_DECLSPEC extern void shmem_ds_reset(map_segment_t *ds_buf);

/*
 * Get unique file name
 */
OSHMEM_DECLSPEC extern char * oshmem_get_unique_file_name(uint64_t pe);

END_C_DECLS

#endif /* MCA_SSHMEM_BASE_H */