dbcsr_mm_csr_multiply Subroutine

public subroutine dbcsr_mm_csr_multiply(this, left, right, mi, mf, ni, nf, ki, kf, ai, af, bi, bf, m_sizes, n_sizes, k_sizes, c_local_rows, c_local_cols, c_has_symmetry, keep_sparsity, use_eps, row_max_epss, flop, a_index, b_index, a_norms, b_norms)

A wrapper around dbcsr_mm_csr_multiply_low to avoid expensive dereferencings.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_mm_csr_type), intent(inout) :: this
type(dbcsr_type), intent(in) :: left
type(dbcsr_type), intent(in) :: right
integer, intent(in) :: mi
integer, intent(in) :: mf
integer, intent(in) :: ni
integer, intent(in) :: nf
integer, intent(in) :: ki
integer, intent(in) :: kf
integer, intent(in) :: ai
integer, intent(in) :: af
integer, intent(in) :: bi
integer, intent(in) :: bf
integer, intent(inout), DIMENSION(:) :: m_sizes
integer, intent(inout), DIMENSION(:) :: n_sizes
integer, intent(inout), DIMENSION(:) :: k_sizes
integer, intent(inout), DIMENSION(:) :: c_local_rows
integer, intent(inout), DIMENSION(:) :: c_local_cols
logical, intent(inout) :: c_has_symmetry
logical, intent(inout) :: keep_sparsity
logical, intent(inout) :: use_eps
real(kind=sp), DIMENSION(:) :: row_max_epss
integer(kind=int_8), intent(inout) :: flop
integer, intent(in), DIMENSION(1:3, 1:af) :: a_index
integer, intent(in), DIMENSION(1:3, 1:bf) :: b_index
real(kind=sp), DIMENSION(:), POINTER :: a_norms
real(kind=sp), DIMENSION(:), POINTER :: b_norms

Source Code

   SUBROUTINE dbcsr_mm_csr_multiply(this, left, right, mi, mf, ni, nf, ki, kf, &
      !! A wrapper around dbcsr_mm_csr_multiply_low to avoid expensive dereferencings.
                                    ai, af, &
                                    bi, bf, &
                                    m_sizes, n_sizes, k_sizes, &
                                    c_local_rows, c_local_cols, &
                                    c_has_symmetry, keep_sparsity, use_eps, &
                                    row_max_epss, &
                                    flop, &
                                    a_index, b_index, a_norms, b_norms)
      TYPE(dbcsr_mm_csr_type), INTENT(INOUT)             :: this
      TYPE(dbcsr_type), INTENT(IN)                       :: left, right
      INTEGER, INTENT(IN)                                :: mi, mf, ni, nf, ki, kf, ai, af, bi, bf
      INTEGER, DIMENSION(:), INTENT(INOUT)               :: m_sizes, n_sizes, k_sizes, c_local_rows, &
                                                            c_local_cols
      LOGICAL, INTENT(INOUT)                             :: c_has_symmetry, keep_sparsity, use_eps
      REAL(kind=sp), DIMENSION(:)                        :: row_max_epss
      INTEGER(KIND=int_8), INTENT(INOUT)                 :: flop
      INTEGER, DIMENSION(1:3, 1:af), INTENT(IN)          :: a_index
      INTEGER, DIMENSION(1:3, 1:bf), INTENT(IN)          :: b_index
      REAL(KIND=sp), DIMENSION(:), POINTER               :: a_norms, b_norms

      INTEGER                                            :: ithread, max_new_nblks, nblks_new

      ithread = 0
!$    ithread = omp_get_thread_num()

      ! This has to be done here because ensure_array_size() expects a pointer.
      ! the maximum number of blocks can be safely estimated by considering both the rowxcol,
      ! but also the blocks the latter can never be larger than norec**2, which is a 'small' constant
      max_new_nblks = INT(MIN(INT(mf - mi + 1, int_8)*INT(nf - ni + 1, int_8), &
                              INT(af - ai + 1, int_8)*INT(bf - bi + 1, int_8)))

      nblks_new = this%product_wm%lastblk + max_new_nblks

      CALL ensure_array_size(this%product_wm%row_i, ub=nblks_new, &
                             factor=default_resize_factor)
      CALL ensure_array_size(this%product_wm%col_i, ub=nblks_new, &
                             factor=default_resize_factor)
      CALL ensure_array_size(this%product_wm%blk_p, ub=nblks_new, &
                             factor=default_resize_factor)

      CALL dbcsr_mm_csr_multiply_low(this, left=left, right=right, &
                                     mi=mi, mf=mf, ki=ki, kf=kf, &
                                     ai=ai, af=af, &
                                     bi=bi, bf=bf, &
                                     c_row_i=this%product_wm%row_i, &
                                     c_col_i=this%product_wm%col_i, &
                                     c_blk_p=this%product_wm%blk_p, &
                                     lastblk=this%product_wm%lastblk, &
                                     datasize=this%product_wm%datasize, &
                                     m_sizes=m_sizes, n_sizes=n_sizes, k_sizes=k_sizes, &
                                     c_local_rows=c_local_rows, c_local_cols=c_local_cols, &
                                     c_has_symmetry=c_has_symmetry, keep_sparsity=keep_sparsity, &
                                     use_eps=use_eps, &
                                     row_max_epss=row_max_epss, &
                                     flop=flop, &
                                     row_size_maps=this%m_size_maps, &
                                     col_size_maps=this%n_size_maps, &
                                     k_size_maps=this%k_size_maps, &
                                     row_size_maps_size=this%m_size_maps_size, &
                                     col_size_maps_size=this%n_size_maps_size, &
                                     k_size_maps_size=this%k_size_maps_size, &
                                     nm_stacks=this%nm_stacks, nn_stacks=this%nn_stacks, &
                                     nk_stacks=this%nk_stacks, &
                                     stack_map=this%stack_map, &
                                     stacks_data=this%stacks_data, &
                                     stacks_fillcount=this%stacks_fillcount, &
                                     c_hashes=this%c_hashes, &
                                     a_index=a_index, b_index=b_index, &
                                     a_norms=a_norms, b_norms=b_norms)

   END SUBROUTINE dbcsr_mm_csr_multiply