ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_err::setAborted Interface Reference

Write the input string in the format of a fatal error to the output, then call error stop or return the control to the caller if requested.
More...

Detailed Description

Write the input string in the format of a fatal error to the output, then call error stop or return the control to the caller if requested.

The procedures under this generic interface call getStrWrapped with the input string to obtain a wrapped text within the specified width and maxwidth where the input prefix is suffixed with - FATAL: and then prepended to the beginning of each wrapped line and then printed on the display.

Parameters
[in]msg: The input scalar character of kind any supported by the processor (e.g., SK, SKA, SKD , or SKU) representing the text to be wrapped and displayed.
[in]help: The input scalar character of the same kind as msg containing a descriptive help message to display separately after the fatal error message.
(optional, default = "")
[in]prefix: See the corresponding definition in the documentation of getStrWrapped.
(optional)
[in]indent: See the corresponding definition in the documentation of getStrWrapped.
(optional)
[in]break: See the corresponding definition in the documentation of getStrWrapped.
(optional)
[in]newline: See the corresponding definition in the documentation of getStrWrapped.
(optional)
[in]width: See the corresponding definition in the documentation of getStrWrapped.
(optional)
[in]maxwidth: See the corresponding definition in the documentation of getStrWrapped.
(optional)
[in]tmsize: The input scalar of integer of default kind IK representing the number of empty lines preceding the text in the display.
(optional, default = 1_IK)
[in]bmsize: The input scalar of integer of default kind IK representing the number of empty lines succeeding the text in the display.
(optional, default = 0_IK)
[in]unit: The input scalar integer of default kind IK containing the output file unit.
If the input unit is different from the standard output (output_unit), all messages will also be printed on stdout recursively.
(optional, default = output_unit taken from the intrinsic module iso_fortran_env.)
[in]stat: The input scalar integer of default kind IK containing the error stat code, frequently returned by the compiler.
(optional. If missing, no error code will be suffixed to the output error message.)
[in]renabled: The input scalar logical of default kind LK.
If .true., the program-control will be returned to the calling routine instead of terminating the program via error stop.
This capability is particularly needed during the testing of the various components of the ParaMonte library, when fatal error must be handled gracefully.
(optional, default = SOFT_EXIT_ENABLED)


Possible calling interfaces

use pm_err, only: setAborted
call setAborted(msg, help = help, prefix = prefix, indent = indent, break = break, newline = newline, width = width, maxwidth = maxwidth, tmsize = tmsize, bmsize = bmsize, unit = unit, stat = stat, renabled = renabled)
Write the input string in the format of a fatal error to the output, then call error stop or return t...
Definition: pm_err.F90:2436
This module contains classes and procedures for reporting and handling errors.
Definition: pm_err.F90:52
Remarks
The procedures under discussion are impure.
See also
getStr
setNoted
setWarned
setAborted
setAsserted
getLine


Example usage

