std::unordered_map<std::string, unsigned int> sent_messages_;
std::unordered_map<std::string, unsigned int> recv_messages_;
unsigned int collectives_count_ = 0;
- unsigned int* collectives_counts_ = nullptr; //for MPI_COMM_WORLD only
-
+ std::unique_ptr<unsigned int[]> collectives_counts_; // for MPI_COMM_WORLD only
public:
static std::unordered_map<int, smpi_key_elem> keyvals_;
delete[] comm->errhandlers_;
} else if (comm->errhandler_ != MPI_ERRHANDLER_NULL)
simgrid::smpi::Errhandler::unref(comm->errhandler_);
- if(comm->collectives_counts_!=nullptr)
- delete[] comm->collectives_counts_;
}
Group::unref(comm->group_);
if(comm->refcount_==0)
if (this==MPI_COMM_UNINITIALIZED){
return smpi_process()->comm_world()->get_collectives_count();
}else if(this == MPI_COMM_WORLD || this == smpi_process()->comm_world()){
- if(collectives_counts_==nullptr)
- collectives_counts_=new unsigned int[this->size()]{0};
+ if (not collectives_counts_)
+ collectives_counts_ = std::make_unique<unsigned int[]>(this->size());
return collectives_counts_[this->rank()];
}else{
return collectives_count_;
if (this==MPI_COMM_UNINITIALIZED){
smpi_process()->comm_world()->increment_collectives_count();
}else if (this == MPI_COMM_WORLD || this == smpi_process()->comm_world()){
- if(collectives_counts_==nullptr)
- collectives_counts_=new unsigned int[this->size()]{0};
+ if (not collectives_counts_)
+ collectives_counts_ = std::make_unique<unsigned int[]>(this->size());
collectives_counts_[this->rank()]++;
}else{
collectives_count_++;