OpenMPI  0.1.1
mtl_mxm_types.h
1 /*
2  * Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
3  * $COPYRIGHT$
4  *
5  * Additional copyrights may follow
6  *
7  * $HEADER$
8  */
9 
10 #ifndef MTL_MXM_TYPES_H_HAS_BEEN_INCLUDED
11 #define MTL_MXM_TYPES_H_HAS_BEEN_INCLUDED
12 
13 #include "ompi_config.h"
14 #include "mtl_mxm.h"
15 
16 #include "ompi/mca/mtl/mtl.h"
17 #include "ompi/mca/mtl/base/base.h"
18 #include "ompi/communicator/communicator.h"
19 #include "mtl_mxm_endpoint.h"
20 
21 
22 BEGIN_C_DECLS
23 
24 /**
25  * MTL Module Interface
26  */
27 typedef struct mca_mtl_mxm_module_t {
28  mca_mtl_base_module_t super; /**< base MTL interface */
29  int verbose;
30  mxm_h mxm_context;
31  mxm_context_opts_t mxm_opts;
32  mxm_ep_h ep;
34 
35 
37  struct sockaddr_storage ptl_addr[MXM_PTL_LAST];
39 
40 extern mca_mtl_mxm_module_t ompi_mtl_mxm;
41 
42 typedef struct mca_mtl_mxm_component_t {
43  mca_mtl_base_component_2_0_0_t super; /**< base MTL component */
45 
46 
47 OMPI_DECLSPEC mca_mtl_mxm_component_t mca_mtl_mxm_component;
48 
49 
50 static inline mxm_conn_h ompi_mtl_mxm_conn_lookup(struct ompi_communicator_t* comm, int rank) {
51  ompi_proc_t* ompi_proc = ompi_comm_peer_lookup(comm, rank);
52  mca_mtl_mxm_endpoint_t *endpoint = (mca_mtl_mxm_endpoint_t*) ompi_proc->proc_pml;
53 
54  return endpoint->mxm_conn;
55 }
56 
57 static inline mxm_mq_h ompi_mtl_mxm_mq_lookup(struct ompi_communicator_t* comm) {
58  return (mxm_mq_h)comm->c_pml_comm;
59 }
60 
61 static inline int ompi_mtl_mxm_to_mpi_status(mxm_error_t status) {
62  if (MXM_OK == status) {
63  return OMPI_SUCCESS;
64  } else if (MXM_ERR_MESSAGE_TRUNCATED == status) {
65  return MPI_ERR_TRUNCATE;
66  } else {
67  return MPI_ERR_INTERN;
68  }
69 }
70 
71 static inline void ompi_mtl_mxm_set_recv_envelope(mxm_recv_req_t *req,
72  struct ompi_communicator_t *comm,
73  int src, int tag) {
74  req->base.mq = (mxm_mq_h)comm->c_pml_comm;
75  req->base.conn = (src == MPI_ANY_SOURCE)
76  ? NULL
77  : ompi_mtl_mxm_conn_lookup(comm, src);
78  if (tag == MPI_ANY_TAG) {
79  req->tag = 0;
80  req->tag_mask = 0x80000000U; /* MPI_ANY_TAG should not match against negative tags */
81  } else {
82  req->tag = tag;
83  req->tag_mask = 0xffffffffU;
84  }
85 }
86 
87 END_C_DECLS
88 
89 #endif
90 
mca_mtl_base_module_t super
base MTL interface
Definition: mtl_mxm_types.h:28
struct mca_pml_endpoint_t * proc_pml
PML specific proc data.
Definition: proc.h:62
Definition: mtl.h:93
Remote Open MPI process structure.
Definition: proc.h:56
mca_mtl_base_component_2_0_0_t super
base MTL component
Definition: mtl_mxm_types.h:43
Definition: util-internal.h:214
Definition: mtl_mxm_types.h:42
An abstraction that represents a connection to a endpoint process.
Definition: mtl_mx_endpoint.h:50
MTL Module Interface.
Definition: mtl_mxm_types.h:27
Matching Transport Layer.
mxm_conn_h mxm_conn
MXM Connection handle.
Definition: mtl_mxm_endpoint.h:33
MTL module interface functions and attributes.
Definition: mtl.h:399
Definition: communicator.h:118
Definition: mtl_mxm_types.h:36