[skip-CI] On popular demand. pw.x no longer returns a nonzero exit status,

unless preprocessing flag __RETURN_EXIT_STATUS is set at compilation time
This commit is contained in:
Paolo Giannozzi 2023-04-20 12:44:43 +02:00
parent 6c803470bc
commit ee0cccd6fd
3 changed files with 14 additions and 12 deletions

View File

@ -98,6 +98,4 @@ PROGRAM pwscf
CALL stop_run( exit_status )
CALL do_stop( exit_status )
!
STOP
!
END PROGRAM pwscf

View File

@ -14,8 +14,7 @@ SUBROUTINE run_pwscf( exit_status )
!
!! Run an instance of the Plane Wave Self-Consistent Field code
!! MPI initialization and input data reading is performed in the
!! calling code - returns in exit_status the exit code for pw.x,
!! returned in the shell. Values are:
!! calling code - returns in exit_status the exit code for pw.x:
!! * 0: completed successfully
!! * 1: an error has occurred (value returned by the errore() routine)
!! * 2-127: convergence error
@ -27,6 +26,10 @@ SUBROUTINE run_pwscf( exit_status )
!! (note: in the future, check_stop_now could also return a value
!! to specify the reason of exiting, and the value could be used
!! to return a different value for different reasons)
!! @Note
!! 20/04/23 Unless preprocessing flag __RETURN_EXIT_STATUS is set (see
!! routine do_stop) pw.x no longer returns an exit status != 0 to the shell
!! @endnote
!
!! @Note
!! 10/01/17 Samuel Ponce: Add Ford documentation

View File

@ -8,13 +8,9 @@
!----------------------------------------------------------------------------
SUBROUTINE stop_run( exit_status )
!----------------------------------------------------------------------------
!! Close all files and synchronize processes before stopping:
!
!! * exit_status = 0: successfull execution, remove temporary files;
!! * exit_status =-1: code stopped by user request;
!! * exit_status = 1: convergence not achieved.
!
!! Do not remove temporary files needed for restart.
!! Close all files and synchronize processes before stopping.
!! Remove temporary files needed for restart only if exit_status = 0
!! (successful execution)
!
USE io_global, ONLY : ionode
USE mp_global, ONLY : mp_global_end
@ -58,12 +54,16 @@ END SUBROUTINE stop_run
!-----------------------------------------
SUBROUTINE do_stop( exit_status )
!---------------------------------------
!! Stop the run.
!! Stop the run. Exit status is returned to the shell only if
!! preprocessing flag __RETURN_EXIT_STATUS is set (default: no).
!
IMPLICIT NONE
!
INTEGER, INTENT(IN) :: exit_status
!
#if ! defined(__RETURN_EXIT_STATUS)
STOP
#else
IF ( exit_status == -1 ) THEN
! -1 is not an acceptable value for stop in fortran;
! convert it to 255
@ -90,6 +90,7 @@ SUBROUTINE do_stop( exit_status )
! unimplemented value
STOP 128
ENDIF
#endif
!
END SUBROUTINE do_stop
!