File: scoll.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 (208 lines) | stat: -rw-r--r-- 8,658 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2013      Mellanox Technologies, Inc.
 *                         All rights reserved.
 * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
 *                         reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

/**
 * @file
 *
 * Collective Communication Interface
 *
 */

#ifndef OSHMEM_MCA_SCOLL_H
#define OSHMEM_MCA_SCOLL_H

#include "oshmem_config.h"
#include "oshmem/types.h"
#include "oshmem/constants.h"

#include "opal/util/output.h"
#include "mpi.h"
#include "oshmem/mca/mca.h"
#include "opal/mca/base/base.h"

BEGIN_C_DECLS

/* ******************************************************************** */

struct oshmem_group_t;
struct oshmem_op_t;

/* ******************************************************************** */

typedef int (*mca_scoll_base_component_init_fn_t)(bool enable_progress_threads,
                                                  bool enable_threads);

typedef struct mca_scoll_base_module_1_0_0_t* (*mca_scoll_base_component_query_fn_t)(struct oshmem_group_t *group,
                                                                                     int *priority);

/* ******************************************************************** */

/**
 * Collective component interface
 *
 * Component interface for the collective framework.  A public
 * instance of this structure, called
 * mca_scoll_[component_name]_component, must exist in any collective
 * component.
 */
struct mca_scoll_base_component_1_0_0_t {
    /** Base component description */
    mca_base_component_t scoll_version;
    /** Base component data block */
    mca_base_component_data_t scoll_data;

    /** Component initialization function */
    mca_scoll_base_component_init_fn_t scoll_init;
    mca_scoll_base_component_query_fn_t scoll_query;
};
typedef struct mca_scoll_base_component_1_0_0_t mca_scoll_base_component_1_0_0_t;

/** Per guidance in mca.h, use the unversioned struct name if you just
 want to always keep up with the most recent version of the
 interface. */
typedef struct mca_scoll_base_component_1_0_0_t mca_scoll_base_component_t;

/**
 * Collective module interface
 *
 * Module interface to the Collective framework.  Modules are
 * reference counted based on the number of functions from the module
 * used on the commuicator.  There is at most one module per component
 * on a given communicator, and there can be many component modules on
 * a given communicator.
 *
 * @note The collective framework and the
 * communicator functionality only stores a pointer to the module
 * function, so the component is free to create a structure that
 * inherits from this one for use as the module structure.
 */
typedef int
(*mca_scoll_base_module_enable_1_0_0_fn_t)(struct mca_scoll_base_module_1_0_0_t* module,
                                           struct oshmem_group_t *comm);

#define SCOLL_DEFAULT_ALG   (-1)

#define SCOLL_ALG_BARRIER_CENTRAL_COUNTER       0
#define SCOLL_ALG_BARRIER_TOURNAMENT            1
#define SCOLL_ALG_BARRIER_RECURSIVE_DOUBLING    2
#define SCOLL_ALG_BARRIER_DISSEMINATION         3
#define SCOLL_ALG_BARRIER_BASIC                 4
#define SCOLL_ALG_BARRIER_ADAPTIVE              5

#define SCOLL_ALG_BROADCAST_CENTRAL_COUNTER     0
#define SCOLL_ALG_BROADCAST_BINOMIAL            1

#define SCOLL_ALG_COLLECT_CENTRAL_COUNTER       0
#define SCOLL_ALG_COLLECT_TOURNAMENT            1
#define SCOLL_ALG_COLLECT_RECURSIVE_DOUBLING    2
#define SCOLL_ALG_COLLECT_RING                  3

#define SCOLL_ALG_REDUCE_CENTRAL_COUNTER        0
#define SCOLL_ALG_REDUCE_TOURNAMENT             1
#define SCOLL_ALG_REDUCE_RECURSIVE_DOUBLING     2
#define SCOLL_ALG_REDUCE_LEGACY_LINEAR          3   /* Based linear algorithm from OMPI coll:basic */
#define SCOLL_ALG_REDUCE_LEGACY_LOG             4   /* Based log algorithm from OMPI coll:basic */

typedef int (*mca_scoll_base_module_barrier_fn_t)(struct oshmem_group_t *group,
                                                  long *pSync,
                                                  int alg);
