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

TypeIntentOptionalAttributesName
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


Contents


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 .GT. 1) THEN
         num_images_1d = num_images_1d*dbcsr_cfg%num_mult_images
         RETURN
      END IF
      IF (matrix_dense_size_1d .EQ. 0) RETURN
      !
      IF (dbcsr_cfg%avg_elements_images .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, 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