// 2) determine the offset of each process
types::global_cell_index cell_index = 0;
- MPI_Exscan(&n_locally_owned_cells,
- &cell_index,
- 1,
- Utilities::MPI::internal::mpi_type_id(&n_locally_owned_cells),
- MPI_SUM,
- this->mpi_communicator);
+ const int ierr =
+ MPI_Exscan(&n_locally_owned_cells,
+ &cell_index,
+ 1,
+ Utilities::MPI::internal::mpi_type_id(&n_locally_owned_cells),
+ MPI_SUM,
+ this->mpi_communicator);
+ AssertThrowMPI(ierr);
// 3) give global indices to locally-owned cells and mark all other cells as
// invalid
std::vector<types::global_cell_index> cell_index(
this->n_global_levels(), 0);
- MPI_Exscan(n_locally_owned_cells.data(),
- cell_index.data(),
- this->n_global_levels(),
- Utilities::MPI::internal::mpi_type_id(
- n_locally_owned_cells.data()),
- MPI_SUM,
- this->mpi_communicator);
+ int ierr = MPI_Exscan(n_locally_owned_cells.data(),
+ cell_index.data(),
+ this->n_global_levels(),
+ Utilities::MPI::internal::mpi_type_id(
+ n_locally_owned_cells.data()),
+ MPI_SUM,
+ this->mpi_communicator);
+ AssertThrowMPI(ierr);
// 3) determine global number of "active" cells on each level
std::vector<types::global_cell_index> n_cells_level(
for (unsigned int l = 0; l < this->n_global_levels(); ++l)
n_cells_level[l] = n_locally_owned_cells[l] + cell_index[l];
- MPI_Bcast(n_cells_level.data(),
- this->n_global_levels(),
- Utilities::MPI::internal::mpi_type_id(n_cells_level.data()),
- this->n_subdomains - 1,
- this->mpi_communicator);
+ ierr =
+ MPI_Bcast(n_cells_level.data(),
+ this->n_global_levels(),
+ Utilities::MPI::internal::mpi_type_id(n_cells_level.data()),
+ this->n_subdomains - 1,
+ this->mpi_communicator);
+ AssertThrowMPI(ierr);
// 4) give global indices to locally-owned cells on level and mark
// all other cells as invalid
sm_import_ranks.size());
for (unsigned int i = 0; i < sm_ghost_ranks.size(); i++)
- MPI_Isend(sm_export_data_this_indices.data() +
- sm_export_data_this_ptr[i],
- sm_export_data_this_ptr[i + 1] -
- sm_export_data_this_ptr[i],
- MPI_UNSIGNED,
- sm_ghost_ranks[i],
- 4,
- comm_sm,
- requests.data() + i);
+ {
+ const int ierr = MPI_Isend(sm_export_data_this_indices.data() +
+ sm_export_data_this_ptr[i],
+ sm_export_data_this_ptr[i + 1] -
+ sm_export_data_this_ptr[i],
+ MPI_UNSIGNED,
+ sm_ghost_ranks[i],
+ 4,
+ comm_sm,
+ requests.data() + i);
+ AssertThrowMPI(ierr);
+ }
for (unsigned int i = 0; i < sm_import_ranks.size(); i++)
- MPI_Irecv(sm_import_data_indices.data() + sm_import_data_ptr[i],
- sm_import_data_ptr[i + 1] - sm_import_data_ptr[i],
- MPI_UNSIGNED,
- sm_import_ranks[i],
- 4,
- comm_sm,
- requests.data() + sm_ghost_ranks.size() + i);
+ {
+ const int ierr =
+ MPI_Irecv(sm_import_data_indices.data() + sm_import_data_ptr[i],
+ sm_import_data_ptr[i + 1] - sm_import_data_ptr[i],
+ MPI_UNSIGNED,
+ sm_import_ranks[i],
+ 4,
+ comm_sm,
+ requests.data() + sm_ghost_ranks.size() + i);
+ AssertThrowMPI(ierr);
+ }
- MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ const int ierr =
+ MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ AssertThrowMPI(ierr);
}
// send sm_import_data_this to sm-neighbor -> sm_export_data_indices
sm_ghost_ranks.size());
for (unsigned int i = 0; i < sm_import_ranks.size(); i++)
- MPI_Isend(sm_import_data_this_indices.data() +
- sm_import_data_this_ptr[i],
- sm_import_data_this_ptr[i + 1] -
- sm_import_data_this_ptr[i],
- MPI_UNSIGNED,
- sm_import_ranks[i],
- 2,
- comm_sm,
- requests.data() + i);
+ {
+ const int ierr = MPI_Isend(sm_import_data_this_indices.data() +
+ sm_import_data_this_ptr[i],
+ sm_import_data_this_ptr[i + 1] -
+ sm_import_data_this_ptr[i],
+ MPI_UNSIGNED,
+ sm_import_ranks[i],
+ 2,
+ comm_sm,
+ requests.data() + i);
+ AssertThrowMPI(ierr);
+ }
for (unsigned int i = 0; i < sm_ghost_ranks.size(); i++)
- MPI_Irecv(sm_export_data_indices.data() + sm_export_data_ptr[i],
- sm_export_data_ptr[i + 1] - sm_export_data_ptr[i],
- MPI_UNSIGNED,
- sm_ghost_ranks[i],
- 2,
- comm_sm,
- requests.data() + sm_import_ranks.size() + i);
+ {
+ const int ierr =
+ MPI_Irecv(sm_export_data_indices.data() + sm_export_data_ptr[i],
+ sm_export_data_ptr[i + 1] - sm_export_data_ptr[i],
+ MPI_UNSIGNED,
+ sm_ghost_ranks[i],
+ 2,
+ comm_sm,
+ requests.data() + sm_import_ranks.size() + i);
+ AssertThrowMPI(ierr);
+ }
- MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ const int ierr =
+ MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ AssertThrowMPI(ierr);
}
// store data structures and, if needed, compress them
int dummy;
// receive a signal that relevant sm neighbors are ready
for (unsigned int i = 0; i < sm_ghost_ranks.size(); i++)
- MPI_Irecv(&dummy,
- 0,
- MPI_INT,
- sm_ghost_ranks[i],
- communication_channel + 0,
- comm_sm,
- requests.data() + sm_import_ranks.size() + i);
+ {
+ const int ierr =
+ MPI_Irecv(&dummy,
+ 0,
+ MPI_INT,
+ sm_ghost_ranks[i],
+ communication_channel + 0,
+ comm_sm,
+ requests.data() + sm_import_ranks.size() + i);
+ AssertThrowMPI(ierr);
+ }
// signal to all relevant sm neighbors that this process is ready
for (unsigned int i = 0; i < sm_import_ranks.size(); i++)
- MPI_Isend(&dummy,
- 0,
- MPI_INT,
- sm_import_ranks[i],
- communication_channel + 0,
- comm_sm,
- requests.data() + i);
+ {
+ const int ierr = MPI_Isend(&dummy,
+ 0,
+ MPI_INT,
+ sm_import_ranks[i],
+ communication_channel + 0,
+ comm_sm,
+ requests.data() + i);
+ AssertThrowMPI(ierr);
+ }
// receive data from remote processes
for (unsigned int i = 0; i < ghost_targets_data.size(); i++)
n_ghost_indices_in_larger_set_by_remote_rank[i] -
ghost_targets_data[i][2];
- MPI_Irecv(buffer.data() + ghost_targets_data[i][1] + offset,
- ghost_targets_data[i][2],
- Utilities::MPI::internal::mpi_type_id(buffer.data()),
- ghost_targets_data[i][0],
- communication_channel + 1,
- comm,
- requests.data() + sm_import_ranks.size() +
- sm_ghost_ranks.size() + i);
+ const int ierr =
+ MPI_Irecv(buffer.data() + ghost_targets_data[i][1] + offset,
+ ghost_targets_data[i][2],
+ Utilities::MPI::internal::mpi_type_id(buffer.data()),
+ ghost_targets_data[i][0],
+ communication_channel + 1,
+ comm,
+ requests.data() + sm_import_ranks.size() +
+ sm_ghost_ranks.size() + i);
+ AssertThrowMPI(ierr);
}
// send data to remote processes
data_this[import_indices_data.second[j].first + l];
// send data away
- MPI_Isend(temporary_storage.data() + import_targets_data[i][1],
- import_targets_data[i][2],
- Utilities::MPI::internal::mpi_type_id(data_this.data()),
- import_targets_data[i][0],
- communication_channel + 1,
- comm,
- requests.data() + sm_import_ranks.size() +
- sm_ghost_ranks.size() + ghost_targets_data.size() + i);
+ const int ierr =
+ MPI_Isend(temporary_storage.data() + import_targets_data[i][1],
+ import_targets_data[i][2],
+ Utilities::MPI::internal::mpi_type_id(data_this.data()),
+ import_targets_data[i][0],
+ communication_channel + 1,
+ comm,
+ requests.data() + sm_import_ranks.size() +
+ sm_ghost_ranks.size() + ghost_targets_data.size() +
+ i);
+ AssertThrowMPI(ierr);
}
#endif
}
c < sm_ghost_ranks.size() + ghost_targets_data.size();
c++)
{
- int i;
- MPI_Waitany(sm_ghost_ranks.size() + ghost_targets_data.size(),
- requests.data() + sm_import_ranks.size(),
- &i,
- MPI_STATUS_IGNORE);
+ int i;
+ const int ierr =
+ MPI_Waitany(sm_ghost_ranks.size() + ghost_targets_data.size(),
+ requests.data() + sm_import_ranks.size(),
+ &i,
+ MPI_STATUS_IGNORE);
+ AssertThrowMPI(ierr);
const auto s = split(i);
i = s.second;
}
}
- MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ const int ierr =
+ MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ AssertThrowMPI(ierr);
+
#endif
}
int dummy;
for (unsigned int i = 0; i < sm_ghost_ranks.size(); i++)
- MPI_Isend(&dummy,
- 0,
- MPI_INT,
- sm_ghost_ranks[i],
- communication_channel + 1,
- comm_sm,
- requests.data() + i);
+ {
+ const int ierr = MPI_Isend(&dummy,
+ 0,
+ MPI_INT,
+ sm_ghost_ranks[i],
+ communication_channel + 1,
+ comm_sm,
+ requests.data() + i);
+ AssertThrowMPI(ierr);
+ }
for (unsigned int i = 0; i < sm_import_ranks.size(); i++)
- MPI_Irecv(&dummy,
- 0,
- MPI_INT,
- sm_import_ranks[i],
- communication_channel + 1,
- comm_sm,
- requests.data() + sm_ghost_ranks.size() + i);
+ {
+ const int ierr =
+ MPI_Irecv(&dummy,
+ 0,
+ MPI_INT,
+ sm_import_ranks[i],
+ communication_channel + 1,
+ comm_sm,
+ requests.data() + sm_ghost_ranks.size() + i);
+ AssertThrowMPI(ierr);
+ }
for (unsigned int i = 0; i < ghost_targets_data.size(); i++)
{
}
}
- MPI_Isend(buffer.data() + ghost_targets_data[i][1],
- ghost_targets_data[i][2],
- Utilities::MPI::internal::mpi_type_id(buffer.data()),
- ghost_targets_data[i][0],
- communication_channel + 0,
- comm,
- requests.data() + sm_ghost_ranks.size() +
- sm_import_ranks.size() + i);
+ const int ierr =
+ MPI_Isend(buffer.data() + ghost_targets_data[i][1],
+ ghost_targets_data[i][2],
+ Utilities::MPI::internal::mpi_type_id(buffer.data()),
+ ghost_targets_data[i][0],
+ communication_channel + 0,
+ comm,
+ requests.data() + sm_ghost_ranks.size() +
+ sm_import_ranks.size() + i);
+ AssertThrowMPI(ierr);
}
for (unsigned int i = 0; i < import_targets_data.size(); i++)
- MPI_Irecv(temporary_storage.data() + import_targets_data[i][1],
- import_targets_data[i][2],
- Utilities::MPI::internal::mpi_type_id(
- temporary_storage.data()),
- import_targets_data[i][0],
- communication_channel + 0,
- comm,
- requests.data() + sm_ghost_ranks.size() +
- sm_import_ranks.size() + ghost_targets_data.size() + i);
+ {
+ const int ierr = MPI_Irecv(
+ temporary_storage.data() + import_targets_data[i][1],
+ import_targets_data[i][2],
+ Utilities::MPI::internal::mpi_type_id(temporary_storage.data()),
+ import_targets_data[i][0],
+ communication_channel + 0,
+ comm,
+ requests.data() + sm_ghost_ranks.size() + sm_import_ranks.size() +
+ ghost_targets_data.size() + i);
+ AssertThrowMPI(ierr);
+ }
#endif
}
ghost_targets_data.size();
c++)
{
- int i;
- MPI_Waitany(sm_import_ranks.size() + import_targets_data.size() +
- ghost_targets_data.size(),
- requests.data() + sm_ghost_ranks.size(),
- &i,
- MPI_STATUS_IGNORE);
+ int i;
+ const int ierr =
+ MPI_Waitany(sm_import_ranks.size() + import_targets_data.size() +
+ ghost_targets_data.size(),
+ requests.data() + sm_ghost_ranks.size(),
+ &i,
+ MPI_STATUS_IGNORE);
+ AssertThrowMPI(ierr);
const auto &s = split(i);
i = s.second;
}
}
- MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ const int ierr =
+ MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
+ AssertThrowMPI(ierr);
#endif
}