init.F90 1.5 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8 9 10
      MODULE m_juDFT_init
      USE m_judft_time
      IMPLICIT NONE
      PRIVATE
Daniel Wortmann's avatar
Daniel Wortmann committed
11
      PUBLIC juDFT_init
12
      CONTAINS
Daniel Wortmann's avatar
Daniel Wortmann committed
13
     
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
      SUBROUTINE juDFT_init()
      CALL signal_handler()
      END SUBROUTINE juDFT_init

      SUBROUTINE signal_handler()
      !Installs custom handlers for SIGTERM,SIGSEGV
#ifdef __INTEL_COMPILER
      USE ifport
      INTEGER :: result
      EXTERNAL intel_signal_handler
      result=signal(SIGTERM,intel_signal_handler,-1)
      result=signal(SIGSEGV,intel_signal_handler,-1)

#endif
      END SUBROUTINE signal_handler
      END MODULE m_juDFT_init

#ifdef __INTEL_COMPILER
      FUNCTION intel_signal_handler(signal)
      USE m_judft_time
      IMPLICIT NONE
      INTEGER :: signal
      INTEGER :: intel_signal_handler
#ifdef CPP_MPI
      include "mpif.h"
      INTEGER:: irank,ierr

      CALL MPI_COMM_RANK (MPI_COMM_WORLD,irank,ierr)
      WRITE(*,*) "Signal ",signal," detected on PE:",irank
      CALL writetimes()
#else
      WRITE(*,*) "Signal detected:",signal
      CALL writetimes()
#endif
      STOP "Signal"
      intel_signal_handler=0
      END FUNCTION intel_signal_handler
#endif