+void Comm::set_errhandler(MPI_Errhandler errhandler)
+{
+ if(this != MPI_COMM_WORLD){
+ if (errhandler_ != MPI_ERRHANDLER_NULL)
+ simgrid::smpi::Errhandler::unref(errhandler_);
+ errhandler_ = errhandler;
+ }else{
+ if(errhandlers_==nullptr)
+ errhandlers_= new MPI_Errhandler[this->size()]{MPI_ERRHANDLER_NULL};
+ if(errhandlers_[this->rank()] != MPI_ERRHANDLER_NULL)
+ simgrid::smpi::Errhandler::unref(errhandlers_[this->rank()]);
+ errhandlers_[this->rank()]=errhandler;
+ }
+ if (errhandler != MPI_ERRHANDLER_NULL)
+ errhandler->ref();
+}
+
+MPI_Comm Comm::split_type(int type, int /*key*/, const Info*)
+{
+ //MPI_UNDEFINED can be given to some nodes... but we need them to still perform the smp part which is collective
+ if(type != MPI_COMM_TYPE_SHARED && type != MPI_UNDEFINED){
+ return MPI_COMM_NULL;
+ }
+ int leader=0;
+ MPI_Comm res= this->find_intra_comm(&leader);
+ if(type != MPI_UNDEFINED)
+ return res;
+ else{
+ xbt_assert(res->refcount_ == 1); // ensure the next call to Comm::destroy really frees the comm
+ Comm::destroy(res);
+ return MPI_COMM_NULL;
+ }
+}