Preprocessing Directives¶
Some aspects of the MOCCA library can be customized by defining preprocessor tokens using #define
command. These macros should be defined before the inclusion of any MOCCA header. Typically, they are set in the compilation phase.
Macros with Major Effects¶
These macros have a major effect on the library and often can break the API (Application Programming Interface) and/or ABI(Application Binary Interface). They can be rather dangerous: if some parts of your program are compiled with one option and other parts of your program are compiled with another, your program may fail to link or exhibit some strange behaviour. Nevertheless, these options can be useful in some situations.
MOCCA_INDEX_TYPE
- Define the type used as an index for all objects in the library. Set tostd::ptrdiff_t
by default.MOCCA_ALLOC_BLOCK
- Define the block size when (re)allocating containers. In order to reduce the number of reallocations when changing the size of the container, all memory allocations are based on a block with a fixed number of entries. Set to1024
entries by default.MOCCA_BLAS
- Specify the interface of the external BLAS/LAPACK library. Options:MKL
orCBLAS
. See BLAS and LAPACK for more information.
Other Macros¶
MOCCA_NO_DEBUG
- If defined, disable all runtime assertion checks. Not defined by default.MOCCA_DISABLE_BROADCAST
- If defined, disable the Broadcast operation. Not defined by default.MOCCA_NO_AUTO_RESIZE
- If defined, disable the automatic resize of the container when assigning an expression to it. If the dimensions mismatch, MOCCA will throw an error unlessMOCCA_NO_DEBUG
is defined. Not defined by default.MOCCA_SIMD_TARGET
- By default, MOCCA will automatically detect and set the appropriate SIMD instruction set. Use this flag to explicitly set the SIMD target. Available options:OMP
,AVX2
orAVX512
.MOCCA_NO_MULTITHREADING
- By default, MOCCA run some algorithms in parallel using OpenMP threads. Note that you must also enable OpenMP in your compiler (e.g., passing the-fopenmp
flag to theclang++
org++
compilers) to enable multithreading. IfMOCCA_NO_MULTITHREADING
is defined, MOCCA will not parallelize the algorithms.MOCCA_DISABLE_UNROLLING
- If defined, disables loop unrolling. Not defined by default.MOCCA_STRONG_INLINE
- This setting forces the compiler to inline performance-critical methods. You can set this macro toinline
to reduce the aggressiveness of function inlining, however, this may result in worse performance if the compiler fails to properly inline the routines.