Currently, CABLE is inconsistent in how the program is aborted or STOPed throughout the code base. For example, when using an MPI build, STOP should be replaced with a call to MPI_Abort (via mpi_grp_abort) and there is also an abort subroutine defined in cable_abort_module which is sometimes used. It would be nice if these approaches were consolidated across the codebase (also potentially for use in the coupled model).
A nice (but maybe naive) approach would be to use the existing abort functionality to encapsulate the abort logic however this will probably depend on some state in the top level scope (e.g. the current MPI rank or the total number of MPI ranks). Passing this state information as an argument to abort seems like it will be a bit burdensome to pass throughout the entire code base. A better approach could be to instantiate a singleton logging object to handle the logging and abort behaviour.
This also raises questions on how we want do error handling and logging in general (also in a coupled model context noting that CABLE maybe built as a library in the future). It would be good to have an idea of the key requirements for a consolidated logging and error handling framework for CABLE.
Currently, CABLE is inconsistent in how the program is aborted or
STOPed throughout the code base. For example, when using an MPI build,STOPshould be replaced with a call toMPI_Abort(viampi_grp_abort) and there is also anabortsubroutine defined incable_abort_modulewhich is sometimes used. It would be nice if these approaches were consolidated across the codebase (also potentially for use in the coupled model).A nice (but maybe naive) approach would be to use the existing
abortfunctionality to encapsulate the abort logic however this will probably depend on some state in the top level scope (e.g. the current MPI rank or the total number of MPI ranks). Passing this state information as an argument toabortseems like it will be a bit burdensome to pass throughout the entire code base. A better approach could be to instantiate a singleton logging object to handle the logging and abort behaviour.This also raises questions on how we want do error handling and logging in general (also in a coupled model context noting that CABLE maybe built as a library in the future). It would be good to have an idea of the key requirements for a consolidated logging and error handling framework for CABLE.