TBCI Numerical high perf. C++ Library 2.8.0
tbci_param.h File Reference

This provides some parameters that control the behavior of various functions in the TBCI library. More...

#include "tbci/basics.h"
Include dependency graph for tbci_param.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _TBCI_FLAG_ERRCHECK   1
#define _TBCI_FLAG_EXPCHECK   2
#define _TBCI_FLAG_ABORT   4
#define _TBCI_FLAG_EXCEPT   8
#define _TBCI_FLAG_EXACTSUM   16
#define _TBCI_FLAG_EXACTSUM2   32
#define _TBCI_CWD_DEFAULT   (_TBCI_FLAG_ERRCHECK | _TBCI_FLAG_EXPCHECK | _TBCI_FLAG_EXCEPT)
#define GET_T_CWD   tbci_control
#define CWD_CTRL_FCTS(NAME, FLAG)
#define CWD_CTRL_DISABLED(NAME)

Functions

void set_errcheck (bool val)
unsigned int do_errcheck ()
void set_expcheck (bool val)
unsigned int do_expcheck ()
void set_abort (bool val)
unsigned int do_abort ()
void set_except (bool val)
unsigned int do_except ()
void set_exactsum (bool val)
unsigned int do_exactsum ()
void set_exactsum2 (bool val)
unsigned int do_exactsum2 ()

Variables

unsigned int tbci_control

Detailed Description

This provides some parameters that control the behavior of various functions in the TBCI library.

