smm_process_mm_stack_c Subroutine

private subroutine smm_process_mm_stack_c(stack_descr, params, stack_size, a_data, b_data, c_data, used_smm)

Processes MM stack and issues SMM library calls

Arguments

TypeIntentOptionalAttributesName
type(stack_descriptor_type), intent(in) :: stack_descr
integer, intent(in), DIMENSION(dbcsr_ps_width, 1:stack_size):: params

Stack of MM parameters

integer, intent(in) :: stack_size

Number of parameters

complex(kind=real_4), intent(in), DIMENSION(*):: a_data

Left-matrix data Right-matrix data

complex(kind=real_4), intent(in), DIMENSION(*):: b_data

Left-matrix data Right-matrix data

complex(kind=real_4), intent(inout), DIMENSION(*):: c_data

Product data

logical, intent(out) :: used_smm

Contents


Source Code

      SUBROUTINE smm_process_mm_stack_c (stack_descr, params, &
                                                     stack_size, &
                                                     a_data, b_data, c_data, used_smm)
     !! Processes MM stack and issues SMM library calls

         INTEGER, INTENT(IN)                       :: stack_size
        !! Number of parameters
         TYPE(stack_descriptor_type), INTENT(IN)   :: stack_descr
         INTEGER, DIMENSION(dbcsr_ps_width, 1:stack_size), &
            INTENT(IN)                              :: params
        !! Stack of MM parameters
         COMPLEX(kind=real_4), DIMENSION(*), INTENT(IN)         :: a_data, &
            b_data
        !! Left-matrix data
        !! Right-matrix data
         COMPLEX(kind=real_4), DIMENSION(*), INTENT(INOUT)      :: c_data
        !! Product data
         LOGICAL, INTENT(OUT)                      :: used_smm

#if defined(__HAS_smm_cnn)

         INTEGER                                   :: sp

         ! TODO we have no way of knowing which calls to libsmm actually resolve to BLAS
         ! Fixing this requires an interface change to libsmm.
         used_smm = .TRUE.

#if defined(__HAS_smm_vec)
         IF (stack_descr%defined_mnk) THEN
            CALL smm_vec_cnn(stack_descr%m, stack_descr%n, stack_descr%k, &
                                         a_data, b_data, c_data, stack_size, &
                                         dbcsr_ps_width, params, p_a_first, p_b_first, p_c_first)
            RETURN
         END IF
#endif

         DO sp = 1, stack_size
            CALL smm_cnn( &
               params(p_m, sp), &
               params(p_n, sp), &
               params(p_k, sp), &
               a_data(params(p_a_first, sp)), &
               b_data(params(p_b_first, sp)), &
               c_data(params(p_c_first, sp)))
         END DO

#else
         ! We do not want to abort here, fall back to BLAS.
         used_smm = .FALSE.
         CALL blas_process_mm_stack_c (params, stack_size, a_data, b_data, c_data)
#endif

         MARK_USED(stack_descr)
      END SUBROUTINE smm_process_mm_stack_c