dbcsr_distribution_get_num_images_1d Function

public function dbcsr_distribution_get_num_images_1d(matrix_dense_size_1d, nblocks, nprows, npcols) result(num_images_1d)

Count number of images in the product matrix

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: matrix_dense_size_1d

1D size of the (equivalent) dense matrix Number of row processors Number of column processors

integer, intent(in) :: nblocks

1D size of the (equivalent) dense matrix Number of row processors Number of column processors

integer, intent(in) :: nprows

1D size of the (equivalent) dense matrix Number of row processors Number of column processors

integer, intent(in) :: npcols

1D size of the (equivalent) dense matrix Number of row processors Number of column processors

Return Value integer

Number of images


Source Code

   FUNCTION dbcsr_distribution_get_num_images_1d(matrix_dense_size_1d, nblocks, &
                                                 nprows, npcols) RESULT(num_images_1d)
      !! Count number of images in the product matrix

      INTEGER, INTENT(IN)                                :: matrix_dense_size_1d, nblocks, nprows, &
                                                            npcols
         !! 1D size of the (equivalent) dense matrix
         !! Number of row processors
         !! Number of column processors
      INTEGER                                            :: num_images_1d
         !! Number of images

      INTEGER                                            :: lcmv

      lcmv = lcm(nprows, npcols)
      num_images_1d = lcmv
      IF (dbcsr_cfg%num_mult_images%val .GT. 1) THEN
         num_images_1d = num_images_1d*dbcsr_cfg%num_mult_images%val
         RETURN
      END IF
      IF (matrix_dense_size_1d .EQ. 0) RETURN
      !
      IF (dbcsr_cfg%avg_elements_images%val .GT. 0) THEN
         num_images_1d = num_images_1d* &
                         CEILING((REAL(matrix_dense_size_1d, KIND=dp)/num_images_1d)/ &
                                 SQRT(REAL(dbcsr_cfg%avg_elements_images%val, KIND=dp)))
      END IF
      ! limiting # clusters to be close to # atoms
      IF (num_images_1d .GT. nblocks .AND. nblocks .GT. 0) THEN
         num_images_1d = CEILING(REAL(nblocks, KIND=dp)/lcmv)*lcmv
      END IF
   END FUNCTION dbcsr_distribution_get_num_images_1d