Comm::Comm(MPI_Group group, MPI_Topology topo, int smp, int in_id) : group_(group), topo_(topo),is_smp_comm_(smp), id_(in_id)
{
- refcount_ = 1;
- topoType_ = MPI_INVALID_TOPO;
- intra_comm_ = MPI_COMM_NULL;
- leaders_comm_ = MPI_COMM_NULL;
- is_uniform_ = 1;
- non_uniform_map_ = nullptr;
- leaders_map_ = nullptr;
- is_blocked_ = 0;
- info_ = MPI_INFO_NULL;
errhandler_ = MPI_ERRORS_ARE_FATAL;
+ errhandler_->ref();
//First creation of comm is done before SIMIX_run, so only do comms for others
if(in_id==MPI_UNDEFINED && smp==0 && this->rank()!=MPI_UNDEFINED ){
int id;
comm->cleanup_attr<Comm>();
if (comm->info_ != MPI_INFO_NULL)
simgrid::smpi::Info::unref(comm->info_);
+ if (comm->errhandler_ != MPI_ERRHANDLER_NULL)
+ simgrid::smpi::Errhandler::unref(comm->errhandler_);
delete comm->topo_; // there's no use count on topos
delete comm;
}
leader_group_size++;
}
}
+ xbt_assert(leader_group_size > 0);
std::sort(leader_list, leader_list + leader_group_size);
MPI_Group leaders_group = new Group(leader_group_size);
info->ref();
}
-MPI_Errhandler Comm::errhandler(){
+MPI_Errhandler Comm::errhandler()
+{
+ if (errhandler_ != MPI_ERRHANDLER_NULL)
+ errhandler_->ref();
return errhandler_;
}
-void Comm::set_errhandler(MPI_Errhandler errhandler){
- errhandler_=errhandler;
- if(errhandler_!= MPI_ERRHANDLER_NULL)
- errhandler->ref();
+void Comm::set_errhandler(MPI_Errhandler errhandler)
+{
+ if (errhandler_ != MPI_ERRHANDLER_NULL)
+ simgrid::smpi::Errhandler::unref(errhandler_);
+ errhandler_ = errhandler;
+ if (errhandler_ != MPI_ERRHANDLER_NULL)
+ errhandler_->ref();
}
MPI_Comm Comm::split_type(int type, int /*key*/, MPI_Info)