13 #include "ompi_config.h"
18 #include "opal_stdint.h"
20 #include "ompi/include/ompi/constants.h"
26 #include <sys/types.h>
31 #include "common_ugni_ep.h"
33 #if !defined(MPI_COMMON_UGNI_H)
34 #define MPI_COMMON_UGNI_H
45 gni_nic_handle_t dev_handle;
53 gni_cq_handle_t dev_local_cq;
69 gni_cdm_handle_t cd_handle;
82 gni_post_descriptor_t base;
96 ompi_common_rc_ugni_to_ompi (gni_return_t rc)
98 int codes[] = {OMPI_SUCCESS,
99 OMPI_ERR_RESOURCE_BUSY,
101 OMPI_ERR_OUT_OF_RESOURCE,
108 OMPI_ERR_VALUE_OUT_OF_BOUNDS,
110 OMPI_ERR_NOT_SUPPORTED,
111 OMPI_ERR_OUT_OF_RESOURCE};
118 int ompi_common_ugni_init (
void);
123 int ompi_common_ugni_fini (
void);
125 extern void mca_btl_ugni_local_smsg_complete (
void *, uint32_t,
int);
129 gni_cq_handle_t cq_handle) {
131 gni_return_t rc = GNI_RC_NOT_DONE;
132 gni_cq_entry_t event_data = 0;
133 uint32_t recoverable = 1;
135 rc = GNI_CqGetEvent (cq_handle, &event_data);
136 if (GNI_RC_NOT_DONE == rc) {
140 if (OPAL_UNLIKELY((GNI_RC_SUCCESS != rc && !event_data) || GNI_CQ_OVERRUN(event_data))) {
143 OPAL_OUTPUT((-1,
"post error! cq overrun = %d", (
int)GNI_CQ_OVERRUN(event_data)));
145 return ompi_common_rc_ugni_to_ompi (rc);
149 if (GNI_CQ_GET_TYPE(event_data) == GNI_CQ_EVENT_TYPE_SMSG) {
150 uint32_t msg_id = GNI_CQ_GET_MSG_ID(event_data);
152 assert (GNI_CQ_STATUS_OK(event_data));
154 if ((uint32_t)-1 == msg_id) {
160 mca_btl_ugni_local_smsg_complete (dev->btl_ctx, msg_id,
161 GNI_CQ_STATUS_OK(event_data) ? OMPI_SUCCESS : OMPI_ERROR);
166 rc = GNI_GetCompleted (cq_handle, event_data, (gni_post_descriptor_t **) &desc);
167 if (OPAL_UNLIKELY(GNI_RC_SUCCESS != rc)) {
168 OPAL_OUTPUT((-1,
"Error in GNI_GetComplete %s", gni_err_str[rc]));
169 return ompi_common_rc_ugni_to_ompi (rc);
172 if (OPAL_UNLIKELY(!GNI_CQ_STATUS_OK(event_data))) {
173 (void) GNI_CqErrorRecoverable (event_data, &recoverable);
175 if (OPAL_UNLIKELY(!recoverable ||
176 ++desc->tries >= ompi_common_ugni_module.rdma_max_retries)) {
177 OPAL_OUTPUT((-1,
"giving up on descriptor %p", (
void *) desc));
179 desc->cbfunc (desc, OMPI_ERROR);
185 if (GNI_POST_RDMA_PUT == desc->base.type ||
186 GNI_POST_RDMA_GET == desc->base.type) {
187 rc = GNI_PostRdma (desc->endpoint->
ep_handle, &desc->base);
189 rc = GNI_PostFma (desc->endpoint->
ep_handle, &desc->base);
192 return ompi_common_rc_ugni_to_ompi (rc);
195 desc->cbfunc (desc, OMPI_SUCCESS);
200 static inline int ompi_common_ugni_progress (
void) {
204 for (i = 0, count = 0 ; i < ompi_common_ugni_module.device_count ; ++i) {
205 dev = ompi_common_ugni_module.devices + i;
207 count += ompi_common_ugni_process_completed_post (dev, dev->dev_local_cq);
#define OPAL_OUTPUT(a)
Main macro for use in sending debugging output to output streams; will be "compiled out" when OPAL is...
Definition: output.h:534
Common type for all MCA components.
Definition: mca.h:250
OPAL output stream facility.
The opal_list_t interface is used to provide a generic doubly-linked list container for Open MPI...
Process identification structure interface.
Definition: common_ugni.h:61
Definition: common_ugni.h:36
Definition: common_ugni.h:42
gni_ep_handle_t ep_handle
uGNI handle for this endpoint
Definition: common_ugni_ep.h:28
Base object.
Definition: opal_object.h:182
Open MPI module-related data transfer mechanism.
Compiler-specific prefetch functions.
Definition: common_ugni_ep.h:26
Definition: common_ugni.h:81