|
| 1 | +/** |
| 2 | + Copyright (c) 2021 Mellanox Technologies. All rights reserved. |
| 3 | + $COPYRIGHT$ |
| 4 | +
|
| 5 | + Additional copyrights may follow |
| 6 | +
|
| 7 | + $HEADER$ |
| 8 | + */ |
| 9 | + |
| 10 | +#ifndef MCA_COLL_UCC_H |
| 11 | +#define MCA_COLL_UCC_H |
| 12 | + |
| 13 | +#include "ompi_config.h" |
| 14 | +#include "mpi.h" |
| 15 | +#include "ompi/mca/mca.h" |
| 16 | +#include "opal/memoryhooks/memory.h" |
| 17 | +#include "opal/mca/memory/base/base.h" |
| 18 | +#include "ompi/mca/coll/coll.h" |
| 19 | +#include "ompi/communicator/communicator.h" |
| 20 | +#include "ompi/attribute/attribute.h" |
| 21 | +#include "ompi/op/op.h" |
| 22 | +#include "coll_ucc_debug.h" |
| 23 | +#include <ucc/api/ucc.h> |
| 24 | + |
| 25 | +BEGIN_C_DECLS |
| 26 | + |
| 27 | +#define COLL_UCC_CTS (UCC_COLL_TYPE_BARRIER | UCC_COLL_TYPE_BCAST | \ |
| 28 | + UCC_COLL_TYPE_ALLREDUCE | UCC_COLL_TYPE_ALLTOALL | \ |
| 29 | + UCC_COLL_TYPE_ALLTOALLV) |
| 30 | + |
| 31 | +#define COLL_UCC_CTS_STR "barrier,bcast,allreduce,alltoall,alltoallv," \ |
| 32 | + "ibarrier,ibcast,iallreduce,ialltoall,ialltoallv" |
| 33 | + |
| 34 | +typedef struct mca_coll_ucc_req { |
| 35 | + ompi_request_t super; |
| 36 | + ucc_coll_req_h ucc_req; |
| 37 | +} mca_coll_ucc_req_t; |
| 38 | +OBJ_CLASS_DECLARATION(mca_coll_ucc_req_t); |
| 39 | + |
| 40 | +struct mca_coll_ucc_component_t { |
| 41 | + mca_coll_base_component_2_4_0_t super; |
| 42 | + int ucc_priority; |
| 43 | + int ucc_verbose; |
| 44 | + int ucc_enable; |
| 45 | + int ucc_np; |
| 46 | + char *cls; |
| 47 | + char *cts; |
| 48 | + const char *compiletime_version; |
| 49 | + const char *runtime_version; |
| 50 | + bool libucc_initialized; |
| 51 | + ucc_lib_h ucc_lib; |
| 52 | + ucc_lib_attr_t ucc_lib_attr; |
| 53 | + ucc_coll_type_t cts_requested; |
| 54 | + ucc_coll_type_t nb_cts_requested; |
| 55 | + ucc_context_h ucc_context; |
| 56 | + opal_free_list_t requests; |
| 57 | +}; |
| 58 | +typedef struct mca_coll_ucc_component_t mca_coll_ucc_component_t; |
| 59 | + |
| 60 | +OMPI_MODULE_DECLSPEC extern mca_coll_ucc_component_t mca_coll_ucc_component; |
| 61 | + |
| 62 | +/** |
| 63 | + * UCC enabled communicator |
| 64 | + */ |
| 65 | +struct mca_coll_ucc_module_t { |
| 66 | + mca_coll_base_module_t super; |
| 67 | + ompi_communicator_t* comm; |
| 68 | + int rank; |
| 69 | + ucc_team_h ucc_team; |
| 70 | + mca_coll_base_module_allreduce_fn_t previous_allreduce; |
| 71 | + mca_coll_base_module_t* previous_allreduce_module; |
| 72 | + mca_coll_base_module_iallreduce_fn_t previous_iallreduce; |
| 73 | + mca_coll_base_module_t* previous_iallreduce_module; |
| 74 | + mca_coll_base_module_barrier_fn_t previous_barrier; |
| 75 | + mca_coll_base_module_t* previous_barrier_module; |
| 76 | + mca_coll_base_module_ibarrier_fn_t previous_ibarrier; |
| 77 | + mca_coll_base_module_t* previous_ibarrier_module; |
| 78 | + mca_coll_base_module_bcast_fn_t previous_bcast; |
| 79 | + mca_coll_base_module_t* previous_bcast_module; |
| 80 | + mca_coll_base_module_ibcast_fn_t previous_ibcast; |
| 81 | + mca_coll_base_module_t* previous_ibcast_module; |
| 82 | + mca_coll_base_module_alltoall_fn_t previous_alltoall; |
| 83 | + mca_coll_base_module_t* previous_alltoall_module; |
| 84 | + mca_coll_base_module_ialltoall_fn_t previous_ialltoall; |
| 85 | + mca_coll_base_module_t* previous_ialltoall_module; |
| 86 | + mca_coll_base_module_alltoallv_fn_t previous_alltoallv; |
| 87 | + mca_coll_base_module_t* previous_alltoallv_module; |
| 88 | + mca_coll_base_module_ialltoallv_fn_t previous_ialltoallv; |
| 89 | + mca_coll_base_module_t* previous_ialltoallv_module; |
| 90 | +}; |
| 91 | +typedef struct mca_coll_ucc_module_t mca_coll_ucc_module_t; |
| 92 | +OBJ_CLASS_DECLARATION(mca_coll_ucc_module_t); |
| 93 | + |
| 94 | +int mca_coll_ucc_init_query(bool enable_progress_threads, bool enable_mpi_threads); |
| 95 | +mca_coll_base_module_t *mca_coll_ucc_comm_query(struct ompi_communicator_t *comm, int *priority); |
| 96 | + |
| 97 | +int mca_coll_ucc_allreduce(const void *sbuf, void *rbuf, int count, |
| 98 | + struct ompi_datatype_t *dtype, struct ompi_op_t *op, |
| 99 | + struct ompi_communicator_t *comm, |
| 100 | + mca_coll_base_module_t *module); |
| 101 | + |
| 102 | +int mca_coll_ucc_iallreduce(const void *sbuf, void *rbuf, int count, |
| 103 | + struct ompi_datatype_t *dtype, struct ompi_op_t *op, |
| 104 | + struct ompi_communicator_t *comm, |
| 105 | + ompi_request_t** request, |
| 106 | + mca_coll_base_module_t *module); |
| 107 | + |
| 108 | +int mca_coll_ucc_barrier(struct ompi_communicator_t *comm, |
| 109 | + mca_coll_base_module_t *module); |
| 110 | + |
| 111 | +int mca_coll_ucc_ibarrier(struct ompi_communicator_t *comm, |
| 112 | + ompi_request_t** request, |
| 113 | + mca_coll_base_module_t *module); |
| 114 | + |
| 115 | +int mca_coll_ucc_bcast(void *buf, int count, struct ompi_datatype_t *dtype, |
| 116 | + int root, struct ompi_communicator_t *comm, |
| 117 | + mca_coll_base_module_t *module); |
| 118 | + |
| 119 | +int mca_coll_ucc_ibcast(void *buf, int count, struct ompi_datatype_t *dtype, |
| 120 | + int root, struct ompi_communicator_t *comm, |
| 121 | + ompi_request_t** request, |
| 122 | + mca_coll_base_module_t *module); |
| 123 | + |
| 124 | +int mca_coll_ucc_alltoall(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, |
| 125 | + void* rbuf, int rcount, struct ompi_datatype_t *rdtype, |
| 126 | + struct ompi_communicator_t *comm, |
| 127 | + mca_coll_base_module_t *module); |
| 128 | + |
| 129 | +int mca_coll_ucc_ialltoall(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, |
| 130 | + void* rbuf, int rcount, struct ompi_datatype_t *rdtype, |
| 131 | + struct ompi_communicator_t *comm, |
| 132 | + ompi_request_t** request, |
| 133 | + mca_coll_base_module_t *module); |
| 134 | + |
| 135 | +int mca_coll_ucc_alltoallv(const void *sbuf, const int *scounts, const int *sdips, |
| 136 | + struct ompi_datatype_t *sdtype, |
| 137 | + void* rbuf, const int *rcounts, const int *rdisps, |
| 138 | + struct ompi_datatype_t *rdtype, |
| 139 | + struct ompi_communicator_t *comm, |
| 140 | + mca_coll_base_module_t *module); |
| 141 | + |
| 142 | +int mca_coll_ucc_ialltoallv(const void *sbuf, const int *scounts, const int *sdips, |
| 143 | + struct ompi_datatype_t *sdtype, |
| 144 | + void* rbuf, const int *rcounts, const int *rdisps, |
| 145 | + struct ompi_datatype_t *rdtype, |
| 146 | + struct ompi_communicator_t *comm, |
| 147 | + ompi_request_t** request, |
| 148 | + mca_coll_base_module_t *module); |
| 149 | +END_C_DECLS |
| 150 | +#endif |
0 commit comments