SUBROUTINE ONEDVAR_RAINTB_PRB(KHLPRDY,KT)
!****-------------------------------------------------------------------
!**** *ONEDVAR_RAINTB_PRB* - ONEDVAR LOAD BALANCING
!****-------------------------------------------------------------------
!     Purpose.   IF MASTER: Probe for helpers
!     --------

!**   Interface.
!     ----------

!        Explicit arguments :  KHLPRDY,KT
!        --------------------

!     Method.
!     -------

!     Externals.
!     ----------
!       Called by EC_PHYS_DRV

!     Author.
!     -------
!        John Hague   *ECMWF* 22-Nov-2005

!     Modifications.
!     --------------
!     ------------------------------------------------------------------

USE PARKIND1  , ONLY : JPIM     ,JPRB
USE YOMHOOK   , ONLY : LHOOK    ,DR_HOOK
USE YOM_PTR_SSMI , ONLY : LERAIN_ACTIVE
USE YOMRAIN_LB , ONLY : ICOPROCS, CLPROC, JPHLP
USE MPL_MODULE , ONLY : MPL_PROBE, MPL_RECV

IMPLICIT NONE

INTEGER(KIND=JPIM), INTENT(INOUT)  :: KHLPRDY(JPHLP+1)
INTEGER(KIND=JPIM), INTENT(IN)     :: KT

REAL(KIND=JPRB)    :: ZBUF
INTEGER(KIND=JPIM) :: J
LOGICAL            :: LLEXIST
REAL(KIND=JPRB)    :: ZHOOK_HANDLE

IF (LHOOK) CALL DR_HOOK('ONEDVAR_RAINTB_PRB',0,ZHOOK_HANDLE)

IF(LERAIN_ACTIVE) THEN
  IF(CLPROC == "M") THEN
    !-------MASTER: CHECK IF HELPER(S) READY --------
    DO J= 1,ICOPROCS(1)
      IF(KHLPRDY(J+1) == 0 ) THEN
        CALL MPL_PROBE(KSOURCE=ICOPROCS(J+1),KTAG=KT,LDWAIT=.FALSE., &
          & LDFLAG=LLEXIST,CDSTRING='ONEDVAR_RAINTB_PRB:')
        IF(LLEXIST) THEN
          CALL MPL_RECV(ZBUF,KTAG=KT,KSOURCE=ICOPROCS(J+1),CDSTRING='ONEDVAR_RAINTB_PRB:')
          KHLPRDY(J+1)=1
          KHLPRDY(1)=KHLPRDY(1)+1
        ENDIF
      ENDIF
    ENDDO
  ENDIF
ENDIF

IF (LHOOK) CALL DR_HOOK('ONEDVAR_RAINTB_PRB',1,ZHOOK_HANDLE)

END SUBROUTINE ONEDVAR_RAINTB_PRB
