1
1
openmpi/ompi/mca/coll/adapt/coll_adapt_context.h
Xi Luo e65fa4ff5c Bring ADAPT collective to 4.1
This is a meta commit, that encapsulate all the ADAPT commits in the master
into a single PR for 4.1. The master commits included here are:
fe73586, a4be3bb, d712645, c2970a3, e59bde9, ee592f3 and c98e387.

Here is a detailed list of added capabilities:
* coll/adapt: Fix naming conventions and C11 atomic use
* coll/adapt: Remove unused component field in module
* Consistent handling of zero counts in the MPI API.
* Correctly handle non-blocking collectives tags
  * As it is possible to have multiple outstanding non-blocking collectives
    provided by different collective modules, we need a consistent
    mechanism to allow them to select unique tags for each instance of a
    collective.
* Add support for fallback to previous coll module on non-commutative operations (#30)
* Replace mutexes by atomic operations.
* Use the correct nbc request type (for both ibcast and ireduce)
  * coll/base: document type casts in ompi_coll_base_retain_*
* add module-wide topology cache
* use standard instead of synchronous send and add mca parameter to control mode of initial send in ireduce/ibcast
* reduce number of memory allocations
* call the default request completion.
  * Remove the requests from the Fortran lookup conversion tables before completing
    and free it.
* piggybacking Bull functionalities

Signed-off-by: Xi Luo <xluo12@vols.utk.edu>
Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
Signed-off-by: Marc Sergent <marc.sergent@atos.net>
Co-authored-by: Joseph Schuchart <schuchart@hlrs.de>
Co-authored-by: Lemarinier, Pierre <pierre.lemarinier@atos.net>
Co-authored-by: pierrele <31764860+pierrele@users.noreply.github.com>
2020-09-23 11:45:45 -04:00

129 строки
3.8 KiB
C

/*
* Copyright (c) 2014-2020 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi/mca/coll/coll.h"
#include "opal/class/opal_free_list.h"
#include "opal/class/opal_list.h"
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/communicator/communicator.h"
#include "ompi/op/op.h"
#include "ompi/mca/coll/base/coll_base_topo.h"
#include "coll_adapt_inbuf.h"
/* Bcast constant context in bcast context */
struct ompi_coll_adapt_constant_bcast_context_s {
opal_object_t super;
int root;
size_t count;
size_t seg_count;
ompi_datatype_t *datatype;
ompi_communicator_t *comm;
int real_seg_size;
int num_segs;
ompi_request_t *request;
opal_mutex_t *mutex;
int *recv_array;
int *send_array;
/* Length of the fragment array, which is the number of recevied segments */
int num_recv_segs;
/* Number of segments that is finishing recving */
int num_recv_fini;
/* Store the number of sent segments */
int num_sent_segs;
ompi_coll_tree_t *tree;
int ibcast_tag;
};
typedef struct ompi_coll_adapt_constant_bcast_context_s ompi_coll_adapt_constant_bcast_context_t;
OBJ_CLASS_DECLARATION(ompi_coll_adapt_constant_bcast_context_t);
/* Bcast context of each segment*/
typedef struct ompi_coll_adapt_bcast_context_s ompi_coll_adapt_bcast_context_t;
typedef int (*ompi_coll_adapt_bcast_cuda_callback_fn_t) (ompi_coll_adapt_bcast_context_t * context);
struct ompi_coll_adapt_bcast_context_s {
opal_free_list_item_t super;
char *buff;
int frag_id;
int child_id;
int peer;
ompi_coll_adapt_constant_bcast_context_t *con;
};
OBJ_CLASS_DECLARATION(ompi_coll_adapt_bcast_context_t);
/* Reduce constant context in reduce context */
struct ompi_coll_adapt_constant_reduce_context_s {
opal_object_t super;
size_t count;
size_t seg_count;
ompi_datatype_t *datatype;
ompi_communicator_t *comm;
size_t real_seg_size;
/* Increment of each segment */
int segment_increment;
int num_segs;
int rank;
int root;
/* The distance between the address of inbuf->buff and the address of inbuf */
int distance;
int ireduce_tag;
/* How many sends are posted but not finished */
int32_t ongoing_send;
/* Length of the fragment array, which is the number of recevied segments */
int32_t num_recv_segs;
/* Number of sent segments */
int32_t num_sent_segs;
/* Next seg need to be received for every children */
int32_t *next_recv_segs;
/* Mutex to protect each segment when do the reduce op */
opal_mutex_t *mutex_op_list;
/* Reduce operation */
ompi_op_t *op;
ompi_coll_tree_t *tree;
/* Accumulate buff */
char **accumbuf;
ptrdiff_t lower_bound;
char *sbuf;
char *rbuf;
opal_free_list_t inbuf_list;
/* Mutex to protect recv_list */
opal_mutex_t mutex_recv_list;
/* A list to store the segments which are received and not yet be sent */
opal_list_t recv_list;
ompi_request_t *request;
};
typedef struct ompi_coll_adapt_constant_reduce_context_s ompi_coll_adapt_constant_reduce_context_t;
OBJ_CLASS_DECLARATION(ompi_coll_adapt_constant_reduce_context_t);
/* Reduce context of each segment */
typedef struct ompi_coll_adapt_reduce_context_s ompi_coll_adapt_reduce_context_t;
typedef int (*ompi_coll_adapt_reduce_cuda_callback_fn_t) (ompi_coll_adapt_reduce_context_t * context);
struct ompi_coll_adapt_reduce_context_s {
opal_free_list_item_t super;
char *buff;
int seg_index;
int child_id;
int peer;
ompi_coll_adapt_constant_reduce_context_t *con;
/* store the incoming segment */
ompi_coll_adapt_inbuf_t *inbuf;
};
OBJ_CLASS_DECLARATION(ompi_coll_adapt_reduce_context_t);