1212 * All rights reserved.
1313 * Copyright (c) 2010 University of Houston. All rights reserved.
1414 * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
15- * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
15+ * Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights
1616 * reserved.
1717 * Copyright (c) 2015 Research Organization for Information Science
1818 * and Technology (RIST). All rights reserved.
3232#include "ompi/communicator/communicator.h"
3333#include "ompi/errhandler/errhandler.h"
3434#include "ompi/datatype/ompi_datatype.h"
35+ #include "ompi/mca/topo/base/base.h"
3536#include "ompi/memchecker.h"
3637#include "ompi/mca/topo/topo.h"
3738#include "ompi/mca/topo/base/base.h"
@@ -50,20 +51,20 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
5051 void * recvbuf , const int recvcounts [], const int displs [],
5152 MPI_Datatype recvtype , MPI_Comm comm )
5253{
53- int i , size , err ;
54+ int in_size , out_size , err ;
5455
5556 MEMCHECKER (
5657 int rank ;
5758 ptrdiff_t ext ;
5859
5960 rank = ompi_comm_rank (comm );
60- size = ompi_comm_size (comm );
61+ mca_topo_base_neighbor_count (comm , & in_size , & out_size );
6162 ompi_datatype_type_extent (recvtype , & ext );
6263
6364 memchecker_datatype (recvtype );
6465 memchecker_comm (comm );
6566 /* check whether the receive buffer is addressable. */
66- for (i = 0 ; i < size ; i ++ ) {
67+ for (int i = 0 ; i < in_size ; ++ i ) {
6768 memchecker_call (& opal_memchecker_base_isaddressable ,
6869 (char * )(recvbuf )+ displs [i ]* ext ,
6970 recvcounts [i ], recvtype );
@@ -107,8 +108,8 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
107108 get the size of the remote group here for both intra- and
108109 intercommunicators */
109110
110- size = ompi_comm_remote_size (comm );
111- for (i = 0 ; i < size ; ++ i ) {
111+ mca_topo_base_neighbor_count (comm , & in_size , & out_size );
112+ for (int i = 0 ; i < in_size ; ++ i ) {
112113 if (recvcounts [i ] < 0 ) {
113114 return OMPI_ERRHANDLER_INVOKE (comm , MPI_ERR_COUNT , FUNC_NAME );
114115 }
@@ -141,27 +142,6 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
141142 }
142143 }
143144
144- /* Do we need to do anything? Everyone had to give the same
145- signature, which means that everyone must have given a
146- sum(recvounts) > 0 if there's anything to do. */
147-
148- if ( OMPI_COMM_IS_INTRA ( comm ) ) {
149- for (i = 0 ; i < ompi_comm_size (comm ); ++ i ) {
150- if (0 != recvcounts [i ]) {
151- break ;
152- }
153- }
154- if (i >= ompi_comm_size (comm )) {
155- return MPI_SUCCESS ;
156- }
157- }
158- /* There is no rule that can be applied for inter-communicators, since
159- recvcount(s)=0 only indicates that the processes in the other group
160- do not send anything, sendcount=0 only indicates that I do not send
161- anything. However, other processes in my group might very well send
162- something */
163-
164-
165145 OPAL_CR_ENTER_LIBRARY ();
166146
167147 /* Invoke the coll component to perform the back-end operation */
@@ -170,4 +150,3 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
170150 recvtype , comm , comm -> c_coll -> coll_neighbor_allgatherv_module );
171151 OMPI_ERRHANDLER_RETURN (err , comm , err , FUNC_NAME );
172152}
173-
0 commit comments