File: coll_fca_api.h

package info (click to toggle)
openmpi 4.1.0-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 126,560 kB
  • sloc: ansic: 685,465; makefile: 42,952; f90: 19,220; sh: 7,002; java: 6,360; perl: 3,524; cpp: 2,227; python: 1,350; lex: 989; fortran: 61; tcl: 12
file content (117 lines) | stat: -rw-r--r-- 3,216 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
111
112
113
114
115
116
117
/**
  Copyright (c) 2011      Mellanox Technologies. All rights reserved.
  Copyright (c) 2015      Research Organization for Information Science
                          and Technology (RIST). All rights reserved.
  $COPYRIGHT$

  Additional copyrights may follow

  $HEADER$
 */

#include "ompi_config.h"

#include <fca/fca_api.h>
#include <fca/config/fca_parse_specfile.h>

#ifndef FCA_API
#define OMPI_FCA_VERSION 12
#else
#define OMPI_FCA_VERSION FCA_API
#endif

/*
 * FCA API compatibility layer.
 * MPI build must define an FCA version macro.
 */

#define OMPI_FCA_BARRIER            1
#define OMPI_FCA_BCAST              1
#define OMPI_FCA_REDUCE             1
#define OMPI_FCA_ALLREDUCE          1

#define OMPI_FCA_REDUCE_SCATTER     0
#define OMPI_FCA_GATHER             0
#define OMPI_FCA_GATHERV            0
#define OMPI_FCA_ALLTOALL           0
#define OMPI_FCA_ALLTOALLV          0
#define OMPI_FCA_ALLTOALLW          0


#if OMPI_FCA_VERSION == 12

#define OMPI_FCA_ALLGATHER          0

#define FCA_API_ABI_MAJOR           1
#define FCA_API_ABI_MINOR           2
#define FCA_MAJOR_BIT               24ul
#define FCA_MINOR_BIT               16ul
#define EUSEMPI                     287

static inline void mca_coll_fca_get_bcast_root(int root_rank, int *local_ranks,
                                               int num_local_ranks,
                                               fca_bcast_spec_t *spec)
{
    int i;

    for (i = 0; i < num_local_ranks; ++i) {
        if (local_ranks[i] == root_rank) {
            spec->root_indx = i;
            return;
        }
    }
    spec->root_indx = -1;
}

static inline void mca_coll_fca_get_reduce_root(int root_rank, int my_rank,
                                                fca_reduce_spec_t *spec)
{
    spec->is_root = root_rank == my_rank;
}

#elif OMPI_FCA_VERSION >= 20

#define OMPI_FCA_ALLGATHER          1
#define OMPI_FCA_ALLGATHERV         1
#define OMPI_FCA_PROGRESS           1

static inline int mca_coll_fca_comm_init(fca_t *fca_context, int rank, int comm_size,
                                         int local_proc_idx, int num_local_procs,
                                         fca_comm_desc_t *comm_desc,
                                         fca_comm_t **fca_comm
#if OMPI_FCA_VERSION >= 30
                                         ,   void *comm_init_data
#endif
                                         )
{
    fca_comm_init_spec_t spec;

    spec.rank = rank;
    spec.size = comm_size;
    spec.desc = *comm_desc;
    spec.proc_idx = local_proc_idx;
    spec.num_procs = num_local_procs;
#if OMPI_FCA_VERSION >= 30
    spec.comm_init_data = comm_init_data;
#endif
    return fca_comm_init(fca_context, &spec, fca_comm);
}

static inline void mca_coll_fca_get_bcast_root(int root_rank, int *local_ranks,
                                               int num_local_ranks,
                                               fca_bcast_spec_t *spec)
{
    spec->root = root_rank;
}

static inline void mca_coll_fca_get_reduce_root(int root_rank, int my_rank,
                                                fca_reduce_spec_t *spec)
{
    spec->root = root_rank;
}

#else

#error "FCA API version is unsupported"

#endif