The behavior of the TBCI lib is controlled by the following settings:

  • void set_errcheck(bool val)
    Definition tbci_param.h:141
    Whether the library should check for errors when performing operations – the checks enabled with this do NOT impose a significant performance overhead, so it's recommended to enable this (which is default). This setting is not available if the library is compiled with TBCI_NO_ERRCHECK.
  • void set_expcheck(bool val)
    Definition tbci_param.h:144
    Whether the library does expensive error checks. This does enable bound checking for vector and matrix element access, which makes it expensive ... You can only enable this if you compile with -DTBCI_EXPCHECK. If you do, then it's also enabled by default.
  • void set_abort(bool val)
    Definition tbci_param.h:148
    Whether the library should abort execution when detecting errors. This is useful in a debugger, where you can use the backtrace to locate the issue. This is disabled by default.
  • void set_except(bool val)
    Definition tbci_param.h:149
    Whether the library should throw exceptions on detected errors. All exceptions should be decendants of TBCI::NumErr. This is enabled by default; if you disable it, an error message will be printed to stderr and the program will continue (with the most likely wrong values resulting from the error condition).
  • void set_exactsum(bool val)
    Definition tbci_param.h:150
    Whether the library should use an algorithm to produce exact sums when doing vector sums, vector dot products or vector absolute computation. (We don't use Kahan's algorithm, but a slightly better and more efficient one.) This approximately doubles the effort for calculating the sum – on multithreaded operations, this may however become insignificant due to being limited by memory bandwidth and not FPU power. This is disabled by default.
  • void set_exactsum2(bool val)
    Definition tbci_param.h:151
    Whether the library should use the exact summation algorithm also for Matrix Vector and Matrix Matrix products. (Note – not all matrix types have fully implemented this; for some cases it's very non-trivial ...) This is disabled by default.

The TBCI configuration is stored in the control word TBCI::tbci_control; this variable is contained (weakly) in the smp.cc file (because that's the only place in TBCI where we have global static variables). If you don't link with the smp object (by -ltbcismp), you need to put

namespace TBCI { unsigned int tbci_control = _TBCI_CWD_DEFAULT; };
The TBCI Numerical Library is put into TBCI namespace, if the compiler supports it (egcs-1....
unsigned int tbci_control
#define _TBCI_CWD_DEFAULT
Definition tbci_param.h:69

in your main program. (However, as SMP support is enabled by default nowadays, chances are that you'll have to link against -ltbcismp anyway.)

Definition in file tbci_param.h.

Macro Definition Documentation

◆ _TBCI_CWD_DEFAULT

#define _TBCI_CWD_DEFAULT   (_TBCI_FLAG_ERRCHECK | _TBCI_FLAG_EXPCHECK | _TBCI_FLAG_EXCEPT)

Definition at line 69 of file tbci_param.h.

◆ _TBCI_FLAG_ABORT

#define _TBCI_FLAG_ABORT   4

Definition at line 64 of file tbci_param.h.

Referenced by do_abort().

◆ _TBCI_FLAG_ERRCHECK

#define _TBCI_FLAG_ERRCHECK   1

Definition at line 62 of file tbci_param.h.

Referenced by do_errcheck().

◆ _TBCI_FLAG_EXACTSUM

#define _TBCI_FLAG_EXACTSUM   16

Definition at line 66 of file tbci_param.h.

Referenced by do_exactsum().

◆ _TBCI_FLAG_EXACTSUM2

#define _TBCI_FLAG_EXACTSUM2   32

Definition at line 67 of file tbci_param.h.

Referenced by do_exactsum2().

◆ _TBCI_FLAG_EXCEPT

#define _TBCI_FLAG_EXCEPT   8

Definition at line 65 of file tbci_param.h.

Referenced by do_except().

◆ _TBCI_FLAG_EXPCHECK

#define _TBCI_FLAG_EXPCHECK   2

Definition at line 63 of file tbci_param.h.

Referenced by do_expcheck().

◆ CWD_CTRL_DISABLED

#define CWD_CTRL_DISABLED ( NAME)
Value:
void inline set_##NAME(bool val) \
{ \
if (val) \
fprintf(stderr, "TBCI warning: Attempt to set " #NAME ", which is disabled.\n"); \
}; \
inline unsigned int do_##NAME() \
{ \
return 0; \
}

Definition at line 127 of file tbci_param.h.

◆ CWD_CTRL_FCTS

#define CWD_CTRL_FCTS ( NAME,
FLAG )
Value:
void inline set_##NAME(bool val) \
{ \
unsigned int& cwd = GET_T_CWD; \
if (val) \
cwd |= FLAG; \
else \
cwd &= ~(FLAG); \
}; \
inline unsigned int do_##NAME() \
{ \
const unsigned int cwd = GET_T_CWD; \
return cwd & FLAG; \
}
#define GET_T_CWD
Definition tbci_param.h:109

Definition at line 112 of file tbci_param.h.

◆ GET_T_CWD

#define GET_T_CWD   tbci_control

Definition at line 109 of file tbci_param.h.

Function Documentation

◆ do_abort()

unsigned int do_abort ( )
inline

Definition at line 148 of file tbci_param.h.

References _TBCI_FLAG_ABORT.

◆ do_errcheck()

unsigned int do_errcheck ( )
inline

Definition at line 141 of file tbci_param.h.

References _TBCI_FLAG_ERRCHECK.

◆ do_exactsum()

◆ do_exactsum2()

◆ do_except()

unsigned int do_except ( )
inline

Definition at line 149 of file tbci_param.h.

References _TBCI_FLAG_EXCEPT.

◆ do_expcheck()

unsigned int do_expcheck ( )
inline

Definition at line 144 of file tbci_param.h.

References _TBCI_FLAG_EXPCHECK.

Referenced by DiagPreconditioner< T, MatrixType >::update().

◆ set_abort()

void set_abort ( bool val)
inline

Definition at line 148 of file tbci_param.h.

◆ set_errcheck()

void set_errcheck ( bool val)
inline

Definition at line 141 of file tbci_param.h.

◆ set_exactsum()

void set_exactsum ( bool val)
inline

Definition at line 150 of file tbci_param.h.

◆ set_exactsum2()

void set_exactsum2 ( bool val)
inline

Definition at line 151 of file tbci_param.h.

◆ set_except()

void set_except ( bool val)
inline

Definition at line 149 of file tbci_param.h.

◆ set_expcheck()

void set_expcheck ( bool val)
inline

Definition at line 144 of file tbci_param.h.

Variable Documentation

◆ tbci_control

unsigned int tbci_control
extern