Get local offset in owner’s window for a given (row, col)
Returns the displacement in the owner’s local_data array for the element at (row, col) in the global array. Data is stored column-major: offset = row + (local_col * nrows)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | nrows |
Number of rows in array |
||
| integer(kind=int32), | intent(in) | :: | ncols |
Number of rows in array Number of columns in array |
||
| integer(kind=int32), | intent(in) | :: | nranks |
Number of rows in array Number of columns in array Number of MPI ranks |
||
| integer(kind=int32), | intent(in) | :: | row |
Number of rows in array Number of columns in array Number of MPI ranks Row index (0-indexed) |
||
| integer(kind=int32), | intent(in) | :: | col |
Number of rows in array Number of columns in array Number of MPI ranks Row index (0-indexed) Column index (0-indexed) |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=int32), | private | :: | local_col | ||||
| integer(kind=int32), | private | :: | owner_first_col | ||||
| integer(kind=int32), | private | :: | owner_ncols |
pure function get_local_offset(nrows, ncols, nranks, row, col) result(offset) integer(int32), intent(in) :: nrows, ncols, nranks, row, col integer(MPI_ADDRESS_KIND) :: offset integer(int32) :: owner_first_col, owner_ncols, local_col call calculate_distribution(ncols, nranks, get_owner(ncols, nranks, col), & owner_first_col, owner_ncols) local_col = col - owner_first_col offset = int(row, MPI_ADDRESS_KIND) + int(local_col, MPI_ADDRESS_KIND)*int(nrows, MPI_ADDRESS_KIND) end function get_local_offset