delay_non_master Subroutine

private subroutine delay_non_master()

Delay non-master ranks/threads, used by dbcsr_abort_handler()

Arguments

None

Source Code

   SUBROUTINE delay_non_master()
      !! Delay non-master ranks/threads, used by dbcsr_abort_handler()
      INTEGER                                            :: unit_nr
      REAL(KIND=dp)                                      :: t1, wait_time

      wait_time = 0.0_dp

      ! we (ab)use the logger to determine the first MPI rank
      unit_nr = dbcsr_logger_get_default_io_unit()
      IF (unit_nr <= 0) &
         wait_time = wait_time + 1.0_dp ! rank-0 gets a head start of one second.

!$    IF (omp_get_thread_num() /= 0) &
!$       wait_time = wait_time + 1.0_dp ! master threads gets another second

      ! sleep
      IF (wait_time > 0.0_dp) THEN
         t1 = m_walltime()
         DO
            IF (m_walltime() - t1 > wait_time .OR. t1 < 0) EXIT
         END DO
      END IF

   END SUBROUTINE delay_non_master