Create meta indices
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_buffer), | intent(inout) | :: | buffer | |||
integer, | intent(in) | :: | ntotal_images | |||
integer, | intent(in) | :: | vprow | |||
integer, | intent(in) | :: | vpcol | |||
type(dbcsr_imagedistribution_obj), | intent(inout) | :: | imgdist | |||
logical, | intent(in) | :: | do_merge_rows | |||
integer, | intent(in), | DIMENSION(:) | :: | global_indices | ||
integer, | intent(in), | optional | :: | nthreads |
SUBROUTINE make_meta(buffer, ntotal_images, &
!! Create meta indices
vprow, vpcol, &
imgdist, do_merge_rows, &
global_indices, &
nthreads)
TYPE(dbcsr_buffer), INTENT(INOUT) :: buffer
INTEGER, INTENT(IN) :: ntotal_images, vprow, vpcol
TYPE(dbcsr_imagedistribution_obj), INTENT(INOUT) :: imgdist
LOGICAL, INTENT(IN) :: do_merge_rows
INTEGER, DIMENSION(:), INTENT(IN) :: global_indices
INTEGER, INTENT(IN), OPTIONAL :: nthreads
INTEGER :: size_index
buffer%matrix%index(dbcsr_slot_size) = &
buffer%meta_size + dbcsr_num_slots
size_index = 0
IF (PRESENT(nthreads)) THEN
!$ size_index = nthreads + 1
END IF
buffer%matrix%index(dbcsr_slot_nblks) = &
(buffer%meta_size - size_index)/3
buffer%matrix%index(dbcsr_slot_nze) = &
dbcsr_data_get_size_referenced(buffer%data)
buffer%matrix%index(dbcsr_slot_dense) = 0
buffer%matrix%index(dbcsr_slot_nblkrows_total:dbcsr_slot_nfullcols_local) = &
global_indices(:)
buffer%matrix%index(dbcsr_slot_type:dbcsr_num_slots) = 0
! Virtual coords
IF (do_merge_rows) THEN
buffer%matrix%index(dbcsr_slot_home_vprow) = vprow
buffer%matrix%index(dbcsr_slot_home_vpcol) = MOD(vpcol, ntotal_images)
ELSE
buffer%matrix%index(dbcsr_slot_home_vprow) = MOD(vprow, ntotal_images)
buffer%matrix%index(dbcsr_slot_home_vpcol) = vpcol
END IF
buffer%matrix%index(dbcsr_slot_row_p) = 1
buffer%matrix%index(dbcsr_slot_col_i) = 1
buffer%matrix%index(dbcsr_slot_blk_p) = 1
! thr_c
size_index = dbcsr_num_slots
!$ IF (PRESENT(nthreads)) THEN
!$ size_index = size_index + nthreads + 1
!$ buffer%matrix%index(dbcsr_slot_thr_c) = dbcsr_num_slots + 1
!$ buffer%matrix%index(dbcsr_slot_thr_c + 1) = size_index
!$ END IF
buffer%matrix%index(dbcsr_slot_coo_l) = size_index + 1
buffer%matrix%index(dbcsr_num_slots) = buffer%matrix%index(dbcsr_slot_size)
!
! Reset
CALL dbcsr_reset_vlocals(buffer%matrix, imgdist)
!
! Repoint index
buffer%matrix%nblks = 0
buffer%matrix%nze = 0
CALL dbcsr_repoint_index(buffer%matrix)
buffer%matrix%valid = .TRUE.
END SUBROUTINE make_meta