1
1

Merge pull request #6838 from ggouaillardet/topic/v4.0.x/misc_fortran_bindings

v4.0.x: misc Fortran related backports
Этот коммит содержится в:
Howard Pritchard 2019-08-02 13:00:31 -06:00 коммит произвёл GitHub
родитель 31aa52f11a 1ffb9b10bb
Коммит e547a2b94d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 124 добавлений и 101 удалений

Просмотреть файл

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
@ -23,6 +23,7 @@
#include "ompi/mpi/fortran/mpif-h/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"
#include "ompi/communicator/communicator.h"
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
@ -74,7 +75,7 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
MPI_Fint *comm, MPI_Fint *ierr)
{
MPI_Comm c_comm;
MPI_Datatype *c_sendtypes, *c_recvtypes;
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes;
int size, c_ierr;
OMPI_ARRAY_NAME_DECL(sendcounts);
OMPI_ARRAY_NAME_DECL(sdispls);
@ -82,20 +83,22 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
OMPI_ARRAY_NAME_DECL(rdispls);
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));
OMPI_ARRAY_FINT_2_INT(sendcounts, size);
OMPI_ARRAY_FINT_2_INT(sdispls, size);
for (int i=0; i<size; i++) {
c_sendtypes[i] = PMPI_Type_f2c(sendtypes[i]);
}
}
c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
OMPI_ARRAY_FINT_2_INT(sendcounts, size);
OMPI_ARRAY_FINT_2_INT(sdispls, size);
OMPI_ARRAY_FINT_2_INT(recvcounts, size);
OMPI_ARRAY_FINT_2_INT(rdispls, size);
while (size > 0) {
c_sendtypes[size - 1] = PMPI_Type_f2c(sendtypes[size - 1]);
c_recvtypes[size - 1] = PMPI_Type_f2c(recvtypes[size - 1]);
--size;
for (int i=0; i<size; i++) {
c_recvtypes[i] = PMPI_Type_f2c(recvtypes[i]);
}
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
@ -116,6 +119,8 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
free(c_sendtypes);
if (NULL != c_sendtypes) {
free(c_sendtypes);
}
free(c_recvtypes);
}

Просмотреть файл

