- if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ //we need to switch as the called function may silently touch global variables
- smpi_switch_data_segment(smpi_process()->index());
- }
- //identify neighbours in comm
- //get the indexes of all processes sharing the same simix host
- xbt_swag_t process_list = sg_host_self()->extension<simgrid::simix::Host>()->process_list;
- int intra_comm_size = 0;
- int min_index = INT_MAX; // the minimum index will be the leader
- smx_actor_t actor = nullptr;
- xbt_swag_foreach(actor, process_list)
- {
- int index = actor->pid - 1;
-
- if (this->group()->rank(index) != MPI_UNDEFINED) {
- intra_comm_size++;
- // the process is in the comm
- if (index < min_index)
- min_index = index;
- }
- }
- XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size);
- MPI_Group group_intra = new Group(intra_comm_size);
- int i = 0;
- actor = nullptr;
- xbt_swag_foreach(actor, process_list) {
- int index = actor->pid -1;
- if(this->group()->rank(index)!=MPI_UNDEFINED){
- group_intra->set_mapping(index, i);
- i++;
- }
+ if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
+ // we need to switch as the called function may silently touch global variables
+ smpi_switch_data_segment(s4u::Actor::self());