}
}
-Datatype::~Datatype(){
+Datatype::~Datatype()
+{
xbt_assert(refcount_ >= 0);
if(flags_ & DT_FLAG_PREDEFINED)
xbt_free(name_);
}
-void Datatype::ref(){
-
+void Datatype::ref()
+{
refcount_++;
#if SIMGRID_HAVE_MC
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 */
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;
}
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());
return MPI_SUCCESS;
}
-Datatype* Datatype::f2c(int id){
+Datatype* Datatype::f2c(int id)
+{
return static_cast<Datatype*>(F2C::f2c(id));
}
-
-
-}
-}
-
+} // namespace smpi
+} // namespace simgrid