1program example
2
3 use pm_kind, only: IK, LK
4 use pm_kind, only: SK ! All kinds are supported.
5 use pm_err, only: setAborted
6 use pm_io, only: display_type
7
8 implicit none
9
10 character(:, SK), allocatable :: str, strWrapped
11
12 type(display_type) :: disp
13
14 disp = display_type(file = "main.out.F90")
15
16 str = "ParaMonte is a serial/parallel library of Monte Carlo routines for \n&
17 & + optimization, \n&
18 & + sampling, and \n&
19 & + integration \n&
20 &of mathematical objective functions of arbitrary-dimensions in particular, the posterior distributions of Bayesian models in \n&
21 & + data science, \n&
22 & + Machine Learning, and \n&
23 & + scientific inference, \n&
24 &with the design goal of unifying the \n&
25 & + automation (of Monte Carlo simulations), \n&
26 & + user-friendliness (of the library), \n&
27 & + accessibility (from multiple programming environments), \n&
28 & + high-performance (at runtime), and \n&
29 & + scalability (across many parallel processors)."
30
31 call disp%skip()
32 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
33 call disp%show("! Notify the user about a fatal error occurrence.")
34 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
35 call disp%skip()
36
37 call disp%show("str")
38 call disp%show( str, deliml = SK_"""" )
39 call disp%show("call setAborted(str, newline = SK_'\n', renabled = .true._LK, unit = disp%unit) ! To halt the program, omit `renabled`.")
40 call setAborted(str, newline = SK_'\n', renabled = .true._LK, unit = disp%unit)
41 call disp%skip()
42 call disp%show("call setAborted(str, prefix = SK_' ParaMonte', newline = SK_'\n', renabled = .true._LK, unit = disp%unit)")
43 call setAborted(str, prefix = SK_' ParaMonte', newline = SK_'\n', renabled = .true._LK, unit = disp%unit)
44 call disp%skip()
45 call disp%show("call setAborted(str, prefix = SK_' ParaMonte', newline = SK_'\n', width = 72_IK, renabled = .true._LK, unit = disp%unit)")
46 call setAborted(str, prefix = SK_' ParaMonte', newline = SK_'\n', width = 72_IK, renabled = .true._LK, unit = disp%unit)
47 call disp%skip()
48 call disp%show("call setAborted(SK_' '//str, help = SK_'Contact cdslab.org for help.', prefix = SK_' ParaMonte', newline = SK_'\n', width = 72_IK, renabled = .true._LK, unit = disp%unit)")
49 call setAborted(SK_' '//str, help = SK_'Contact cdslab.org for help.', prefix = SK_' ParaMonte', newline = SK_'\n', width = 72_IK, renabled = .true._LK, unit = disp%unit)
50 call disp%skip()
51
52end program example
Generate and return an object of type stop_type with the user-specified input attributes.
Definition: pm_err.F90:1618
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3! Notify the user about a fatal error occurrence.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6str
7"ParaMonte is a serial/parallel library of Monte Carlo routines for \n + optimization, \n + sampling, and \n + integration \nof mathematical objective functions of arbitrary-dimensions in particular, the posterior distributions of Bayesian models in \n + data science, \n + Machine Learning, and \n + scientific inference, \nwith the design goal of unifying the \n + automation (of Monte Carlo simulations), \n + user-friendliness (of the library), \n + accessibility (from multiple programming environments), \n + high-performance (at runtime), and \n + scalability (across many parallel processors)."
8call setAborted(str, newline = SK_'\n', renabled = .true._LK, unit = disp%unit) ! To halt the program, omit `renabled`.
9
10 - FATAL: ParaMonte is a serial/parallel library of Monte Carlo routines for
11 - FATAL: + optimization,
12 - FATAL: + sampling, and
13 - FATAL: + integration
14 - FATAL: of mathematical objective functions of arbitrary-dimensions in particular, the posterior distributions of Bayesian models in
15 - FATAL: + data science,
16 - FATAL: + Machine Learning, and
17 - FATAL: + scientific inference,
18 - FATAL: with the design goal of unifying the
19 - FATAL: + automation(of Monte Carlo simulations),
20 - FATAL: + user-friendliness(of the library),
21 - FATAL: + accessibility(from multiple programming environments),
22 - FATAL: + high-performance(at runtime), and
23 - FATAL: + scalability(across many parallel processors).
24
25call setAborted(str, prefix = SK_' ParaMonte', newline = SK_'\n', renabled = .true._LK, unit = disp%unit)
26
27 ParaMonte - FATAL: ParaMonte is a serial/parallel library of Monte Carlo routines for
28 ParaMonte - FATAL: + optimization,
29 ParaMonte - FATAL: + sampling, and
30 ParaMonte - FATAL: + integration
31 ParaMonte - FATAL: of mathematical objective functions of arbitrary-dimensions in particular, the posterior distributions of Bayesian models in
32 ParaMonte - FATAL: + data science,
33 ParaMonte - FATAL: + Machine Learning, and
34 ParaMonte - FATAL: + scientific inference,
35 ParaMonte - FATAL: with the design goal of unifying the
36 ParaMonte - FATAL: + automation(of Monte Carlo simulations),
37 ParaMonte - FATAL: + user-friendliness(of the library),
38 ParaMonte - FATAL: + accessibility(from multiple programming environments),
39 ParaMonte - FATAL: + high-performance(at runtime), and
40 ParaMonte - FATAL: + scalability(across many parallel processors).
41
42call setAborted(str, prefix = SK_' ParaMonte', newline = SK_'\n', width = 72_IK, renabled = .true._LK, unit = disp%unit)
43
44 ParaMonte - FATAL: ParaMonte is a serial/parallel library of Monte Carlo routines for
45 ParaMonte - FATAL: + optimization,
46 ParaMonte - FATAL: + sampling, and
47 ParaMonte - FATAL: + integration
48 ParaMonte - FATAL: of mathematical objective functions of arbitrary-dimensions in particular,
49 ParaMonte - FATAL: the posterior distributions of Bayesian models in
50 ParaMonte - FATAL: + data science,
51 ParaMonte - FATAL: + Machine Learning, and
52 ParaMonte - FATAL: + scientific inference,
53 ParaMonte - FATAL: with the design goal of unifying the
54 ParaMonte - FATAL: + automation(of Monte Carlo simulations),
55 ParaMonte - FATAL: + user-friendliness(of the library),
56 ParaMonte - FATAL: + accessibility(from multiple programming environments),
57 ParaMonte - FATAL: + high-performance(at runtime), and
58 ParaMonte - FATAL: + scalability(across many parallel processors).
59
60call setAborted(SK_' '//str, help = SK_'Contact cdslab.org for help.', prefix = SK_' ParaMonte', newline = SK_'\n', width = 72_IK, renabled = .true._LK, unit = disp%unit)
61
62 ParaMonte - FATAL: ParaMonte is a serial/parallel library of Monte Carlo routines for
63 ParaMonte - FATAL: + optimization,
64 ParaMonte - FATAL: + sampling, and
65 ParaMonte - FATAL: + integration
66 ParaMonte - FATAL: of mathematical objective functions of arbitrary-dimensions in particular,
67 ParaMonte - FATAL: the posterior distributions of Bayesian models in
68 ParaMonte - FATAL: + data science,
69 ParaMonte - FATAL: + Machine Learning, and
70 ParaMonte - FATAL: + scientific inference,
71 ParaMonte - FATAL: with the design goal of unifying the
72 ParaMonte - FATAL: + automation(of Monte Carlo simulations),
73 ParaMonte - FATAL: + user-friendliness(of the library),
74 ParaMonte - FATAL: + accessibility(from multiple programming environments),
75 ParaMonte - FATAL: + high-performance(at runtime), and
76 ParaMonte - FATAL: + scalability(across many parallel processors).
77
78

test_pm_err


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, 9:49 PM Friday, March 1, 2013, Institute for Fusion Studies, The University of Texas Austin

Definition at line 2436 of file pm_err.F90.


The documentation for this interface was generated from the following file: