Skip to content

Commit 5492edd

Browse files
committed
coll/base: have ompi_coll_base_sendrecv() send/recv zero-bytes messages
Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 9a69b20 commit 5492edd

File tree

2 files changed

+33
-42
lines changed

2 files changed

+33
-42
lines changed

ompi/mca/coll/base/coll_base_util.c

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2014-2016 Research Organization for Information Science
12+
* Copyright (c) 2014-2017 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
1414
* $COPYRIGHT$
1515
*
@@ -29,47 +29,38 @@
2929
#include "ompi/mca/pml/pml.h"
3030
#include "coll_base_util.h"
3131

32-
int ompi_coll_base_sendrecv_nonzero_actual( void* sendbuf, size_t scount,
33-
ompi_datatype_t* sdatatype,
34-
int dest, int stag,
35-
void* recvbuf, size_t rcount,
36-
ompi_datatype_t* rdatatype,
37-
int source, int rtag,
38-
struct ompi_communicator_t* comm,
39-
ompi_status_public_t* status )
32+
int ompi_coll_base_sendrecv_actual( void* sendbuf, size_t scount,
33+
ompi_datatype_t* sdatatype,
34+
int dest, int stag,
35+
void* recvbuf, size_t rcount,
36+
ompi_datatype_t* rdatatype,
37+
int source, int rtag,
38+
struct ompi_communicator_t* comm,
39+
ompi_status_public_t* status )
4040

41-
{ /* post receive first, then send, then waitall... should be fast (I hope) */
41+
{ /* post receive first, then send, then wait... should be fast (I hope) */
4242
int err, line = 0;
4343
size_t rtypesize, stypesize;
4444
ompi_request_t *req;
4545
ompi_status_public_t rstatus;
4646

4747
/* post new irecv */
4848
ompi_datatype_type_size(rdatatype, &rtypesize);
49-
if (0 != rcount && 0 != rtypesize) {
50-
err = MCA_PML_CALL(irecv( recvbuf, rcount, rdatatype, source, rtag,
51-
comm, &req));
52-
if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
53-
}
49+
err = MCA_PML_CALL(irecv( recvbuf, rcount, rdatatype, source, rtag,
50+
comm, &req));
51+
if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
5452

5553
/* send data to children */
5654
ompi_datatype_type_size(sdatatype, &stypesize);
57-
if (0 != scount && 0 != stypesize) {
58-
err = MCA_PML_CALL(send( sendbuf, scount, sdatatype, dest, stag,
59-
MCA_PML_BASE_SEND_STANDARD, comm));
60-
if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
61-
}
55+
err = MCA_PML_CALL(send( sendbuf, scount, sdatatype, dest, stag,
56+
MCA_PML_BASE_SEND_STANDARD, comm));
57+
if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
6258

63-
if (0 != rcount && 0 != rtypesize) {
64-
err = ompi_request_wait( &req, &rstatus);
65-
if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
59+
err = ompi_request_wait( &req, &rstatus);
60+
if (err != MPI_SUCCESS) { line = __LINE__; goto error_handler; }
6661

67-
if (MPI_STATUS_IGNORE != status) {
68-
*status = rstatus;
69-
}
70-
} else {
71-
if( MPI_STATUS_IGNORE != status )
72-
*status = ompi_status_empty;
62+
if (MPI_STATUS_IGNORE != status) {
63+
*status = rstatus;
7364
}
7465

7566
return (MPI_SUCCESS);

ompi/mca/coll/base/coll_base_util.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2014 Research Organization for Information Science
12+
* Copyright (c) 2014-2017 Research Organization for Information Science
1313
* and Technology (RIST). All rights reserved.
1414
* $COPYRIGHT$
1515
*
@@ -36,14 +36,14 @@ BEGIN_C_DECLS
3636
* If one of the communications results in a zero-byte message the
3737
* communication is ignored, and no message will cross to the peer.
3838
*/
39-
int ompi_coll_base_sendrecv_nonzero_actual( 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 );
39+
int ompi_coll_base_sendrecv_actual( 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 );
4747

4848

4949
/**
@@ -64,10 +64,10 @@ ompi_coll_base_sendrecv( void* sendbuf, size_t scount, ompi_datatype_t* sdatatyp
6464
return (int) ompi_datatype_sndrcv(sendbuf, (int32_t) scount, sdatatype,
6565
recvbuf, (int32_t) rcount, rdatatype);
6666
}
67-
return ompi_coll_base_sendrecv_nonzero_actual (sendbuf, scount, sdatatype,
68-
dest, stag,
69-
recvbuf, rcount, rdatatype,
70-
source, rtag, comm, status);
67+
return ompi_coll_base_sendrecv_actual (sendbuf, scount, sdatatype,
68+
dest, stag,
69+
recvbuf, rcount, rdatatype,
70+
source, rtag, comm, status);
7171
}
7272

7373
END_C_DECLS

0 commit comments

Comments
 (0)