|
10 | 10 | * Copyright (c) 2004-2005 The Regents of the University of California. |
11 | 11 | * All rights reserved. |
12 | 12 | * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. |
13 | | - * Copyright (c) 2015 Research Organization for Information Science |
14 | | - * and Technology (RIST). All rights reserved. |
| 13 | + * Copyright (c) 2015-2019 Research Organization for Information Science |
| 14 | + * and Technology (RIST). All rights reserved. |
15 | 15 | * $COPYRIGHT$ |
16 | 16 | * |
17 | 17 | * Additional copyrights may follow |
|
23 | 23 |
|
24 | 24 | #include "ompi/mpi/fortran/mpif-h/bindings.h" |
25 | 25 | #include "ompi/mpi/fortran/base/constants.h" |
| 26 | +#include "ompi/communicator/communicator.h" |
26 | 27 |
|
27 | 28 | #if OMPI_BUILD_MPI_PROFILING |
28 | 29 | #if OPAL_HAVE_WEAK_SYMBOLS |
@@ -71,26 +72,37 @@ void ompi_allgatherv_f(char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, |
71 | 72 | char *recvbuf, MPI_Fint *recvcounts, MPI_Fint *displs, |
72 | 73 | MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *ierr) |
73 | 74 | { |
74 | | - MPI_Comm c_comm; |
75 | | - MPI_Datatype c_sendtype, c_recvtype; |
76 | | - int size, ierr_c; |
| 75 | + int ierr_c; |
| 76 | + MPI_Comm c_comm = PMPI_Comm_f2c(*comm); |
| 77 | + int c_sendcount = 0; |
| 78 | + MPI_Datatype c_sendtype = NULL, c_recvtype; |
| 79 | + OMPI_COND_STATEMENT(int size); |
77 | 80 | OMPI_ARRAY_NAME_DECL(recvcounts); |
78 | 81 | OMPI_ARRAY_NAME_DECL(displs); |
79 | 82 |
|
80 | | - c_comm = PMPI_Comm_f2c(*comm); |
81 | | - c_sendtype = PMPI_Type_f2c(*sendtype); |
| 83 | + if (OMPI_COMM_IS_INTER(c_comm)) { |
| 84 | + OMPI_COND_STATEMENT(size = ompi_comm_remote_size(c_comm)); |
| 85 | + c_sendtype = PMPI_Type_f2c(*sendtype); |
| 86 | + c_sendcount = OMPI_FINT_2_INT(*sendcount); |
| 87 | + } else { |
| 88 | + OMPI_COND_STATEMENT(size = ompi_comm_size(c_comm)); |
| 89 | + if (OMPI_IS_FORTRAN_IN_PLACE(sendbuf)) { |
| 90 | + sendbuf = MPI_IN_PLACE; |
| 91 | + } else { |
| 92 | + c_sendtype = PMPI_Type_f2c(*sendtype); |
| 93 | + c_sendcount = OMPI_FINT_2_INT(*sendcount); |
| 94 | + } |
| 95 | + } |
82 | 96 | c_recvtype = PMPI_Type_f2c(*recvtype); |
83 | 97 |
|
84 | | - PMPI_Comm_size(c_comm, &size); |
85 | 98 | OMPI_ARRAY_FINT_2_INT(recvcounts, size); |
86 | 99 | OMPI_ARRAY_FINT_2_INT(displs, size); |
87 | 100 |
|
88 | | - sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf); |
89 | 101 | sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf); |
90 | 102 | recvbuf = (char *) OMPI_F2C_BOTTOM(recvbuf); |
91 | 103 |
|
92 | 104 | ierr_c = PMPI_Allgatherv(sendbuf, |
93 | | - OMPI_FINT_2_INT(*sendcount), |
| 105 | + c_sendcount, |
94 | 106 | c_sendtype, |
95 | 107 | recvbuf, |
96 | 108 | OMPI_ARRAY_NAME_CONVERT(recvcounts), |
|
0 commit comments