Commit 52e538b3 authored by Pavel Kus's avatar Pavel Kus

adding mpi process id and num of processes to elpa index

parent f6903d13
......@@ -255,9 +255,10 @@ module elpa_impl
subroutine set_or_check_missing_comm_params(self)
implicit none
class(elpa_impl_t), intent(inout) :: self
integer :: mpi_comm_rows, mpi_comm_cols, mpierr, error, &
my_prow, my_pcol, present_my_prow, present_my_pcol, &
np_rows, np_cols, present_np_rows, present_np_cols
integer :: mpi_comm_parent, mpi_comm_rows, mpi_comm_cols, mpierr, error, &
my_prow, my_pcol, my_id, present_my_prow, present_my_pcol, present_my_id, &
np_rows, np_cols, np_total, present_np_rows, present_np_cols, present_np_total, &
if (.not. (self%is_set("mpi_comm_rows") == 1 .and. self%is_set("mpi_comm_cols") == 1) ) then
print *,"MPI row and column communicators not set correctly. Aborting..."
......@@ -308,6 +309,54 @@ module elpa_impl
call self%set("process_col", my_pcol, error)
! sadly, at the moment, the parent mpi communicator is not required to be set, e.g. in legacy tests
! we thus cannot obtain process_id
! we can, however, determine the number of prcesses and determine, whether the given process has id 0,
! assuming, that that is the wan with row and column ids == 0
is_process_id_zero = 0
if (self%is_set("mpi_comm_parent") == 1) then
call self%get("mpi_comm_parent", mpi_comm_parent, error)
call mpi_comm_size(mpi_comm_parent, np_total, mpierr)
if(self%is_set("num_processes") == 1) then
call self%get("num_processes", present_np_total, error)
if(np_total .ne. present_np_total) then
print *,"MPI parent communicator not set correctly. Aborting..."
call self%set("num_processes", np_total, error)
if(np_total .ne. np_rows * np_cols) then
print *,"MPI parent communicator and row/col communicators do not match. Aborting..."
call mpi_comm_rank(mpi_comm_parent, my_id, mpierr)
if(self%is_set("process_id") == 1) then
call self%get("process_id", present_my_id, error)
if(my_id .ne. present_my_id) then
print *,"MPI parent communicator not set correctly. Aborting..."
call self%set("process_id", my_id, error)
if(my_id == 0) &
is_process_id_zero = 1
! we can set number of processes and whether process id is zero, but not the process id.
! we assume, that my_pcol == 0 && my_prow == 0 <==> my_id == 0
call self%set("num_process", np_rows * np_cols, error)
if((my_prow == 0) .and. (my_pcol == 0)) &
is_process_id_zero = 1
call self%set("is_process_id_zero", is_process_id_zero, error)
end subroutine
!> \brief function to setup an ELPA object and to store the MPI communicators internally
......@@ -168,8 +168,11 @@ static const elpa_index_int_entry_t int_entries[] = {
INT_PARAMETER_ENTRY("local_ncols", "Number of matrix columns stored on this process", NULL),
INT_PARAMETER_ENTRY("process_row", "Process row number in the 2D domain decomposition", NULL),
INT_PARAMETER_ENTRY("process_col", "Process column number in the 2D domain decomposition", NULL),
INT_PARAMETER_ENTRY("process_id", "Process rank", NULL),
INT_PARAMETER_ENTRY("is_process_id_zero", "Is it a process with rank zero?", NULL),
INT_PARAMETER_ENTRY("num_process_rows", "Number of process row number in the 2D domain decomposition", NULL),
INT_PARAMETER_ENTRY("num_process_cols", "Number of process column number in the 2D domain decomposition", NULL),
INT_PARAMETER_ENTRY("num_processes", "Total number of processes", NULL),
INT_PARAMETER_ENTRY("bandwidth", "If specified, a band matrix with this bandwidth is expected as input; bandwidth must be multiply of nblk", bw_is_valid),
INT_PARAMETER_ENTRY("suppress_warnings", "If specified, warnings will NOT be printed on this mpi rank", NULL),
INT_ANY_ENTRY("mpi_comm_rows", "Communicator for inter-row communication"),
......@@ -1024,6 +1027,8 @@ int elpa_index_print_autotune_parameters(elpa_index_t index, int autotune_level,
int elpa_index_print_all_parameters(elpa_index_t index) {
int process_id = elpa_index_get_int_value(index, "process_id", NULL);
if(process_id == 0){
for (int i = 0; i < nelements(int_entries); i++) {
fprintf(stderr, " %s = ", int_entries[i];
if (int_entries[i].to_string) {
......@@ -1033,6 +1038,7 @@ int elpa_index_print_all_parameters(elpa_index_t index) {
fprintf(stderr, "\n");
return 1;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment