OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

coll_fca_api.h
1 /**
2 Copyright (c) 2011 Mellanox Technologies. All rights reserved.
3 $COPYRIGHT$
4
5 Additional copyrights may follow
6
7 $HEADER$
8 */
9
10 #include "ompi_config.h"
11
12 #include <fca_api.h>
13
14 #ifndef FCA_API
15 #define OMPI_FCA_VERSION 12
16 #else
17 #define OMPI_FCA_VERSION FCA_API
18 #endif
19
20 /*
21 * FCA API compatibility layer.
22 * MPI build must define an FCA version macro.
23 */
24
25 #define OMPI_FCA_BARRIER 1
26 #define OMPI_FCA_BCAST 1
27 #define OMPI_FCA_REDUCE 1
28 #define OMPI_FCA_ALLREDUCE 1
29
30 #define OMPI_FCA_REDUCE_SCATTER 0
31 #define OMPI_FCA_GATHER 0
32 #define OMPI_FCA_GATHERV 0
33 #define OMPI_FCA_ALLTOALL 0
34 #define OMPI_FCA_ALLTOALLV 0
35 #define OMPI_FCA_ALLTOALLW 0
36
37
38 #if OMPI_FCA_VERSION == 12
39
40 #define OMPI_FCA_ALLGATHER 0
41
42 #define FCA_API_ABI_MAJOR 1
43 #define FCA_API_ABI_MINOR 2
44 #define FCA_MAJOR_BIT 24ul
45 #define FCA_MINOR_BIT 16ul
46 #define EUSEMPI 287
47
48
49 typedef struct mca_coll_fca_ops_t {
50
51 /* FCA Context operations */
52 int (*init)(fca_init_spec_t *spec, fca_t **context);
53 void (*cleanup)(fca_t *context);
54
55 /* Fabric communicator creation */
56 int (*comm_new)(fca_t *context, fca_comm_new_spec_t *spec, fca_comm_desc_t *comm_desc);
57 int (*comm_end)(fca_t *context, int comm_id);
58 void* (*get_rank_info)(fca_t *context, int *size);
59 void (*free_rank_info)(void *rank_info);
60
61 /* Local communicator creation */
62 int (*comm_init)(fca_t *context, int proc_idx, int num_procs, int comm_size,
63 fca_comm_desc_t *comm_desc, fca_comm_t** fca_comm);
64 void (*comm_destroy)(fca_comm_t *comm);
65 int (*comm_get_caps)(fca_comm_t *comm, fca_comm_caps_t *caps);
66
67 /* Collectives supported by FCA */
68 int (*do_reduce)(fca_comm_t *comm, fca_reduce_spec_t *spec);
69 int (*do_all_reduce)(fca_comm_t *comm, fca_reduce_spec_t *spec);
70 int (*do_bcast)(fca_comm_t *comm, fca_bcast_spec_t *spec);
71 int (*do_barrier)(fca_comm_t *comm);
72
73 /* Helper functions */
74 unsigned long (*get_version)(void);
75 char * (*get_version_string)(void);
76 fca_init_spec_t *(*parse_spec_file)(char* spec_ini_file);
77 void (*free_init_spec)(fca_init_spec_t *fca_init_spec);
78 int (*translate_mpi_op)(char *mpi_op);
79 int (*translate_mpi_dtype)(char *mpi_dtype);
80 int (*get_dtype_size)(int dtype);
81 const char* (*strerror)(int code);
82 } mca_coll_fca_ops_t;
83
84
85 static inline int mca_coll_fca_comm_init(mca_coll_fca_ops_t *fca_ops,
86 fca_t *fca_context, int rank, int comm_size,
87 int local_proc_idx, int num_local_procs,
88 fca_comm_desc_t *comm_desc,
89 fca_comm_t **fca_comm)
90 {
91 return fca_ops->comm_init(fca_context, local_proc_idx, num_local_procs,
92 comm_size, comm_desc, fca_comm);
93 }
94
95 static inline void mca_coll_fca_get_bcast_root(int root_rank, int *local_ranks,
96 int num_local_ranks,
97 fca_bcast_spec_t *spec)
98 {
99 int i;
100
101 for (i = 0; i < num_local_ranks; ++i) {
102 if (local_ranks[i] == root_rank) {
103 spec->root_indx = i;
104 return;
105 }
106 }
107 spec->root_indx = -1;
108 }
109
110 static inline void mca_coll_fca_get_reduce_root(int root_rank, int my_rank,
111 fca_reduce_spec_t *spec)
112 {
113 spec->is_root = root_rank == my_rank;
114 }
115
116 #elif OMPI_FCA_VERSION == 20 || OMPI_FCA_VERSION == 21 || OMPI_FCA_VERSION == 22
117
118 #define OMPI_FCA_ALLGATHER 1
119 #define OMPI_FCA_ALLGATHERV 1
120 #define OMPI_FCA_PROGRESS 1
121
122 typedef struct mca_coll_fca_ops_t {
123
124 /* FCA Context operations */
125 int (*init)(fca_init_spec_t *spec, fca_t **context);
126 void (*cleanup)(fca_t *context);
127 void (*progress)(fca_t *context);
128
129 /* Fabric communicator creation */
130 int (*comm_new)(fca_t *context, fca_comm_new_spec_t *spec, fca_comm_desc_t *comm_desc);
131 int (*comm_end)(fca_t *context, int comm_id);
132 void* (*get_rank_info)(fca_t *context, int *size);
133 void (*free_rank_info)(void *rank_info);
134
135 /* Local communicator creation */
136 int (*comm_init)(fca_t *context, fca_comm_init_spec_t *spec, fca_comm_t** fca_comm);
137 void (*comm_destroy)(fca_comm_t *comm);
138 int (*comm_get_caps)(fca_comm_t *comm, fca_comm_caps_t *caps);
139
140 /* Collectives supported by FCA */
141 int (*do_reduce)(fca_comm_t *comm, fca_reduce_spec_t *spec);
142 int (*do_all_reduce)(fca_comm_t *comm, fca_reduce_spec_t *spec);
143 int (*do_bcast)(fca_comm_t *comm, fca_bcast_spec_t *spec);
144 int (*do_barrier)(fca_comm_t *comm);
145 int (*do_allgather)(fca_comm_t *comm, fca_gather_spec_t *spec);
146 int (*do_allgatherv)(fca_comm_t *comm, fca_gatherv_spec_t *spec);
147
148 /* Helper functions */
149 unsigned long (*get_version)(void);
150 char * (*get_version_string)(void);
151 fca_init_spec_t *(*parse_spec_file)(char* spec_ini_file);
152 void (*free_init_spec)(fca_init_spec_t *fca_init_spec);
153 int (*translate_mpi_op)(char *mpi_op);
154 int (*translate_mpi_dtype)(char *mpi_dtype);
155 int (*get_dtype_size)(int dtype);
156 const char* (*strerror)(int code);
157 } mca_coll_fca_ops_t;
158
159
160 static inline int mca_coll_fca_comm_init(mca_coll_fca_ops_t *fca_ops,
161 fca_t *fca_context, int rank, int comm_size,
162 int local_proc_idx, int num_local_procs,
163 fca_comm_desc_t *comm_desc,
164 fca_comm_t **fca_comm)
165 {
166 fca_comm_init_spec_t spec;
167
168 spec.rank = rank;
169 spec.size = comm_size;
170 spec.desc = *comm_desc;
171 spec.proc_idx = local_proc_idx;
172 spec.num_procs = num_local_procs;
173 return fca_ops->comm_init(fca_context, &spec, fca_comm);
174 }
175
176 static inline void mca_coll_fca_get_bcast_root(int root_rank, int *local_ranks,
177 int num_local_ranks,
178 fca_bcast_spec_t *spec)
179 {
180 spec->root = root_rank;
181 }
182
183 static inline void mca_coll_fca_get_reduce_root(int root_rank, int my_rank,
184 fca_reduce_spec_t *spec)
185 {
186 spec->root = root_rank;
187 }
188
189 #else
190
191 #error "FCA API version is unsupported"
192
193 #endif
mca_coll_fca_ops_t
Definition: coll_fca_api.h:49