@ -11,8 +11,8 @@
* All rights reserved.
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -77,11 +77,11 @@ void ompi_comm_split_type_f(MPI_Fint *comm, MPI_Fint *split_type, MPI_Fint *key,
c_info = PMPI_Info_f2c(*info);
c_ierr = OMPI_INT_2_FINT(PMPI_Comm_split_type(c_comm,
OMPI_FINT_2_INT(*split_type),
OMPI_FINT_2_INT(*key),
c_info,
&c_newcomm ));
c_ierr = PMPI_Comm_split_type(c_comm,
OMPI_FINT_2_INT(*split_type),
OMPI_FINT_2_INT(*key),
c_info,
&c_newcomm);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
if (MPI_SUCCESS == c_ierr) {

Просмотреть файл

@ -8,8 +8,8 @@
* Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -78,6 +78,7 @@ void ompi_dist_graph_create_adjacent_f(MPI_Fint *comm_old, MPI_Fint *indegree,
MPI_Info c_info;
MPI_Comm c_comm_old, c_comm_graph;
int *c_destweights, *c_sourceweights;
int c_ierr;
OMPI_ARRAY_NAME_DECL(sources);
OMPI_ARRAY_NAME_DECL(destinations);
@ -105,16 +106,17 @@ void ompi_dist_graph_create_adjacent_f(MPI_Fint *comm_old, MPI_Fint *indegree,
c_destweights = OMPI_ARRAY_NAME_CONVERT(destweights);
}
*ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_create_adjacent(c_comm_old, OMPI_FINT_2_INT(*indegree),
OMPI_ARRAY_NAME_CONVERT(sources),
c_sourceweights,
OMPI_FINT_2_INT(*outdegree),
OMPI_ARRAY_NAME_CONVERT(destinations),
c_destweights,
c_info,
OMPI_LOGICAL_2_INT(*reorder),
&c_comm_graph));
if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
c_ierr = PMPI_Dist_graph_create_adjacent(c_comm_old, OMPI_FINT_2_INT(*indegree),
OMPI_ARRAY_NAME_CONVERT(sources),
c_sourceweights,
OMPI_FINT_2_INT(*outdegree),
OMPI_ARRAY_NAME_CONVERT(destinations),
c_destweights,
c_info,
OMPI_LOGICAL_2_INT(*reorder),
&c_comm_graph);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
if (OMPI_SUCCESS == c_ierr) {
*comm_graph = PMPI_Comm_c2f(c_comm_graph);
}

Просмотреть файл

@ -7,8 +7,8 @@
* Copyright (c) 2011-2013 Université Bordeaux 1
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -75,6 +75,7 @@ void ompi_dist_graph_create_f(MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources
int count = 0, i;
MPI_Info c_info;
int *c_weights;
int c_ierr;
OMPI_ARRAY_NAME_DECL(sources);
OMPI_ARRAY_NAME_DECL(degrees);
@ -98,10 +99,11 @@ void ompi_dist_graph_create_f(MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources
}
*ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_create(c_comm_old, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(sources),
OMPI_ARRAY_NAME_CONVERT(degrees), OMPI_ARRAY_NAME_CONVERT(destinations),
c_weights, c_info, OMPI_LOGICAL_2_INT(*reorder), &c_comm_graph));
if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
c_ierr = PMPI_Dist_graph_create(c_comm_old, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(sources),
OMPI_ARRAY_NAME_CONVERT(degrees), OMPI_ARRAY_NAME_CONVERT(destinations),
c_weights, c_info, OMPI_LOGICAL_2_INT(*reorder), &c_comm_graph);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
if (OMPI_SUCCESS == c_ierr) {
*comm_graph = PMPI_Comm_c2f(c_comm_graph);
}

Просмотреть файл

@ -4,7 +4,7 @@
* reserved.
* Copyright (c) 2011-2013 Inria. All rights reserved.
* Copyright (c) 2011-2013 Université Bordeaux 1
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
@ -69,15 +69,17 @@ void ompi_dist_graph_neighbors_count_f(MPI_Fint *comm, MPI_Fint *inneighbors,
OMPI_SINGLE_NAME_DECL(inneighbors);
OMPI_SINGLE_NAME_DECL(outneighbors);
OMPI_LOGICAL_NAME_DECL(weighted);
int c_ierr;
c_comm = PMPI_Comm_f2c(*comm);
*ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_neighbors_count(c_comm,
OMPI_SINGLE_NAME_CONVERT(inneighbors),
OMPI_SINGLE_NAME_CONVERT(outneighbors),
OMPI_LOGICAL_SINGLE_NAME_CONVERT(weighted)));
c_ierr = PMPI_Dist_graph_neighbors_count(c_comm,
OMPI_SINGLE_NAME_CONVERT(inneighbors),
OMPI_SINGLE_NAME_CONVERT(outneighbors),
OMPI_LOGICAL_SINGLE_NAME_CONVERT(weighted));
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
OMPI_SINGLE_INT_2_LOGICAL(weighted);
if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
if (OMPI_SUCCESS == c_ierr) {
OMPI_SINGLE_INT_2_FINT(inneighbors);
OMPI_SINGLE_INT_2_FINT(outneighbors);
}

Просмотреть файл

@ -4,8 +4,8 @@
* reserved.
* Copyright (c) 2011-2013 Inria. All rights reserved.
* Copyright (c) 2011-2013 Université Bordeaux 1
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -74,6 +74,7 @@ void ompi_dist_graph_neighbors_f(MPI_Fint* comm, MPI_Fint* maxindegree,
OMPI_ARRAY_NAME_DECL(sourceweights);
OMPI_ARRAY_NAME_DECL(destinations);
OMPI_ARRAY_NAME_DECL(destweights);
int c_ierr;
c_comm = PMPI_Comm_f2c(*comm);
@ -86,12 +87,14 @@ void ompi_dist_graph_neighbors_f(MPI_Fint* comm, MPI_Fint* maxindegree,
OMPI_ARRAY_FINT_2_INT_ALLOC(destweights, *maxoutdegree);
}
*ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_neighbors(c_comm, OMPI_FINT_2_INT(*maxindegree),
OMPI_ARRAY_NAME_CONVERT(sources),
OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(sourceweights),
OMPI_FINT_2_INT(*maxoutdegree), OMPI_ARRAY_NAME_CONVERT(destinations),
OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(destweights)));
if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) {
c_ierr = PMPI_Dist_graph_neighbors(c_comm, OMPI_FINT_2_INT(*maxindegree),
OMPI_ARRAY_NAME_CONVERT(sources),
OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(sourceweights),
OMPI_FINT_2_INT(*maxoutdegree), OMPI_ARRAY_NAME_CONVERT(destinations),
OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(destweights));
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
if (OMPI_SUCCESS == c_ierr) {
OMPI_ARRAY_INT_2_FINT(sources, *maxindegree);
if( !OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ) {
OMPI_ARRAY_INT_2_FINT(sourceweights, *maxindegree);

Просмотреть файл

@ -10,8 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -23,6 +23,7 @@
#include "ompi/mpi/fortran/mpif-h/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"
#include "ompi/communicator/communicator.h"
#if OMPI_BUILD_MPI_PROFILING
#if OPAL_HAVE_WEAK_SYMBOLS
@ -74,7 +75,7 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr)
{
MPI_Comm c_comm;
MPI_Datatype *c_sendtypes, *c_recvtypes;
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes;
MPI_Request c_request;
int size, c_ierr;
OMPI_ARRAY_NAME_DECL(sendcounts);
@ -83,20 +84,22 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
OMPI_ARRAY_NAME_DECL(rdispls);
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));
OMPI_ARRAY_FINT_2_INT(sendcounts, size);
OMPI_ARRAY_FINT_2_INT(sdispls, size);
for (int i=0; i<size; i++) {
c_sendtypes[i] = PMPI_Type_f2c(sendtypes[i]);
}
}
c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
OMPI_ARRAY_FINT_2_INT(sendcounts, size);
OMPI_ARRAY_FINT_2_INT(sdispls, size);
OMPI_ARRAY_FINT_2_INT(recvcounts, size);
OMPI_ARRAY_FINT_2_INT(rdispls, size);
while (size > 0) {
c_sendtypes[size - 1] = PMPI_Type_f2c(sendtypes[size - 1]);
c_recvtypes[size - 1] = PMPI_Type_f2c(recvtypes[size - 1]);
--size;
for (int i=0; i<size; i++) {
c_recvtypes[i] = PMPI_Type_f2c(recvtypes[i]);
}
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
@ -118,6 +121,8 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts,
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
free(c_sendtypes);
if (NULL != c_sendtypes) {
free(c_sendtypes);
}
free(c_recvtypes);
}

Просмотреть файл

@ -11,8 +11,8 @@
* All rights reserved.
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
@ -87,10 +87,10 @@ void ompi_improbe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status)
c_ierr = OMPI_INT_2_FINT(PMPI_Improbe(OMPI_FINT_2_INT(*source),
OMPI_FINT_2_INT(*tag),
c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag),
&c_message, c_status));
c_ierr = PMPI_Improbe(OMPI_FINT_2_INT(*source),
OMPI_FINT_2_INT(*tag),
c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag),
&c_message, c_status);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
if (MPI_SUCCESS == c_ierr) {

Просмотреть файл

@ -10,8 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
*
@ -80,8 +80,8 @@ void ompi_imrecv_f(char *buf, MPI_Fint *count, MPI_Fint *datatype,
c_message = PMPI_Message_f2c(*message);
c_ierr = OMPI_INT_2_FINT(PMPI_Imrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count),
c_type, &c_message, &c_req));
c_ierr = PMPI_Imrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count),
c_type, &c_message, &c_req);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
if (MPI_SUCCESS == c_ierr) {

Просмотреть файл

@ -12,7 +12,7 @@
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 FUJITSU LIMITED. All rights reserved.
* $COPYRIGHT$
@ -86,10 +86,10 @@ void ompi_mprobe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm,
OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status)
c_ierr = OMPI_INT_2_FINT(PMPI_Mprobe(OMPI_FINT_2_INT(*source),
OMPI_FINT_2_INT(*tag),
c_comm, &c_message,
c_status));
c_ierr = PMPI_Mprobe(OMPI_FINT_2_INT(*source),
OMPI_FINT_2_INT(*tag),
c_comm, &c_message,
c_status);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
if (MPI_SUCCESS == c_ierr) {

Просмотреть файл

@ -77,16 +77,16 @@ void ompi_mrecv_f(char *buf, MPI_Fint *count, MPI_Fint *datatype,
MPI_Fint *message, MPI_Fint *status, MPI_Fint *ierr)
{
int c_ierr;
OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2)
OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2)
MPI_Message c_message = PMPI_Message_f2c(*message);
MPI_Datatype c_type = PMPI_Type_f2c(*datatype);
OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status)
/* Call the C function */
c_ierr = OMPI_INT_2_FINT(PMPI_Mrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count),
c_type, &c_message,
c_status));
c_ierr = PMPI_Mrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count),
c_type, &c_message,
c_status);
if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr);
if (MPI_SUCCESS == c_ierr) {

Просмотреть файл

@ -10,8 +10,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -23,6 +23,7 @@
#include "ompi/mpi/fortran/mpif-h/bindings.h"
#include "ompi/mpi/fortran/base/constants.h"
#include "ompi/communicator/communicator.h"
#include "ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h"
#if OMPI_BUILD_MPI_PROFILING
@ -75,7 +76,7 @@ void ompix_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts,
MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)
{
MPI_Comm c_comm;
MPI_Datatype *c_sendtypes, *c_recvtypes;
MPI_Datatype *c_sendtypes = NULL, *c_recvtypes;
MPI_Info c_info;
MPI_Request c_request;
int size, c_ierr;
@ -85,22 +86,23 @@ void ompix_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts,
OMPI_ARRAY_NAME_DECL(rdispls);
c_comm = PMPI_Comm_f2c(*comm);
PMPI_Comm_size(c_comm, &size);
c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
c_info = PMPI_Info_f2c(*info);
size = OMPI_COMM_IS_INTER(c_comm)?ompi_comm_remote_size(c_comm):ompi_comm_size(c_comm);
OMPI_ARRAY_FINT_2_INT(sendcounts, size);
OMPI_ARRAY_FINT_2_INT(sdispls, size);
if (!OMPI_IS_FORTRAN_IN_PLACE(sendbuf)) {
c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype));
OMPI_ARRAY_FINT_2_INT(sendcounts, 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(rdispls, size);
while (size > 0) {
c_sendtypes[size - 1] = PMPI_Type_f2c(sendtypes[size - 1]);
c_recvtypes[size - 1] = PMPI_Type_f2c(recvtypes[size - 1]);
--size;
for (int i=0; i<size; i++) {
c_recvtypes[i] = PMPI_Type_f2c(recvtypes[i]);
}
sendbuf = (char *) OMPI_F2C_IN_PLACE(sendbuf);
@ -122,6 +124,8 @@ void ompix_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts,
OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls);
OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts);
OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls);
free(c_sendtypes);
if (NULL != c_sendtypes) {
free(c_sendtypes);
}
free(c_recvtypes);
}