OpenMPI  0.1.1
coll_tuned_util.h
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-2012 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * $COPYRIGHT$
13  *
14  * Additional copyrights may follow
15  *
16  * $HEADER$
17  */
18 
19 #ifndef MCA_COLL_TUNED_UTIL_EXPORT_H
20 #define MCA_COLL_TUNED_UTIL_EXPORT_H
21 
22 #include "ompi_config.h"
23 
24 #include "mpi.h"
25 #include "opal/mca/mca.h"
26 #include "ompi/datatype/ompi_datatype.h"
27 #include "ompi/request/request.h"
28 #include "ompi/mca/pml/pml.h"
29 
30 BEGIN_C_DECLS
31 
32 /* prototypes */
33 int ompi_coll_tuned_sendrecv_actual( void* sendbuf, size_t scount,
34  ompi_datatype_t* sdatatype,
35  int dest, int stag,
36  void* recvbuf, size_t rcount,
37  ompi_datatype_t* rdatatype,
38  int source, int rtag,
39  struct ompi_communicator_t* comm,
40  ompi_status_public_t* status );
41 
42 
43 /* inline functions */
44 
45 static inline int
46 ompi_coll_tuned_sendrecv( void* sendbuf, size_t scount, ompi_datatype_t* sdatatype,
47  int dest, int stag,
48  void* recvbuf, size_t rcount, ompi_datatype_t* rdatatype,
49  int source, int rtag,
50  struct ompi_communicator_t* comm,
51  ompi_status_public_t* status, int myid )
52 {
53  if ((dest == myid) && (source == myid)) {
54  return (int) ompi_datatype_sndrcv(sendbuf, (int32_t) scount, sdatatype,
55  recvbuf, (int32_t) rcount, rdatatype);
56  }
57  return ompi_coll_tuned_sendrecv_actual (sendbuf, scount, sdatatype,
58  dest, stag,
59  recvbuf, rcount, rdatatype,
60  source, rtag, comm, status);
61 }
62 
63 int
64 ompi_coll_tuned_sendrecv_actual_localcompleted( void* sendbuf, size_t scount,
65  ompi_datatype_t* sdatatype,
66  int dest, int stag,
67  void* recvbuf, size_t rcount,
68  ompi_datatype_t* rdatatype,
69  int source, int rtag,
70  struct ompi_communicator_t* comm,
71  ompi_status_public_t* status );
72 
73 
74 /* inline functions */
75 
76 static inline int
77 ompi_coll_tuned_sendrecv_localcompleted( void* sendbuf, size_t scount,
78  ompi_datatype_t* sdatatype,
79  int dest, int stag,
80  void* recvbuf, size_t rcount,
81  ompi_datatype_t* rdatatype,
82  int source, int rtag,
83  struct ompi_communicator_t* comm,
84  ompi_status_public_t* status, int myid )
85 {
86  if ((dest == myid) && (source == myid)) {
87  return (int) ompi_datatype_sndrcv(sendbuf, (int32_t) scount, sdatatype,
88  recvbuf, (int32_t) rcount, rdatatype);
89  }
90  return ompi_coll_tuned_sendrecv_actual_localcompleted (sendbuf, scount,
91  sdatatype, dest,
92  stag,
93  recvbuf, rcount,
94  rdatatype,
95  source, rtag, comm,
96  status);
97 }
98 
99 /* inline functions */
100 static inline int
101 ompi_coll_tuned_isendrecv( void* sendbuf, size_t scount, ompi_datatype_t* sdtype,
102  int dest, int stag, ompi_request_t** sreq,
103  void* recvbuf, size_t rcount, ompi_datatype_t* rdtype,
104  int source, int rtag, ompi_request_t** rreq,
105  struct ompi_communicator_t* comm ) {
106  int ret, line;
107 
108  ret = MCA_PML_CALL(irecv(recvbuf, rcount, rdtype, source, rtag, comm, rreq));
109  if (MPI_SUCCESS != ret) { line = __LINE__; goto error_handler; }
110 
111  ret = MCA_PML_CALL(isend(sendbuf, scount, sdtype, dest, stag,
112  MCA_PML_BASE_SEND_STANDARD, comm, sreq));
113  if (MPI_SUCCESS != ret) { line = __LINE__; goto error_handler; }
114 
115  return MPI_SUCCESS;
116  error_handler:
117  OPAL_OUTPUT((ompi_coll_tuned_stream, "%s:%d\tError occurred %d\n",
118  __FILE__, line, ret));
119  return ret;
120 }
121 
122 END_C_DECLS
123 #endif /* MCA_COLL_TUNED_UTIL_EXPORT_H */
124 
125 
#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
P2P Management Layer (PML)
Definition: ompi_datatype.h:68
Top-level interface for all MCA components.
Top-level description of requests.
Definition: mpi.h:337
Definition: communicator.h:118
Main top-level request struct definition.
Definition: request.h:100