Merge pull request #6824 from ggouaillardet/topic/alltoallw_cid
fortran/mpif-h: fix MPI_Alltoallw and friends bindings
Этот коммит содержится в:
Коммит
5bd90ee548
@ -75,7 +75,7 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
|
|||||||
MPI_Fint *comm, MPI_Fint *ierr)
|
MPI_Fint *comm, MPI_Fint *ierr)
|
||||||
{
|
{
|
||||||
MPI_Comm c_comm;
|
MPI_Comm c_comm;
|
||||||
MPI_Datatype *c_sendtypes, *c_recvtypes;
|
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes;
|
||||||
int size, c_ierr;
|
int size, c_ierr;
|
||||||
OMPI_ARRAY_NAME_DECL(sendcounts);
|
OMPI_ARRAY_NAME_DECL(sendcounts);
|
||||||
OMPI_ARRAY_NAME_DECL(sdispls);
|
OMPI_ARRAY_NAME_DECL(sdispls);
|
||||||
@ -119,7 +119,7 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
|
|||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
|
||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
|
||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
|
||||||
if (MPI_IN_PLACE != sendbuf) {
|
if (NULL != c_sendtypes) {
|
||||||
free(c_sendtypes);
|
free(c_sendtypes);
|
||||||
}
|
}
|
||||||
free(c_recvtypes);
|
free(c_recvtypes);
|
||||||
|
@ -75,7 +75,7 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
|
|||||||
MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)
|
MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)
|
||||||
{
|
{
|
||||||
MPI_Comm c_comm;
|
MPI_Comm c_comm;
|
||||||
MPI_Datatype *c_sendtypes, *c_recvtypes;
|
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes;
|
||||||
MPI_Request c_request;
|
MPI_Request c_request;
|
||||||
int size, c_ierr;
|
int size, c_ierr;
|
||||||
OMPI_ARRAY_NAME_DECL(sendcounts);
|
OMPI_ARRAY_NAME_DECL(sendcounts);
|
||||||
@ -101,7 +101,6 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
|
|||||||
for (int i=0; i<size; i++) {
|
for (int i=0; i<size; i++) {
|
||||||
c_recvtypes[i] = PMPI_Type_f2c(recvtypes[i]);
|
c_recvtypes[i] = PMPI_Type_f2c(recvtypes[i]);
|
||||||
}
|
}
|
||||||
c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
|
|
||||||
|
|
||||||
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
|
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
|
||||||
sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf);
|
sendbuf = (char *) OMPI_F2C_BOTTOM(sendbuf);
|
||||||
@ -122,7 +121,7 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
|
|||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
|
||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
|
||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
|
||||||
if (MPI_IN_PLACE != sendbuf) {
|
if (NULL != c_sendtypes) {
|
||||||
free(c_sendtypes);
|
free(c_sendtypes);
|
||||||
}
|
}
|
||||||
free(c_recvtypes);
|
free(c_recvtypes);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2015-2018 Research Organization for Information Science
|
* Copyright (c) 2015-2019 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "ompi/mpi/fortran/mpif-h/bindings.h"
|
#include "ompi/mpi/fortran/mpif-h/bindings.h"
|
||||||
#include "ompi/mpi/fortran/base/constants.h"
|
#include "ompi/mpi/fortran/base/constants.h"
|
||||||
|
#include "ompi/communicator/communicator.h"
|
||||||
#include "ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h"
|
#include "ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h"
|
||||||
|
|
||||||
#if OMPI_BUILD_MPI_PROFILING
|
#if OMPI_BUILD_MPI_PROFILING
|
||||||
@ -85,22 +86,22 @@ void ompix_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts,
|
|||||||
OMPI_ARRAY_NAME_DECL(rdispls);
|
OMPI_ARRAY_NAME_DECL(rdispls);
|
||||||
|
|
||||||
c_comm = PMPI_Comm_f2c(*comm);
|
c_comm = PMPI_Comm_f2c(*comm);
|
||||||
PMPI_Comm_size(c_comm, &size);
|
size = OMPI_COMM_IS_INTER(c_comm)?ompi_comm_remote_size(c_comm):ompi_comm_size(c_comm);
|
||||||
|
|
||||||
|
if (!OMPI_IS_FORTRAN_IN_PLACE(sendbuf)) {
|
||||||
c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
|
c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
|
||||||
c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
|
|
||||||
|
|
||||||
c_info = PMPI_Info_f2c(*info);
|
|
||||||
|
|
||||||
OMPI_ARRAY_FINT_2_INT(sendcounts, size);
|
OMPI_ARRAY_FINT_2_INT(sendcounts, size);
|
||||||
OMPI_ARRAY_FINT_2_INT(sdispls, size);
|
OMPI_ARRAY_FINT_2_INT(sdispls, size);
|
||||||
|
for (int i=0; i<size; i++) {
|
||||||
|
c_sendtypes[i] = PMPI_Type_f2c(sendtypes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
|
||||||
OMPI_ARRAY_FINT_2_INT(recvcounts, size);
|
OMPI_ARRAY_FINT_2_INT(recvcounts, size);
|
||||||
OMPI_ARRAY_FINT_2_INT(rdispls, size);
|
OMPI_ARRAY_FINT_2_INT(rdispls, size);
|
||||||
|
for (int i=0; i<size; i++) {
|
||||||
while (size > 0) {
|
c_recvtypes[i] = PMPI_Type_f2c(recvtypes[i]);
|
||||||
c_sendtypes[size - 1] = PMPI_Type_f2c(sendtypes[size - 1]);
|
|
||||||
c_recvtypes[size - 1] = PMPI_Type_f2c(recvtypes[size - 1]);
|
|
||||||
--size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
|
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
|
||||||
@ -122,6 +123,8 @@ void ompix_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts,
|
|||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
|
||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
|
||||||
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
|
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
|
||||||
|
if (NULL != c_sendtypes) {
|
||||||
free(c_sendtypes);
|
free(c_sendtypes);
|
||||||
|
}
|
||||||
free(c_recvtypes);
|
free(c_recvtypes);
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user