This source file includes following definitions.
- ompi_mtl_psm2_irecv
- ompi_mtl_psm2_imrecv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "ompi_config.h"
23 #include "ompi/communicator/communicator.h"
24 #include "ompi/message/message.h"
25 #include "opal/datatype/opal_convertor.h"
26 #include "ompi/mca/mtl/base/mtl_base_datatype.h"
27 #include "opal/util/show_help.h"
28
29 #include "mtl_psm2.h"
30 #include "mtl_psm2_types.h"
31 #include "mtl_psm2_request.h"
32
33 int
34 ompi_mtl_psm2_irecv(struct mca_mtl_base_module_t* mtl,
35 struct ompi_communicator_t *comm,
36 int src,
37 int tag,
38 struct opal_convertor_t *convertor,
39 struct mca_mtl_request_t *mtl_request)
40 {
41 int ret;
42 psm2_error_t err;
43 mca_mtl_psm2_request_t * mtl_psm2_request = (mca_mtl_psm2_request_t*) mtl_request;
44 psm2_mq_tag_t mqtag;
45 psm2_mq_tag_t tagsel;
46 size_t length;
47
48 ret = ompi_mtl_datatype_recv_buf(convertor,
49 &mtl_psm2_request->buf,
50 &length,
51 &mtl_psm2_request->free_after);
52
53 if (OMPI_SUCCESS != ret) return ret;
54
55 if (length >= 1ULL << sizeof(uint32_t) * 8) {
56 opal_show_help("help-mtl-psm2.txt",
57 "message too big", false,
58 length, 1ULL << sizeof(uint32_t) * 8);
59 return OMPI_ERROR;
60 }
61
62 mtl_psm2_request->length = length;
63 mtl_psm2_request->convertor = convertor;
64 mtl_psm2_request->type = OMPI_mtl_psm2_IRECV;
65
66 PSM2_MAKE_TAGSEL(src, tag, comm->c_contextid, mqtag, tagsel);
67
68 err = psm2_mq_irecv2(ompi_mtl_psm2.mq,
69 PSM2_MQ_ANY_ADDR,
70 &mqtag,
71 &tagsel,
72 0,
73 mtl_psm2_request->buf,
74 length,
75 mtl_psm2_request,
76 &mtl_psm2_request->psm2_request);
77
78 if (err) {
79 opal_show_help("help-mtl-psm2.txt",
80 "error posting receive", true,
81 psm2_error_get_string(err),
82 mtl_psm2_request->buf, length);
83 return OMPI_ERROR;
84 }
85
86 return OMPI_SUCCESS;
87 }
88
89
90 int
91 ompi_mtl_psm2_imrecv(struct mca_mtl_base_module_t* mtl,
92 struct opal_convertor_t *convertor,
93 struct ompi_message_t **message,
94 struct mca_mtl_request_t *mtl_request)
95 {
96 mca_mtl_psm2_request_t *mtl_psm2_request =
97 (mca_mtl_psm2_request_t*) mtl_request;
98 size_t length;
99 psm2_error_t err;
100 int ret;
101
102 mtl_psm2_request->psm2_request =
103 (psm2_mq_req_t)(*message)->req_ptr;
104
105 ret = ompi_mtl_datatype_recv_buf(convertor,
106 &mtl_psm2_request->buf,
107 &length,
108 &mtl_psm2_request->free_after);
109
110 if (OMPI_SUCCESS != ret) return ret;
111
112 if (length >= 1ULL << sizeof(uint32_t) * 8) {
113 opal_show_help("help-mtl-psm2.txt",
114 "message too big", false,
115 length, 1ULL << sizeof(uint32_t) * 8);
116 return OMPI_ERROR;
117 }
118
119 mtl_psm2_request->length = length;
120 mtl_psm2_request->convertor = convertor;
121 mtl_psm2_request->type = OMPI_mtl_psm2_IRECV;
122
123
124 err = psm2_mq_imrecv(ompi_mtl_psm2.mq, 0,
125 mtl_psm2_request->buf, length, mtl_psm2_request,
126 &mtl_psm2_request->psm2_request);
127
128 if(err) {
129 opal_show_help("help-mtl-psm2.txt",
130 "error posting receive", true,
131 psm2_error_get_string(err),
132 mtl_psm2_request->buf, length);
133 return OMPI_ERROR;
134 }
135
136 *message = MPI_MESSAGE_NULL;
137 return OMPI_SUCCESS;
138 }