Determines mapping from local to global virtual process rows
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_imagedistribution_obj), | intent(inout) | :: | imgdist |
image distribution |
||
type(array_i1d_obj), | intent(out) | :: | local_vrows |
local rows |
||
integer, | intent(in) | :: | local_vprow |
the local virtual process row |
SUBROUTINE dbcsr_get_local_vrows(imgdist, local_vrows, local_vprow) !! Determines mapping from local to global virtual process rows TYPE(dbcsr_imagedistribution_obj), INTENT(INOUT) :: imgdist !! image distribution TYPE(array_i1d_obj), INTENT(OUT) :: local_vrows !! local rows INTEGER, INTENT(IN) :: local_vprow !! the local virtual process row CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_get_local_vrows' INTEGER :: el, error_handle, nvprows, vprow INTEGER, ALLOCATABLE, DIMENSION(:) :: itmp, nle INTEGER, DIMENSION(:), POINTER :: vrow_dist IF (careful_mod) CALL timeset(routineN, error_handle) ! If the current local row mappings do not exist, create them. IF (.NOT. imgdist%i%has_other_vl_rows) THEN imgdist%i%has_other_vl_rows = .TRUE. nvprows = dbcsr_mp_nprows(dbcsr_distribution_mp(imgdist%i%main)) & *imgdist%i%row_decimation ALLOCATE (imgdist%i%other_vl_rows(0:nvprows - 1)) ALLOCATE (nle(0:nvprows - 1)) vrow_dist => array_data(imgdist%i%vrow_dist) ! Count the number of local elements per row. nle(:) = 0 DO el = 1, SIZE(vrow_dist) vprow = vrow_dist(el) nle(vprow) = nle(vprow) + 1 END DO DO vprow = 0, nvprows - 1 ALLOCATE (itmp(nle(vprow))) itmp = 0 CALL array_new(imgdist%i%other_vl_rows(vprow), & itmp, lb=1) DEALLOCATE (itmp) END DO DEALLOCATE (nle) CALL find_all_local_elements(imgdist%i%other_vl_rows, vrow_dist, nvprows) ELSE IF (careful_mod .AND. .NOT. ASSOCIATED(imgdist%i%other_vl_rows)) & DBCSR_ABORT("Local rows mapping does not exist.") END IF local_vrows = imgdist%i%other_vl_rows(local_vprow) IF (careful_mod) CALL timestop(error_handle) END SUBROUTINE dbcsr_get_local_vrows