X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d90c7b8b93aae8ce86d6f5194f171b47408b542e..a0816cd508b0beceb6361a66fcf43512e18d3753:/src/smpi/smpi_pmpi.cpp diff --git a/src/smpi/smpi_pmpi.cpp b/src/smpi/smpi_pmpi.cpp index a35f124de6..1d9a5f3c9a 100644 --- a/src/smpi/smpi_pmpi.cpp +++ b/src/smpi/smpi_pmpi.cpp @@ -3,9 +3,17 @@ /* 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. */ -#include - -#include "private.h" +#include "simgrid/s4u/Engine.hpp" +#include "simgrid/s4u/Host.hpp" +#include "src/smpi/private.h" +#include "src/smpi/smpi_comm.hpp" +#include "src/smpi/smpi_coll.hpp" +#include "src/smpi/smpi_datatype_derived.hpp" +#include "src/smpi/smpi_op.hpp" +#include "src/smpi/smpi_process.hpp" +#include "src/smpi/smpi_request.hpp" +#include "src/smpi/smpi_status.hpp" +#include "src/smpi/smpi_win.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)"); @@ -24,7 +32,9 @@ extern "C" { // Obviously, the C MPI interface should use the C linkage int PMPI_Init(int *argc, char ***argv) { - // PMPI_Init is call only one time by only by SMPI process + xbt_assert(simgrid::s4u::Engine::isInitialized(), + "Your MPI program was not properly initialized. The easiest is to use smpirun to start it."); + // PMPI_Init is called only once per SMPI process int already_init; MPI_Initialized(&already_init); if(already_init == 0){ @@ -57,7 +67,6 @@ int PMPI_Finalize() TRACE_smpi_collective_out(rank, -1, __FUNCTION__); TRACE_smpi_finalize(smpi_process()->index()); - smpi_process()->destroy(); return MPI_SUCCESS; } @@ -75,7 +84,7 @@ int PMPI_Get_version (int *version,int *subversion){ int PMPI_Get_library_version (char *version,int *len){ smpi_bench_end(); - snprintf(version,MPI_MAX_LIBRARY_VERSION_STRING,"SMPI Version %d.%d. Copyright The Simgrid Team 2007-2015", + snprintf(version, MPI_MAX_LIBRARY_VERSION_STRING, "SMPI Version %d.%d. Copyright The Simgrid Team 2007-2017", SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR); *len = strlen(version) > MPI_MAX_LIBRARY_VERSION_STRING ? MPI_MAX_LIBRARY_VERSION_STRING : strlen(version); smpi_bench_begin(); @@ -113,7 +122,6 @@ int PMPI_Is_thread_main(int *flag) int PMPI_Abort(MPI_Comm comm, int errorcode) { smpi_bench_end(); - smpi_process()->destroy(); // FIXME: should kill all processes in comm instead simcall_process_kill(SIMIX_process_self()); return MPI_SUCCESS; @@ -1513,7 +1521,6 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; int root_traced = comm->group()->index(root); - int i = 0; int size = comm->size(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_GATHERV; @@ -1529,9 +1536,9 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv int dt_size_recv = 1; if (known == 0) dt_size_recv = recvtype->size(); - if ((comm->rank() == root)) { + if (comm->rank() == root) { extra->recvcounts = xbt_new(int, size); - for (i = 0; i < size; i++) // copy data to avoid bad free + for (int i = 0; i < size; i++) // copy data to avoid bad free extra->recvcounts[i] = recvcounts[i] * dt_size_recv; } TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); @@ -1712,7 +1719,6 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, } int rank = comm != MPI_COMM_NULL ? smpi_process()->index() : -1; int root_traced = comm->group()->index(root); - int i = 0; int size = comm->size(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1); extra->type = TRACING_SCATTERV; @@ -1723,9 +1729,9 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, int dt_size_send = 1; if (known == 0) dt_size_send = sendtype->size(); - if ((comm->rank() == root)) { + if (comm->rank() == root) { extra->sendcounts = xbt_new(int, size); - for (i = 0; i < size; i++) // copy data to avoid bad free + for (int i = 0; i < size; i++) // copy data to avoid bad free extra->sendcounts[i] = sendcounts[i] * dt_size_send; } extra->datatype2 = encode_datatype(recvtype, &known);