X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6..b2852b7c61948f495d7437ffaa7fd9aced12849c:/src/smpi/bindings/smpi_f77_coll.cpp diff --git a/src/smpi/bindings/smpi_f77_coll.cpp b/src/smpi/bindings/smpi_f77_coll.cpp index 50296432f6..3679e5d22c 100644 --- a/src/smpi/bindings/smpi_f77_coll.cpp +++ b/src/smpi/bindings/smpi_f77_coll.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2023. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -119,18 +119,16 @@ void mpi_reduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, in void mpi_alltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int* old_sendtypes, void *recvbuf, int *recvcnts, int *rdispls, int* old_recvtypes, int* comm, int* ierr){ int size = simgrid::smpi::Comm::f2c(*comm)->size(); - MPI_Datatype* sendtypes = new MPI_Datatype[size]; - MPI_Datatype* recvtypes = new MPI_Datatype[size]; + std::vector sendtypes(size); + std::vector recvtypes(size); for(int i=0; i< size; i++){ if(FORT_IN_PLACE(sendbuf)!=MPI_IN_PLACE) sendtypes[i] = simgrid::smpi::Datatype::f2c(old_sendtypes[i]); recvtypes[i] = simgrid::smpi::Datatype::f2c(old_recvtypes[i]); } sendbuf = static_cast( FORT_IN_PLACE(sendbuf)); - *ierr = MPI_Alltoallw( sendbuf, sendcnts, sdispls, sendtypes, recvbuf, recvcnts, rdispls, - recvtypes, simgrid::smpi::Comm::f2c(*comm)); - delete[] sendtypes; - delete[] recvtypes; + *ierr = MPI_Alltoallw(sendbuf, sendcnts, sdispls, sendtypes.data(), recvbuf, recvcnts, rdispls, recvtypes.data(), + simgrid::smpi::Comm::f2c(*comm)); } void mpi_exscan_ (void *sendbuf, void *recvbuf, int* count, int* datatype, int* op, int* comm, int* ierr){ @@ -141,7 +139,7 @@ void mpi_ibarrier_(int* comm, int* request, int* ierr) { MPI_Request req; *ierr = MPI_Ibarrier(simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -149,7 +147,7 @@ void mpi_ibcast_(void *buf, int* count, int* datatype, int* root, int* comm, int MPI_Request req; *ierr = MPI_Ibcast(buf, *count, simgrid::smpi::Datatype::f2c(*datatype), *root, simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -160,7 +158,7 @@ void mpi_ireduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* recvbuf = static_cast( FORT_BOTTOM(recvbuf)); *ierr = MPI_Ireduce(sendbuf, recvbuf, *count, simgrid::smpi::Datatype::f2c(*datatype), simgrid::smpi::Op::f2c(*op), *root, simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -169,7 +167,7 @@ void mpi_iallreduce_(void* sendbuf, void* recvbuf, int* count, int* datatype, in sendbuf = static_cast( FORT_IN_PLACE(sendbuf)); *ierr = MPI_Iallreduce(sendbuf, recvbuf, *count, simgrid::smpi::Datatype::f2c(*datatype), simgrid::smpi::Op::f2c(*op), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -179,7 +177,7 @@ void mpi_ireduce_scatter_(void* sendbuf, void* recvbuf, int* recvcounts, int* da *ierr = MPI_Ireduce_scatter(sendbuf, recvbuf, recvcounts, simgrid::smpi::Datatype::f2c(*datatype), simgrid::smpi::Op::f2c(*op), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -190,7 +188,7 @@ void mpi_iscatter_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, *ierr = MPI_Iscatter(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype), recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), *root, simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -201,7 +199,7 @@ void mpi_iscatterv_(void* sendbuf, int* sendcounts, int* displs, int* sendtype, *ierr = MPI_Iscatterv(sendbuf, sendcounts, displs, simgrid::smpi::Datatype::f2c(*sendtype), recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), *root, simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -214,7 +212,7 @@ void mpi_igather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf, i *ierr = MPI_Igather(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype), recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), *root, simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -227,7 +225,7 @@ void mpi_igatherv_(void* sendbuf, int* sendcount, int* sendtype, *ierr = MPI_Igatherv(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype), recvbuf, recvcounts, displs, simgrid::smpi::Datatype::f2c(*recvtype), *root, simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -238,7 +236,7 @@ void mpi_iallgather_(void* sendbuf, int* sendcount, int* sendtype, void* recvbuf *ierr = MPI_Iallgather(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype), recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -249,7 +247,7 @@ void mpi_iallgatherv_(void* sendbuf, int* sendcount, int* sendtype, *ierr = MPI_Iallgatherv(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype), recvbuf, recvcounts, displs, simgrid::smpi::Datatype::f2c(*recvtype), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -259,7 +257,7 @@ void mpi_iscan_(void* sendbuf, void* recvbuf, int* count, int* datatype, int* op *ierr = MPI_Iscan(sendbuf, recvbuf, *count, simgrid::smpi::Datatype::f2c(*datatype), simgrid::smpi::Op::f2c(*op), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -270,7 +268,7 @@ void mpi_ialltoall_(void* sendbuf, int* sendcount, int* sendtype, *ierr = MPI_Ialltoall(sendbuf, *sendcount, simgrid::smpi::Datatype::f2c(*sendtype), recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*recvtype), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -281,7 +279,7 @@ void mpi_ialltoallv_(void* sendbuf, int* sendcounts, int* senddisps, int* sendty *ierr = MPI_Ialltoallv(sendbuf, sendcounts, senddisps, simgrid::smpi::Datatype::f2c(*sendtype), recvbuf, recvcounts, recvdisps, simgrid::smpi::Datatype::f2c(*recvtype), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -293,7 +291,7 @@ void mpi_ireduce_scatter_block_ (void *sendbuf, void *recvbuf, int* recvcount, i *ierr = MPI_Ireduce_scatter_block(sendbuf, recvbuf, *recvcount, simgrid::smpi::Datatype::f2c(*datatype), simgrid::smpi::Op::f2c(*op), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } } @@ -301,21 +299,19 @@ void mpi_ialltoallw_ ( void *sendbuf, int *sendcnts, int *sdispls, int* old_send int *rdispls, int* old_recvtypes, int* comm, int* request, int* ierr){ MPI_Request req; int size = simgrid::smpi::Comm::f2c(*comm)->size(); - MPI_Datatype* sendtypes = new MPI_Datatype[size]; - MPI_Datatype* recvtypes = new MPI_Datatype[size]; + std::vector sendtypes(size); + std::vector recvtypes(size); for(int i=0; i< size; i++){ if(FORT_IN_PLACE(sendbuf)!=MPI_IN_PLACE) sendtypes[i] = simgrid::smpi::Datatype::f2c(old_sendtypes[i]); recvtypes[i] = simgrid::smpi::Datatype::f2c(old_recvtypes[i]); } sendbuf = static_cast( FORT_IN_PLACE(sendbuf)); - *ierr = MPI_Ialltoallw( sendbuf, sendcnts, sdispls, sendtypes, recvbuf, recvcnts, rdispls, - recvtypes, simgrid::smpi::Comm::f2c(*comm), &req); + *ierr = MPI_Ialltoallw(sendbuf, sendcnts, sdispls, sendtypes.data(), recvbuf, recvcnts, rdispls, recvtypes.data(), + simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } - delete[] sendtypes; - delete[] recvtypes; } void mpi_iexscan_ (void *sendbuf, void *recvbuf, int* count, int* datatype, int* op, int* comm, int* request, int* ierr){ @@ -323,7 +319,7 @@ void mpi_iexscan_ (void *sendbuf, void *recvbuf, int* count, int* datatype, int* sendbuf = static_cast( FORT_IN_PLACE(sendbuf)); *ierr = MPI_Iexscan(sendbuf, recvbuf, *count, simgrid::smpi::Datatype::f2c(*datatype), simgrid::smpi::Op::f2c(*op), simgrid::smpi::Comm::f2c(*comm), &req); if(*ierr == MPI_SUCCESS) { - *request = req->add_f(); + *request = req->c2f(); } }