|
CP2K 2.5 (Revision 12981)
|
Module that contains the routines for error handling The idea is that in general routines have an optional parameter that can be used to change the error behaviour. More...
Classes | |
| struct | cp_error_type |
| this type represent a structure that can be passed to the functions to change their error behaviour. It should always be initialized with cp_error_init before use More... | |
Functions | |
| subroutine, public | cp_error_init (error, stop_level, print_level, logger, template_error, error_nr, level) |
| Initializes the error structure error. The optional arguments initialize the values in the structure. Default values: stop_level=2, logger=null (i.e. default logger) | |
| subroutine, public | cp_error_reset (error) |
| if the optional parameter error is present resets its level and error_nr to 0 (is tipically called when you want to discard the previous errors stored in error, i.e. not often) | |
| subroutine, public | cp_error_set (error, level, error_nr, stop_level, print_level, logger, template_error, info) |
| routine to set the various components of the error structure | |
| subroutine, public | cp_error_dealloc_ref (err_to_free, error) |
| Deallocates the memory allocated by the error. | |
| subroutine, public | cp_error_get (error, level, error_nr, stop_level, print_level, logger, info) |
| returns the various attributes of the given error | |
| INTEGER, public | cp_error_get_level (error) |
| gets the error level from the given error | |
| INTEGER, public | cp_error_get_print_level (error) |
| gets the print level (starting with which errorlevel something gets printed) from the given error if the error is not present returns cp_note_level | |
| INTEGER, public | cp_error_get_nr (error) |
| gets the error number from the given error | |
| TYPE(cp_logger_type), pointer, public | cp_error_get_logger (error) |
| gets the logger of the given error. The error argument is optional, so you can get the logger of an optional dummy argument. If the error is not present or its logger is not associated returns the default logger. | |
| INTEGER, public | cp_error_get_stop_level (error) |
| gets the error level at which the error will stop the programm If the error is not present returns cp_failure_level | |
| subroutine | cp_error_common_stop (fromWhere, message) |
| a subroutine that call just stop, useful because all the failures fails calling this routine: the right point to set a breakpoint | |
| subroutine, public | cp_error_handle_error (error, fromWhere, message, ionode) |
| all the error situations at the end should call this routine | |
| subroutine, public | cp_error_message (level, fromWhere, message, error) |
| writes an error message of level level, subject to control of error (i.e. if errorprintlevel is >= level) | |
| subroutine, public | cp_assert (condition, level, error_nr, fromWhere, message, error, failure, info, only_ionode) |
| routine that checks an assertion, if it fails set the optional argument failure is given sets it to true. This can be used to do many assertion one fater the other and check at the end if one failed. | |
| subroutine, public | cp_error_propagate_error (iError, fromWhere, message, error, failure, failure_level) |
| if the internal error iError of a subroutine has an error levele that is at least failure_level(i.e. if there was a serious error in the subroutine) propagates the error to the actual error (i.e. sets error to the same error than iError) and sets failure to true if a failure more severe than warning happened | |
| subroutine, public | cp_unimplemented_error (fromWhere, message, error, error_level) |
| comodity call to signat that something is not implemented | |
| subroutine, public | cp_error_synchronize_error (error, para_env) |
| synchronizes the error values between different processors (propagating an eventual failure to each processor) | |
| subroutine, public | cp_a_l (condition, level, fromWhere, lineNr, error, failure) |
| assert with linenumber (to be used with the assertion macros to keep the line short) | |
| subroutine, public | cp_error_check (error, failure) |
| if error is present sets failure to true if an error did happen | |
| subroutine, public | cp_simple_assert (condition, routineP, line) |
| simple assert | |
Variables | |
| LOGICAL, parameter, private | debug_this_module = .FALSE. |
| CHARACTER(len=*), parameter, private | moduleN = 'cp_error_handling' |
| LOGICAL, parameter, public | cp_debug = .FALSE. |
| INTEGER, parameter, public | cp_no_error = 0 |
| INTEGER, parameter, public | cp_caller_error = 1 |
| INTEGER, parameter, public | cp_wrong_args_error = 100 |
| INTEGER, parameter, public | cp_precondition_failed = 200 |
| INTEGER, parameter, public | cp_internal_error = -1 |
| INTEGER, parameter, public | cp_postcondition_failed = -200 |
| INTEGER, parameter, public | cp_invariant_failed = -100 |
| INTEGER, parameter, public | cp_assertion_failed = -300 |
| INTEGER, parameter, public | cp_unimplemented_error_nr = -1000 |
Module that contains the routines for error handling The idea is that in general routines have an optional parameter that can be used to change the error behaviour.
The following error levels are defined: 0 - note : CP_NOTE_LEVEL 1 - warning : CP_WARNING_LEVEL 2 - failure : CP_FAILURE_LEVEL 3 - fatal : CP_FATAL_LEVEL You shouldn't use the numbers but the constants defined in cp_log_handling
| subroutine,public cp_error_handling::cp_a_l | ( | LOGICAL,intent(in) | condition, |
| INTEGER,intent(in) | level, | ||
| CHARACTER(len=*),intent(in) | fromWhere, | ||
| INTEGER,intent(in) | lineNr, | ||
| TYPE(cp_error_type),intent(inout),optional | error, | ||
| LOGICAL,intent(inout),optional | failure | ||
| ) |
assert with linenumber (to be used with the assertion macros to keep the line short)
| from | _ |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 732 of file cp_error_handling.f90.
References cp_assert(), and cp_assertion_failed.
Here is the call graph for this function:| subroutine,public cp_error_handling::cp_assert | ( | LOGICAL,intent(in) | condition, |
| INTEGER,intent(in) | level, | ||
| INTEGER,intent(in) | error_nr, | ||
| CHARACTER(len=*),intent(in) | fromWhere, | ||
| CHARACTER(len=*),intent(in) | message, | ||
| TYPE(cp_error_type),intent(inout),optional | error, | ||
| LOGICAL,intent(inout),optional | failure, | ||
| CHARACTER(len=*),optional | info, | ||
| LOGICAL,intent(in),optional | only_ionode | ||
| ) |
routine that checks an assertion, if it fails set the optional argument failure is given sets it to true. This can be used to do many assertion one fater the other and check at the end if one failed.
| condition | the condition to check, if true does nothing |
| level | the level of the error (cp_note_level, cp_warning_level, |
| error_nr | the number of the error |
| fromWhere | a string that contains the module name and routine name where this test happened |
| message | the error message |
| error | the error type that controls error reporting (optional) |
| failure | is set to true if the condition is false otherwise it is not changed (optional) |
Definition at line 539 of file cp_error_handling.f90.
References cp_error_dealloc_ref(), cp_error_get_logger(), cp_error_handle_error(), cp_error_init(), debug_this_module, and error.
Referenced by cp_a_l(), cp_error_synchronize_error(), cp_ma_interface::cp_ma_current_thread_run(), cp_ma_interface::cp_ma_get_cuDev(), cp_ma_interface::cp_ma_mempol(), cp_ma_interface::cp_ma_mpi_sched(), cp_ma_interface::cp_ma_print_config(), cp_ma_interface::cp_ma_print_machine(), cp_ma_interface::cp_ma_run_on(), cp_ma_interface::cp_ma_set_neighbors(), cp_ma_interface::cp_ma_thread_run_on(), cp_ma_interface::cp_ma_thread_sched(), cp_ma_interface::cp_ma_verify_place(), and cp_unimplemented_error().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_error_handling::cp_error_check | ( | TYPE(cp_error_type),intent(in),optional | error, |
| LOGICAL,intent(inout),optional | failure | ||
| ) |
if error is present sets failure to true if an error did happen
| error | the error to check for failure |
| failure | set to true if there was an error |
Definition at line 755 of file cp_error_handling.f90.
| subroutine cp_error_handling::cp_error_common_stop | ( | CHARACTER(len=*),intent(in) | fromWhere, |
| CHARACTER(len=*),intent(in) | message | ||
| ) | [private] |
a subroutine that call just stop, useful because all the failures fails calling this routine: the right point to set a breakpoint
| fromWhere | 'module:routine' that called this function |
| message | an error message |
Definition at line 438 of file cp_error_handling.f90.
References cp_log_handling::cp_logger_get_default_unit_nr(), message_passing::mp_abort(), and termination::print_message().
Referenced by cp_error_dealloc_ref(), cp_error_get_logger(), and cp_error_reset().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_error_handling::cp_error_dealloc_ref | ( | TYPE(cp_error_type),intent(inout) | err_to_free, |
| TYPE(cp_error_type),intent(inout),optional | error | ||
| ) |
Deallocates the memory allocated by the error.
| err_to_free | the error that gets deallocated |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 267 of file cp_error_handling.f90.
References cp_error_common_stop(), cp_log_handling::cp_get_default_logger(), and cp_log_handling::cp_logger_release().
Referenced by cp_assert().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_error_handling::cp_error_get | ( | TYPE(cp_error_type),intent(inout) | error, |
| INTEGER,intent(out),optional | level, | ||
| INTEGER,intent(out),optional | error_nr, | ||
| INTEGER,intent(out),optional | stop_level, | ||
| INTEGER,intent(out),optional | print_level, | ||
| TYPE(cp_logger_type),optional,pointer | logger, | ||
| CHARACTER(LEN=*),optional | info | ||
| ) |
returns the various attributes of the given error
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 299 of file cp_error_handling.f90.
References cp_error_get_logger().
Here is the call graph for this function:| INTEGER,public cp_error_handling::cp_error_get_level | ( | TYPE(cp_error_type),intent(in),optional | error | ) |
gets the error level from the given error
| error | the error you take the info from |
Definition at line 325 of file cp_error_handling.f90.
Referenced by cp_error_propagate_error().
Here is the caller graph for this function:| TYPE(cp_logger_type),pointer,public cp_error_handling::cp_error_get_logger | ( | TYPE(cp_error_type),intent(in),optional | error | ) |
gets the logger of the given error. The error argument is optional, so you can get the logger of an optional dummy argument. If the error is not present or its logger is not associated returns the default logger.
| error | the error you take the info from (optional) |
Definition at line 391 of file cp_error_handling.f90.
References cp_error_common_stop(), and cp_log_handling::cp_get_default_logger().
Referenced by cp_assert(), cp_error_get(), cp_error_handle_error(), cp_error_message(), cp_error_synchronize_error(), cp_ma_interface::cp_ma_current_thread_run(), cp_ma_interface::cp_ma_get_cuDev(), cp_ma_interface::cp_ma_init_lib(), cp_ma_interface::cp_ma_print_config(), cp_ma_interface::cp_ma_print_machine(), cp_ma_interface::cp_ma_print_strategy(), cp_ma_interface::cp_ma_run_on(), cp_ma_interface::cp_ma_thread_run_on(), and cp_ma_interface::cp_ma_verify_place().
Here is the call graph for this function:
Here is the caller graph for this function:| INTEGER,public cp_error_handling::cp_error_get_nr | ( | TYPE(cp_error_type),intent(in),optional | error | ) |
gets the error number from the given error
| error | the error you take the info from |
Definition at line 367 of file cp_error_handling.f90.
| INTEGER,public cp_error_handling::cp_error_get_print_level | ( | TYPE(cp_error_type),intent(in),optional | error | ) |
gets the print level (starting with which errorlevel something gets printed) from the given error if the error is not present returns cp_note_level
| error | the error you take the info from (optional) |
Definition at line 347 of file cp_error_handling.f90.
References cp_log_handling::cp_note_level.
Referenced by cp_error_message(), and cp_error_propagate_error().
Here is the caller graph for this function:| INTEGER,public cp_error_handling::cp_error_get_stop_level | ( | TYPE(cp_error_type),intent(in),optional | error | ) |
gets the error level at which the error will stop the programm If the error is not present returns cp_failure_level
| error | the error you take the info from (optional) |
Definition at line 414 of file cp_error_handling.f90.
References cp_log_handling::cp_failure_level.
| subroutine,public cp_error_handling::cp_error_handle_error | ( | TYPE(cp_error_type),intent(in) | error, |
| CHARACTER(len=*),intent(in) | fromWhere, | ||
| CHARACTER(len=*),intent(in) | message, | ||
| LOGICAL,intent(in) | ionode | ||
| ) |
all the error situations at the end should call this routine
main function for error logging, most error reporting ends up calling this function, great place to put a breakpoint if you want to catch errors that do not stop the program.
| error | the error you take the info from (optional) |
Definition at line 462 of file cp_error_handling.f90.
References cp_error_get_logger(), cp_error_message(), cp_log_handling::cp_logger_get_default_unit_nr(), debug_this_module, message_passing::mp_abort(), and timings::print_stack().
Referenced by cp_assert().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_error_handling::cp_error_init | ( | TYPE(cp_error_type),intent(out) | error, |
| INTEGER,intent(in),optional | stop_level, | ||
| INTEGER,intent(in),optional | print_level, | ||
| TYPE(cp_logger_type),optional,pointer | logger, | ||
| TYPE(cp_error_type),intent(in),optional | template_error, | ||
| INTEGER,intent(in),optional | error_nr, | ||
| INTEGER,intent(in),optional | level | ||
| ) |
Initializes the error structure error. The optional arguments initialize the values in the structure. Default values: stop_level=2, logger=null (i.e. default logger)
| error | the error that will be initialized |
| stop_level | the stop level of the newly created error (defaults to cp_failure_level) |
| print_level | the print level of the newly created error (defaults to cp_note_level) |
| logger | the logger where errors are written (defaults to the default logger) |
| template_error | an error that gives the default values for the previous variables (useful to initialize an internal error) |
Definition at line 148 of file cp_error_handling.f90.
References cp_log_handling::cp_logger_retain().
Referenced by cp_assert().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_error_handling::cp_error_message | ( | INTEGER,intent(in) | level, |
| CHARACTER(len=*),intent(in) | fromWhere, | ||
| CHARACTER(len=*),intent(in) | message, | ||
| TYPE(cp_error_type),intent(in),optional | error | ||
| ) |
writes an error message of level level, subject to control of error (i.e. if errorprintlevel is >= level)
| level | the level of the error (cp_note_level, cp_warning_level, |
| fromWhere | a string that contains the module name and routine name where this test happened |
| message | the error message |
| error | the error type that controls error reporting (optional) |
Definition at line 506 of file cp_error_handling.f90.
References cp_error_get_logger(), and cp_error_get_print_level().
Referenced by cp_error_handle_error(), and cp_error_propagate_error().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public cp_error_handling::cp_error_propagate_error | ( | TYPE(cp_error_type),intent(in) | iError, |
| CHARACTER(len=*) | fromWhere, | ||
| CHARACTER(len=*),optional | message, | ||
| TYPE(cp_error_type),intent(inout),optional | error, | ||
| LOGICAL,intent(inout),optional | failure, | ||
| INTEGER,intent(in),optional | failure_level | ||
| ) |
if the internal error iError of a subroutine has an error levele that is at least failure_level(i.e. if there was a serious error in the subroutine) propagates the error to the actual error (i.e. sets error to the same error than iError) and sets failure to true if a failure more severe than warning happened
| iError | the error object that comes from the subroutine |
| error | the error object in the actual routine |
| failure | if iError has an error it is set to true |
| failure_level | starting with which error level propagation happens (defaults to cp_warning_level) |
Definition at line 603 of file cp_error_handling.f90.
References cp_error_get_level(), cp_error_get_print_level(), cp_error_message(), cp_log_handling::cp_warning_level, and debug_this_module.
Here is the call graph for this function:| subroutine,public cp_error_handling::cp_error_reset | ( | TYPE(cp_error_type),intent(inout),optional | error | ) |
if the optional parameter error is present resets its level and error_nr to 0 (is tipically called when you want to discard the previous errors stored in error, i.e. not often)
| error | the error you want to reset |
Definition at line 196 of file cp_error_handling.f90.
References cp_error_common_stop(), and cp_log_handling::cp_get_default_logger().
Here is the call graph for this function:| subroutine,public cp_error_handling::cp_error_set | ( | TYPE(cp_error_type),intent(inout) | error, |
| INTEGER,intent(in),optional | level, | ||
| INTEGER,intent(in),optional | error_nr, | ||
| INTEGER,intent(in),optional | stop_level, | ||
| INTEGER,intent(in),optional | print_level, | ||
| TYPE(cp_logger_type),optional,pointer | logger, | ||
| TYPE(cp_error_type),intent(in),optional | template_error, | ||
| CHARACTER(LEN=*),optional | info | ||
| ) |
routine to set the various components of the error structure
| error | the error you want to change |
| template_error | gives the default values of logger, stop_level and print_level (but not of level and error_nr) |
Definition at line 223 of file cp_error_handling.f90.
References cp_log_handling::cp_logger_release(), and cp_log_handling::cp_logger_retain().
Here is the call graph for this function:| subroutine,public cp_error_handling::cp_error_synchronize_error | ( | TYPE(cp_error_type),intent(inout),optional | error, |
| TYPE(cp_para_env_type),optional,pointer | para_env | ||
| ) |
synchronizes the error values between different processors (propagating an eventual failure to each processor)
| error | the error to synchronize |
Definition at line 687 of file cp_error_handling.f90.
References cp_assert(), cp_error_get_logger(), and cp_log_handling::cp_failure_level.
Here is the call graph for this function:| subroutine,public cp_error_handling::cp_simple_assert | ( | LOGICAL,intent(in) | condition, |
| CHARACTER(len=*),intent(in) | routineP, | ||
| INTEGER,intent(in) | line | ||
| ) |
simple assert
Definition at line 781 of file cp_error_handling.f90.
| subroutine,public cp_error_handling::cp_unimplemented_error | ( | CHARACTER(len=*),intent(in) | fromWhere, |
| CHARACTER(len=*),intent(in),optional | message, | ||
| TYPE(cp_error_type),intent(inout),optional | error, | ||
| INTEGER,intent(in),optional | error_level | ||
| ) |
comodity call to signat that something is not implemented
| fromWhere | routine where the error happened |
| message | the message to write out (UNIMPLEMENTED is added to it) |
| error_level | the error level of this error, defaults to cp_failure_level |
| error | variable to control error logging, stopping,... see module cp_error_handling |
Definition at line 655 of file cp_error_handling.f90.
References cp_assert(), cp_log_handling::cp_failure_level, and cp_unimplemented_error_nr.
Here is the call graph for this function:| INTEGER,parameter,public cp_error_handling::cp_assertion_failed = -300 |
Definition at line 90 of file cp_error_handling.f90.
Referenced by cp_a_l().
| INTEGER,parameter,public cp_error_handling::cp_caller_error = 1 |
Definition at line 78 of file cp_error_handling.f90.
| LOGICAL,parameter,public cp_error_handling::cp_debug = .FALSE. |
Definition at line 72 of file cp_error_handling.f90.
| INTEGER,parameter,public cp_error_handling::cp_internal_error = -1 |
Definition at line 84 of file cp_error_handling.f90.
| INTEGER,parameter,public cp_error_handling::cp_invariant_failed = -100 |
Definition at line 88 of file cp_error_handling.f90.
| INTEGER,parameter,public cp_error_handling::cp_no_error = 0 |
Definition at line 76 of file cp_error_handling.f90.
| INTEGER,parameter,public cp_error_handling::cp_postcondition_failed = -200 |
Definition at line 86 of file cp_error_handling.f90.
| INTEGER,parameter,public cp_error_handling::cp_precondition_failed = 200 |
Definition at line 82 of file cp_error_handling.f90.
| INTEGER,parameter,public cp_error_handling::cp_unimplemented_error_nr = -1000 |
Definition at line 92 of file cp_error_handling.f90.
Referenced by cp_ma_interface::cp_ma_current_thread_run(), cp_ma_interface::cp_ma_get_cuDev(), cp_ma_interface::cp_ma_mempol(), cp_ma_interface::cp_ma_mpi_sched(), cp_ma_interface::cp_ma_print_config(), cp_ma_interface::cp_ma_print_machine(), cp_ma_interface::cp_ma_run_on(), cp_ma_interface::cp_ma_set_neighbors(), cp_ma_interface::cp_ma_thread_run_on(), cp_ma_interface::cp_ma_thread_sched(), cp_ma_interface::cp_ma_verify_place(), and cp_unimplemented_error().
| INTEGER,parameter,public cp_error_handling::cp_wrong_args_error = 100 |
Definition at line 80 of file cp_error_handling.f90.
| LOGICAL,parameter,private cp_error_handling::debug_this_module = .FALSE. |
Definition at line 46 of file cp_error_handling.f90.
Referenced by cp_assert(), cp_error_handle_error(), and cp_error_propagate_error().
| CHARACTER(len=*),parameter,private cp_error_handling::moduleN = 'cp_error_handling' |
Definition at line 47 of file cp_error_handling.f90.
1.7.3