dbcsr_mp_grid_setup Subroutine

public subroutine dbcsr_mp_grid_setup(mp_env)

Sets up MPI cartesian process grid

Arguments

TypeIntentOptionalAttributesName
type(dbcsr_mp_obj), intent(inout) :: mp_env

multiprocessor environment


Contents

Source Code


Source Code

   SUBROUTINE dbcsr_mp_grid_setup(mp_env)
      !! Sets up MPI cartesian process grid

      TYPE(dbcsr_mp_obj), INTENT(INOUT)                  :: mp_env
         !! multiprocessor environment

      INTEGER                                            :: ndims, tmp_group
      INTEGER, DIMENSION(2)                              :: dims, my_pos
      LOGICAL, DIMENSION(2)                              :: remain

!   ---------------------------------------------------------------------------

      IF (.NOT. mp_env%mp%subgroups_defined) THEN
         ! KG workaround.
         ! This will be deleted (replaced by code in mp_new).
         ndims = 2
         dims(1:2) = (/SIZE(mp_env%mp%pgrid, 1), SIZE(mp_env%mp%pgrid, 2)/)
         CALL mp_cart_create(mp_env%mp%mp_group, ndims, &
                             dims, my_pos, &
                             tmp_group)
         IF (my_pos(1) .NE. mp_env%mp%myprow) &
            DBCSR_ABORT("Got different MPI process grid")
         IF (my_pos(2) .NE. mp_env%mp%mypcol) &
            DBCSR_ABORT("Got different MPI process grid")
         !
         remain = (/.FALSE., .TRUE./)
         CALL mp_cart_sub(tmp_group, remain, mp_env%mp%prow_group)
         remain = (/.TRUE., .FALSE./)
         CALL mp_cart_sub(tmp_group, remain, mp_env%mp%pcol_group)
         CALL mp_comm_free(tmp_group)
         mp_env%mp%subgroups_defined = .TRUE.
      END IF
   END SUBROUTINE dbcsr_mp_grid_setup