typedef int (*mca_scoll_base_module_broadcast_fn_t)(struct oshmem_group_t *group,
                                                    int PE_root,
                                                    void *target,
                                                    const void *source,
                                                    size_t nlong,
                                                    long *pSync,
                                                    bool nlong_type,
                                                    int alg);
typedef int (*mca_scoll_base_module_collect_fn_t)(struct oshmem_group_t *group,
                                                  void *target,
                                                  const void *source,
                                                  size_t nlong,
                                                  long *pSync,
                                                  bool nlong_type,
                                                  int alg);
typedef int (*mca_scoll_base_module_reduce_fn_t)(struct oshmem_group_t *group,
                                                 struct oshmem_op_t *op,
                                                 void *target,
                                                 const void *source,
                                                 size_t nlong,
                                                 long *pSync,
                                                 void *pWrk,
                                                 int alg);
typedef int (*mca_scoll_base_module_alltoall_fn_t)(struct oshmem_group_t *group,
                                                  void *target,
                                                  const void *source,
                                                  ptrdiff_t dst, ptrdiff_t sst,
                                                  size_t nelems,
                                                  size_t element_size,
                                                  long *pSync,
                                                  int alg);

struct mca_scoll_base_module_1_0_0_t {
    /** Collective modules all inherit from opal_object */
    opal_object_t super;

    /* Collective function pointers */
    mca_scoll_base_module_barrier_fn_t scoll_barrier;
    mca_scoll_base_module_broadcast_fn_t scoll_broadcast;
    mca_scoll_base_module_collect_fn_t scoll_collect;
    mca_scoll_base_module_reduce_fn_t scoll_reduce;
    mca_scoll_base_module_alltoall_fn_t scoll_alltoall;
    mca_scoll_base_module_enable_1_0_0_fn_t scoll_module_enable;
};
typedef struct mca_scoll_base_module_1_0_0_t mca_scoll_base_module_1_0_0_t;

/** Per guidance in mca.h, use the unversioned struct name if you just
 want to always keep up with the most recent version of the
 interface. */
typedef struct mca_scoll_base_module_1_0_0_t mca_scoll_base_module_t;
OSHMEM_DECLSPEC OBJ_CLASS_DECLARATION(mca_scoll_base_module_t);

/* ******************************************************************** */

/*
 * Macro for use in components that are of type coll
 */
#define MCA_SCOLL_BASE_VERSION_2_0_0 \
    OSHMEM_MCA_BASE_VERSION_2_1_0("scoll", 1, 0, 0)

/* ******************************************************************** */
/*
 * Collectives group cache structure
 *
 * Collectives group cache structure, used to find functions to
 * implement collective algorithms and their associated modules.
 */
struct mca_scoll_base_group_scoll_t {
    mca_scoll_base_module_barrier_fn_t scoll_barrier;
    mca_scoll_base_module_1_0_0_t *scoll_barrier_module;
    mca_scoll_base_module_broadcast_fn_t scoll_broadcast;
    mca_scoll_base_module_1_0_0_t *scoll_broadcast_module;
    mca_scoll_base_module_collect_fn_t scoll_collect;
    mca_scoll_base_module_1_0_0_t *scoll_collect_module;
    mca_scoll_base_module_reduce_fn_t scoll_reduce;
    mca_scoll_base_module_1_0_0_t *scoll_reduce_module;
    mca_scoll_base_module_alltoall_fn_t scoll_alltoall;
    mca_scoll_base_module_1_0_0_t *scoll_alltoall_module;
};
typedef struct mca_scoll_base_group_scoll_t mca_scoll_base_group_scoll_t;

#define PREVIOUS_SCOLL_FN(module, __api, group, ...) do { \
    group->g_scoll.scoll_ ## __api ## _module = (mca_scoll_base_module_1_0_0_t*) module->previous_ ## __api ## _module; \
    rc = module->previous_ ## __api (group, __VA_ARGS__); \
    group->g_scoll.scoll_ ## __api ## _module = (mca_scoll_base_module_1_0_0_t*) module; \
} while(0)

END_C_DECLS

#endif /* OSHMEM_MCA_SCOLL_H */