+int check_collectives_ordering(MPI_Comm comm, std::string call){
+ if(_smpi_cfg_pedantic){
+ unsigned int count = comm->get_collectives_count();
+ comm->increment_collectives_count();
+ auto vec = collective_calls.find(comm->id());
+ if (vec == collective_calls.end()) {
+ collective_calls.emplace(comm->id(), std::vector<std::string>{call});
+ }else{
+ //are we the first ? add the call
+ if (vec->second.size() == (count)){
+ vec->second.push_back(call);
+ } else if (vec->second.size() > count){
+ if (vec->second[count] != call){
+ XBT_WARN("Collective communication mismatch. For process %ld, expected %s, got %s", simgrid::s4u::this_actor::get_pid(), vec->second[count].c_str(), call.c_str());
+ return MPI_ERR_OTHER;
+ }
+ } else {
+ THROW_IMPOSSIBLE;
+ }
+ }
+ }
+ return MPI_SUCCESS;
+}
+