-
- if (index_to_process_data == nullptr) {
- index_to_process_data = new int[SIMIX_process_count()];
- }
-
- bool smpirun = 0;
- if (process_count == 0) { // The program has been dispatched but no other
- // SMPI instances have been registered. We're using smpirun.
- smpirun = true;
- SMPI_app_instance_register(smpi_default_instance_name, nullptr,
- SIMIX_process_count()); // This call has a side effect on process_count...
- MPI_COMM_WORLD = *smpi_deployment_comm_world(smpi_default_instance_name);
- }
- smpi_universe_size = process_count;
- process_data = new simgrid::smpi::Process*[process_count];
- for (int i = 0; i < process_count; i++) {
- if (smpirun) {
- process_data[i] = new simgrid::smpi::Process(i, smpi_deployment_finalization_barrier(smpi_default_instance_name));
- smpi_deployment_register_process(smpi_default_instance_name, i, i);
- } else {
- // TODO We can pass a nullptr here because Process::set_data() assigns the
- // barrier from the instance anyway. This is ugly and should be changed
- process_data[i] = new simgrid::smpi::Process(i, nullptr);
- }
- }