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-2015 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 (c) 2014-2017 Research Organization for Information Science
13 * and Technology (RIST). All rights reserved.
14 * $COPYRIGHT$
15 *
16 * Additional copyrights may follow
17 *
18 * $HEADER$
19 */
20
21 #ifndef MCA_COLL_BASE_UTIL_EXPORT_H
22 #define MCA_COLL_BASE_UTIL_EXPORT_H
23
24 #include "ompi_config.h"
25
26 #include "mpi.h"
27 #include "ompi/mca/mca.h"
28 #include "ompi/datatype/ompi_datatype.h"
29 #include "ompi/request/request.h"
30 #include "ompi/mca/pml/pml.h"
31
32 BEGIN_C_DECLS
33
34 /**
35 * A MPI_like function doing a send and a receive simultaneously.
36 * If one of the communications results in a zero-byte message the
37 * communication is ignored, and no message will cross to the peer.
38 */
39 int ompi_coll_base_sendrecv_actual( const void* sendbuf, size_t scount,
40 ompi_datatype_t* sdatatype,
41 int dest, int stag,
42 void* recvbuf, size_t rcount,
43 ompi_datatype_t* rdatatype,
44 int source, int rtag,
45 struct ompi_communicator_t* comm,
46 ompi_status_public_t* status );
47
48
49 /**
50 * Similar to the function above this implementation of send-receive
51 * do not generate communications for zero-bytes messages. Thus, it is
52 * improper to use in the context of some algorithms for collective
53 * communications.
54 */
55 static inline int
ompi_coll_base_sendrecv(void * sendbuf,size_t scount,ompi_datatype_t * sdatatype,int dest,int stag,void * recvbuf,size_t rcount,ompi_datatype_t * rdatatype,int source,int rtag,struct ompi_communicator_t * comm,ompi_status_public_t * status,int myid)56 ompi_coll_base_sendrecv( void* sendbuf, size_t scount, ompi_datatype_t* sdatatype,
57 int dest, int stag,
58 void* recvbuf, size_t rcount, ompi_datatype_t* rdatatype,
59 int source, int rtag,
60 struct ompi_communicator_t* comm,
61 ompi_status_public_t* status, int myid )
62 {
63 if ((dest == source) && (source == myid)) {
64 return (int) ompi_datatype_sndrcv(sendbuf, (int32_t) scount, sdatatype,
65 recvbuf, (int32_t) rcount, rdatatype);
66 }
67 return ompi_coll_base_sendrecv_actual (sendbuf, scount, sdatatype,
68 dest, stag,
69 recvbuf, rcount, rdatatype,
70 source, rtag, comm, status);
71 }
72
73 END_C_DECLS
74 #endif /* MCA_COLL_BASE_UTIL_EXPORT_H */
75