Commit a04e6804 authored by Daniel Wortmann's avatar Daniel Wortmann

Added code to check the stacksize on linux machines and

issue a warning if the stack is limited
parent 648941e6
......@@ -17,4 +17,5 @@ juDFT/juDFT.F90
juDFT/stop.F90
juDFT/time.F90
juDFT/args.F90
juDFT/sysinfo.F90
)
......@@ -5,7 +5,8 @@
!--------------------------------------------------------------------------------
MODULE m_juDFT_init
USE m_judft_time
USE m_judft_time
USE m_judft_sysinfo
IMPLICIT NONE
PRIVATE
PUBLIC juDFT_init
......@@ -13,6 +14,7 @@
SUBROUTINE juDFT_init()
CALL signal_handler()
CALL checkstack()
END SUBROUTINE juDFT_init
SUBROUTINE signal_handler()
......
MODULE m_judft_sysinfo
IMPLICIT NONE
CONTAINS
SUBROUTINE checkstack()
CHARACTER(LEN=10):: l1,l2,l3,l4
INTEGER :: err
LOGICAL :: unlimited
unlimited=.TRUE. !set to true by default.
!If /proc/self/limits does not exist
!or parsing fails no warning is issued
OPEN(99,FILE="/proc/self/limits",ERR=999)
DO
READ(99,*,ERR=999,END=999) l1,l2,l3,l4
IF (ALL((/INDEX(l1,"Max"),INDEX(l2,"stack"),INDEX(l3,"size")/)==1)) THEN
unlimited=INDEX(l4,"unlim")==1
ENDIF
ENDDO
999 CLOSE(99,IOSTAT=err)
IF (.NOT.unlimited) THEN
WRITE(*,*) "*********** WARNING! ************"
WRITE(*,*) "Your stacksize seems to be small"
WRITE(*,*) "FLEUR might crash without further"
WRITE(*,*) "notice. Try 'ulimit -s unlimited'"
WRITE(*,*) "*********** WARNING! ************"
ENDIF
END SUBROUTINE checkstack
END MODULE m_judft_sysinfo
!program test
! use m_judft_sysinfo
! call checkstack()
!end program test
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment