This source file includes following definitions.
- ompi_mtl_psm_send
- ompi_mtl_psm_isend
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include "ompi_config.h"
24 #include "ompi/mca/pml/pml.h"
25 #include "ompi/communicator/communicator.h"
26 #include "opal/datatype/opal_convertor.h"
27 #include "opal/util/show_help.h"
28
29 #include "mtl_psm.h"
30 #include "mtl_psm_types.h"
31 #include "mtl_psm_request.h"
32 #include "ompi/mca/mtl/base/mtl_base_datatype.h"
33
34 int
35 ompi_mtl_psm_send(struct mca_mtl_base_module_t* mtl,
36 struct ompi_communicator_t* comm,
37 int dest,
38 int tag,
39 struct opal_convertor_t *convertor,
40 mca_pml_base_send_mode_t mode)
41 {
42 psm_error_t err;
43 mca_mtl_psm_request_t mtl_psm_request;
44 uint64_t mqtag;
45 uint32_t flags = 0;
46 int ret;
47 size_t length;
48 ompi_proc_t* ompi_proc = ompi_comm_peer_lookup( comm, dest );
49 mca_mtl_psm_endpoint_t* psm_endpoint = ompi_mtl_psm_get_endpoint (mtl, ompi_proc);
50
51 assert(mtl == &ompi_mtl_psm.super);
52
53 mqtag = PSM_MAKE_MQTAG(comm->c_contextid, comm->c_my_rank, tag);
54
55 ret = ompi_mtl_datatype_pack(convertor,
56 &mtl_psm_request.buf,
57 &length,
58 &mtl_psm_request.free_after);
59
60 if (OMPI_SUCCESS != ret) return ret;
61
62 if (length >= 1ULL << sizeof(uint32_t) * 8) {
63 opal_show_help("help-mtl-psm.txt",
64 "message too big", false,
65 length, 1ULL << sizeof(uint32_t) * 8);
66 return OMPI_ERROR;
67 }
68
69 mtl_psm_request.length = length;
70 mtl_psm_request.convertor = convertor;
71 mtl_psm_request.type = OMPI_MTL_PSM_ISEND;
72
73 if (mode == MCA_PML_BASE_SEND_SYNCHRONOUS)
74 flags |= PSM_MQ_FLAG_SENDSYNC;
75
76 err = psm_mq_send(ompi_mtl_psm.mq,
77 psm_endpoint->peer_addr,
78 flags,
79 mqtag,
80 mtl_psm_request.buf,
81 length);
82
83 if (mtl_psm_request.free_after) {
84 free(mtl_psm_request.buf);
85 }
86
87 return err == PSM_OK ? OMPI_SUCCESS : OMPI_ERROR;
88 }
89
90 int
91 ompi_mtl_psm_isend(struct mca_mtl_base_module_t* mtl,
92 struct ompi_communicator_t* comm,
93 int dest,
94 int tag,
95 struct opal_convertor_t *convertor,
96 mca_pml_base_send_mode_t mode,
97 bool blocking,
98 mca_mtl_request_t * mtl_request)
99 {
100 psm_error_t psm_error;
101 uint64_t mqtag;
102 uint32_t flags = 0;
103 int ret;
104 mca_mtl_psm_request_t * mtl_psm_request = (mca_mtl_psm_request_t*) mtl_request;
105 size_t length;
106 ompi_proc_t* ompi_proc = ompi_comm_peer_lookup( comm, dest );
107 mca_mtl_psm_endpoint_t* psm_endpoint = ompi_mtl_psm_get_endpoint (mtl, ompi_proc);
108
109 assert(mtl == &ompi_mtl_psm.super);
110
111 mqtag = PSM_MAKE_MQTAG(comm->c_contextid, comm->c_my_rank, tag);
112
113
114 ret = ompi_mtl_datatype_pack(convertor,
115 &mtl_psm_request->buf,
116 &length,
117 &mtl_psm_request->free_after);
118
119
120 if (OMPI_SUCCESS != ret) return ret;
121
122 if (length >= 1ULL << sizeof(uint32_t) * 8) {
123 opal_show_help("help-mtl-psm.txt",
124 "message too big", false,
125 length, 1ULL << sizeof(uint32_t) * 8);
126 return OMPI_ERROR;
127 }
128
129 mtl_psm_request->length= length;
130 mtl_psm_request->convertor = convertor;
131 mtl_psm_request->type = OMPI_MTL_PSM_ISEND;
132
133 if (mode == MCA_PML_BASE_SEND_SYNCHRONOUS)
134 flags |= PSM_MQ_FLAG_SENDSYNC;
135
136 psm_error = psm_mq_isend(ompi_mtl_psm.mq,
137 psm_endpoint->peer_addr,
138 flags,
139 mqtag,
140 mtl_psm_request->buf,
141 length,
142 mtl_psm_request,
143 &mtl_psm_request->psm_request);
144
145 return psm_error == PSM_OK ? OMPI_SUCCESS : OMPI_ERROR;
146 }