1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2016 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2006 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2017 Intel, Inc. All rights reserved
13 * $COPYRIGHT$
14 *
15 * Additional copyrights may follow
16 *
17 * $HEADER$
18 */
19
20 #ifndef PML_CM_REQUEST_H
21 #define PML_CM_REQUEST_H
22
23 #include "ompi/mca/pml/base/pml_base_sendreq.h"
24 #include "ompi/mca/pml/base/pml_base_bsend.h"
25 #include "ompi/mca/pml/pml.h"
26 #include "ompi/mca/mtl/mtl.h"
27
28 /**
29 * Type of request.
30 */
31 typedef enum {
32 MCA_PML_CM_REQUEST_SEND_HEAVY,
33 MCA_PML_CM_REQUEST_SEND_THIN,
34 MCA_PML_CM_REQUEST_RECV_HEAVY,
35 MCA_PML_CM_REQUEST_RECV_THIN,
36 MCA_PML_CM_REQUEST_NULL
37 } mca_pml_cm_request_type_t;
38
39 /**
40 * Base type for PML CM P2P requests
41 */
42 struct mca_pml_cm_request_t {
43
44 /* START: These fields have to match the definition of the mca_pml_base_request_t */
45 ompi_request_t req_ompi; /**< base request */
46 volatile int32_t req_pml_complete; /**< flag indicating if the pt-2-pt layer is done with this request */
47 volatile int32_t req_free_called; /**< flag indicating if the user has freed this request */
48 mca_pml_cm_request_type_t req_pml_type;
49 struct ompi_communicator_t *req_comm; /**< communicator pointer */
50 struct ompi_datatype_t *req_datatype; /**< pointer to data type */
51 opal_convertor_t req_convertor; /**< convertor that describes the memory layout */
52 /* END: These fields have to match the definition of the mca_pml_base_request_t */
53 };
54 typedef struct mca_pml_cm_request_t mca_pml_cm_request_t;
55 OBJ_CLASS_DECLARATION(mca_pml_cm_request_t);
56
57 /*
58 * Avoid CUDA convertor inits only for contiguous memory and if indicated by
59 * the MTL. For non-contiguous memory, do not skip CUDA convertor init phases.
60 */
61 #if OPAL_CUDA_SUPPORT
62 #define MCA_PML_CM_SWITCH_CUDA_CONVERTOR_OFF(flags, datatype, count) \
63 { \
64 if (opal_datatype_is_contiguous_memory_layout(&datatype->super, count) \
65 && (ompi_mtl->mtl_flags & MCA_MTL_BASE_FLAG_CUDA_INIT_DISABLE)) { \
66 flags |= CONVERTOR_SKIP_CUDA_INIT; \
67 } \
68 }
69 #else
70 #define MCA_PML_CM_SWITCH_CUDA_CONVERTOR_OFF(flags, datatype, count)
71 #endif
72
73 #endif