X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9d1a9a4b871895531b7e70f313691ef75dc47a96..101c8b10d9965e115c9ff5c28954750a065cf155:/src/smpi/mpi/smpi_datatype.cpp diff --git a/src/smpi/mpi/smpi_datatype.cpp b/src/smpi/mpi/smpi_datatype.cpp index 074c15891a..3829b155f9 100644 --- a/src/smpi/mpi/smpi_datatype.cpp +++ b/src/smpi/mpi/smpi_datatype.cpp @@ -160,7 +160,8 @@ Datatype::Datatype(Datatype *datatype, int* ret) : name_(nullptr), size_(datatyp } } -Datatype::~Datatype(){ +Datatype::~Datatype() +{ xbt_assert(refcount_ >= 0); if(flags_ & DT_FLAG_PREDEFINED) @@ -177,8 +178,8 @@ Datatype::~Datatype(){ xbt_free(name_); } -void Datatype::ref(){ - +void Datatype::ref() +{ refcount_++; #if SIMGRID_HAVE_MC @@ -270,12 +271,12 @@ int Datatype::unpack(const void* inbuf, int insize, int* position, void* outbuf, return MPI_SUCCESS; } -int Datatype::copy(const void *sendbuf, int sendcount, MPI_Datatype sendtype, - void *recvbuf, int recvcount, MPI_Datatype recvtype){ - -// FIXME Handle the case of a partial shared malloc. +int Datatype::copy(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, + MPI_Datatype recvtype) +{ + // FIXME Handle the case of a partial shared malloc. - if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) { + if (smpi_cfg_privatization() == SmpiPrivStrategies::MMAP) { smpi_switch_data_segment(simgrid::s4u::Actor::self()); } /* First check if we really have something to do */ @@ -284,11 +285,13 @@ int Datatype::copy(const void *sendbuf, int sendcount, MPI_Datatype sendtype, if(smpi_is_shared(sendbuf,private_blocks,&offset) && (private_blocks.size()==1 && (private_blocks[0].second - private_blocks[0].first)==(unsigned long)(sendcount * sendtype->get_extent()))){ + XBT_VERB("sendbuf is shared. Ignoring copies"); return 0; } if(smpi_is_shared(recvbuf,private_blocks,&offset) && (private_blocks.size()==1 && (private_blocks[0].second - private_blocks[0].first)==(unsigned long)(recvcount * recvtype->get_extent()))){ + XBT_VERB("recvbuf is shared. Ignoring copies"); return 0; } @@ -304,8 +307,7 @@ int Datatype::copy(const void *sendbuf, int sendcount, MPI_Datatype sendtype, recvtype->unserialize(sendbuf, recvbuf, count / recvtype->size(), MPI_REPLACE); } else if (not(recvtype->flags() & DT_FLAG_DERIVED)) { sendtype->serialize(sendbuf, recvbuf, count / sendtype->size()); - }else{ - + } else { void * buf_tmp = xbt_malloc(count); sendtype->serialize( sendbuf, buf_tmp,count/sendtype->size()); @@ -581,11 +583,9 @@ int Datatype::create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, return MPI_SUCCESS; } -Datatype* Datatype::f2c(int id){ +Datatype* Datatype::f2c(int id) +{ return static_cast(F2C::f2c(id)); } - - -} -} - +} // namespace smpi +} // namespace simgrid