SUBROUTINE DR_HOOK_UTIL_MULTI(CDNAME,KCASE,PKEY,KPKEY,CDFILENAME,KSIZEINFO)
USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK,ONLY : LHOOK
USE OML_MOD,ONLY : OML_MAX_THREADS,OML_MY_THREAD
IMPLICIT NONE
CHARACTER(LEN=*),INTENT(IN) :: CDNAME,CDFILENAME
INTEGER(KIND=JPIM),INTENT(IN) :: KPKEY, KCASE,KSIZEINFO
REAL(KIND=JPRB),INTENT(INOUT) :: PKEY(KPKEY)

LOGICAL,SAVE :: LL_FIRST_TIME = .TRUE.
REAL(KIND=JPRB) :: ZDUMMY
INTEGER(KIND=JPIM) :: IMYTID

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

IF (.NOT.LHOOK) RETURN
IF (LL_FIRST_TIME) THEN
  LL_FIRST_TIME = .FALSE.
  CALL DR_HOOK_UTIL('',-1,ZDUMMY)
ENDIF

!$OMP PARALLEL DO SCHEDULE(STATIC,1)&
!$OMP&PRIVATE(IMYTID)
DO IMYTID=1,KPKEY
  IF (KCASE == 0) THEN
    CALL C_DRHOOK_START(CDNAME, IMYTID, PKEY(IMYTID), CDFILENAME, KSIZEINFO)
  ELSE IF (KCASE == 1) THEN
    CALL C_DRHOOK_END  (CDNAME, IMYTID, PKEY(IMYTID), CDFILENAME, KSIZEINFO)
  ENDIF
ENDDO ! IMYTID=1,KPKEY
!$OMP END PARALLEL DO

END SUBROUTINE DR_HOOK_UTIL_MULTI
