Merge branch 'signal_input_handling_1' into 'development'
Enabling signal input handling in DAMASK See merge request damask/DAMASK!325
This commit is contained in:
commit
da93031cbc
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit 3ab1053b8c83248dc8654a22a3caea815c0813db
|
Subproject commit 72661176e9055cf6ec106bb61c50482c5bc78de8
|
|
@ -199,7 +199,7 @@ subroutine DAMASK_interface_init
|
||||||
if (interface_restartInc > 0) &
|
if (interface_restartInc > 0) &
|
||||||
print'(a,i6.6)', ' Restart from increment: ', interface_restartInc
|
print'(a,i6.6)', ' Restart from increment: ', interface_restartInc
|
||||||
|
|
||||||
!call signalterm_c(c_funloc(catchSIGTERM))
|
call signalterm_c(c_funloc(catchSIGTERM))
|
||||||
call signalusr1_c(c_funloc(catchSIGUSR1))
|
call signalusr1_c(c_funloc(catchSIGUSR1))
|
||||||
call signalusr2_c(c_funloc(catchSIGUSR2))
|
call signalusr2_c(c_funloc(catchSIGUSR2))
|
||||||
call interface_setSIGTERM(.false.)
|
call interface_setSIGTERM(.false.)
|
||||||
|
@ -386,24 +386,14 @@ end function makeRelativePath
|
||||||
subroutine catchSIGTERM(signal) bind(C)
|
subroutine catchSIGTERM(signal) bind(C)
|
||||||
|
|
||||||
integer(C_INT), value :: signal
|
integer(C_INT), value :: signal
|
||||||
|
|
||||||
|
|
||||||
|
print'(a,i0)', ' received signal ',signal
|
||||||
call interface_setSIGTERM(.true.)
|
call interface_setSIGTERM(.true.)
|
||||||
|
|
||||||
print'(a,i0,a)', ' received signal ',signal, ', set SIGTERM=TRUE'
|
|
||||||
|
|
||||||
end subroutine catchSIGTERM
|
end subroutine catchSIGTERM
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief Set global variable interface_SIGTERM.
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine interface_setSIGTERM(state)
|
|
||||||
|
|
||||||
logical, intent(in) :: state
|
|
||||||
interface_SIGTERM = state
|
|
||||||
|
|
||||||
end subroutine interface_setSIGTERM
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Set global variable interface_SIGUSR1 to .true.
|
!> @brief Set global variable interface_SIGUSR1 to .true.
|
||||||
!> @details This function can be registered to catch signals send to the executable.
|
!> @details This function can be registered to catch signals send to the executable.
|
||||||
|
@ -411,24 +401,14 @@ end subroutine interface_setSIGTERM
|
||||||
subroutine catchSIGUSR1(signal) bind(C)
|
subroutine catchSIGUSR1(signal) bind(C)
|
||||||
|
|
||||||
integer(C_INT), value :: signal
|
integer(C_INT), value :: signal
|
||||||
|
|
||||||
|
|
||||||
|
print'(a,i0)', ' received signal ',signal
|
||||||
call interface_setSIGUSR1(.true.)
|
call interface_setSIGUSR1(.true.)
|
||||||
|
|
||||||
print'(a,i0,a)', ' received signal ',signal, ', set SIGUSR1=TRUE'
|
|
||||||
|
|
||||||
end subroutine catchSIGUSR1
|
end subroutine catchSIGUSR1
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
!> @brief Set global variable interface_SIGUSR.
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
|
||||||
subroutine interface_setSIGUSR1(state)
|
|
||||||
|
|
||||||
logical, intent(in) :: state
|
|
||||||
interface_SIGUSR1 = state
|
|
||||||
|
|
||||||
end subroutine interface_setSIGUSR1
|
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Set global variable interface_SIGUSR2 to .true.
|
!> @brief Set global variable interface_SIGUSR2 to .true.
|
||||||
!> @details This function can be registered to catch signals send to the executable.
|
!> @details This function can be registered to catch signals send to the executable.
|
||||||
|
@ -436,20 +416,52 @@ end subroutine interface_setSIGUSR1
|
||||||
subroutine catchSIGUSR2(signal) bind(C)
|
subroutine catchSIGUSR2(signal) bind(C)
|
||||||
|
|
||||||
integer(C_INT), value :: signal
|
integer(C_INT), value :: signal
|
||||||
|
|
||||||
|
|
||||||
|
print'(a,i0,a)', ' received signal ',signal
|
||||||
call interface_setSIGUSR2(.true.)
|
call interface_setSIGUSR2(.true.)
|
||||||
|
|
||||||
print'(a,i0,a)', ' received signal ',signal, ', set SIGUSR2=TRUE'
|
|
||||||
|
|
||||||
end subroutine catchSIGUSR2
|
end subroutine catchSIGUSR2
|
||||||
|
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief Set global variable interface_SIGTERM.
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
subroutine interface_setSIGTERM(state)
|
||||||
|
|
||||||
|
logical, intent(in) :: state
|
||||||
|
|
||||||
|
|
||||||
|
interface_SIGTERM = state
|
||||||
|
print*, 'set SIGTERM to',state
|
||||||
|
|
||||||
|
end subroutine interface_setSIGTERM
|
||||||
|
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief Set global variable interface_SIGUSR.
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
subroutine interface_setSIGUSR1(state)
|
||||||
|
|
||||||
|
logical, intent(in) :: state
|
||||||
|
|
||||||
|
|
||||||
|
interface_SIGUSR1 = state
|
||||||
|
print*, 'set SIGUSR1 to',state
|
||||||
|
|
||||||
|
end subroutine interface_setSIGUSR1
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Set global variable interface_SIGUSR2.
|
!> @brief Set global variable interface_SIGUSR2.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine interface_setSIGUSR2(state)
|
subroutine interface_setSIGUSR2(state)
|
||||||
|
|
||||||
logical, intent(in) :: state
|
logical, intent(in) :: state
|
||||||
|
|
||||||
|
|
||||||
interface_SIGUSR2 = state
|
interface_SIGUSR2 = state
|
||||||
|
print*, 'set SIGUSR2 to',state
|
||||||
|
|
||||||
end subroutine interface_setSIGUSR2
|
end subroutine interface_setSIGUSR2
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,12 @@ program DAMASK_grid
|
||||||
logical :: &
|
logical :: &
|
||||||
guess, & !< guess along former trajectory
|
guess, & !< guess along former trajectory
|
||||||
stagIterate, &
|
stagIterate, &
|
||||||
cutBack = .false.
|
cutBack = .false.,&
|
||||||
|
signal
|
||||||
integer :: &
|
integer :: &
|
||||||
i, j, m, field, &
|
i, j, m, field, &
|
||||||
errorID = 0, &
|
errorID = 0, &
|
||||||
|
ierr,&
|
||||||
cutBackLevel = 0, & !< cut back level \f$ t = \frac{t_{inc}}{2^l} \f$
|
cutBackLevel = 0, & !< cut back level \f$ t = \frac{t_{inc}}{2^l} \f$
|
||||||
stepFraction = 0, & !< fraction of current time interval
|
stepFraction = 0, & !< fraction of current time interval
|
||||||
l = 0, & !< current load case
|
l = 0, & !< current load case
|
||||||
|
@ -449,18 +451,27 @@ program DAMASK_grid
|
||||||
print'(/,a,i0,a)', ' increment ', totalIncsCounter, ' NOT converged'
|
print'(/,a,i0,a)', ' increment ', totalIncsCounter, ' NOT converged'
|
||||||
endif; flush(IO_STDOUT)
|
endif; flush(IO_STDOUT)
|
||||||
|
|
||||||
if (mod(inc,loadCases(l)%f_out) == 0) then
|
call MPI_Allreduce(interface_SIGUSR1,signal,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr)
|
||||||
|
if (ierr /= 0) error stop 'MPI error'
|
||||||
|
if (mod(inc,loadCases(l)%f_out) == 0 .or. signal) then
|
||||||
print'(1/,a)', ' ... writing results to file ......................................'
|
print'(1/,a)', ' ... writing results to file ......................................'
|
||||||
flush(IO_STDOUT)
|
flush(IO_STDOUT)
|
||||||
call CPFEM_results(totalIncsCounter,time)
|
call CPFEM_results(totalIncsCounter,time)
|
||||||
endif
|
endif
|
||||||
if (mod(inc,loadCases(l)%f_restart) == 0) then
|
if(signal) call interface_setSIGUSR1(.false.)
|
||||||
|
call MPI_Allreduce(interface_SIGUSR2,signal,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr)
|
||||||
|
if (ierr /= 0) error stop 'MPI error'
|
||||||
|
if (mod(inc,loadCases(l)%f_restart) == 0 .or. signal) then
|
||||||
call mech_restartWrite
|
call mech_restartWrite
|
||||||
call CPFEM_restartWrite
|
call CPFEM_restartWrite
|
||||||
endif
|
endif
|
||||||
|
if(signal) call interface_setSIGUSR2(.false.)
|
||||||
|
call MPI_Allreduce(interface_SIGTERM,signal,1,MPI_LOGICAL,MPI_LOR,PETSC_COMM_WORLD,ierr)
|
||||||
|
if (ierr /= 0) error stop 'MPI error'
|
||||||
|
if (signal) exit loadCaseLooping
|
||||||
endif skipping
|
endif skipping
|
||||||
|
|
||||||
enddo incLooping
|
enddo incLooping
|
||||||
|
|
||||||
enddo loadCaseLooping
|
enddo loadCaseLooping
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue