FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
Preprocessor Macros

This page summarizes the preprocessor macros defined by the build-system, the compiler detection or the user.



Compiler-Detection Macros

This section enlists the macros defined by the compiler detection headers to provide information about the compiler and its version being in use.


FEAT_COMPILER

This macro is defined by the compiler detection system and its value is a string literal specifying the name and possibly the version of the compiler in use, e.g. "Microsoft Visual C++ 2015" or "GNU C++ compiler".

Note
This macro may also be defined the user through the build system, which will effectively disable the internal compiler detection system.

FEAT_COMPILER_GNU

This macro is defined if the GNU C++ compiler is detected. Its value is defined as

(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)

which is a constant integral expression identifying the compiler version, e.g. the value 40702 identifies the G++ 4.7.2 compiler. See the compiler's documentation for details.


FEAT_COMPILER_CLANG

This macro is defined if the Clang/LLVM C++ compiler is detected. Its value is defined as

(__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)

which is a constant integral expression identifying the compiler version, e.g. the value 40702 identifies the clang 4.7.2 compiler. See the compiler's documentation for details.


FEAT_COMPILER_CRAY

This macro is defined if the Cray C++ compiler is detected. Its value is defined as

(_RELEASE_MAJOR * 10000 + _RELEASE_MINOR)

which is a constant integral expression identifying the compiler version. See the compiler's documentation for details.


FEAT_COMPILER_INTEL

This macro is defined if the Intel C++ compiler is detected. Its value coindices with the compiler's internal macro __INTEL_COMPILER, which is a constant integral expression identifying the compiler version, e.g. the value 1210 identifies the Intel C++ 12.1 compiler. See the compiler's documentation for details.


FEAT_COMPILER_INTEL_ONEAPI

This macro is defined if the Intel OneAPI C++ compiler is detected. Its value coindices with the compiler's internal macro __INTEL_LLVM_COMPILER, which is a constant integral expression identifying the compiler version, e.g. the value 20250000 identifies the Intel OneAPI C++ 2025.0 compiler. See the compiler's documentation for details.


FEAT_COMPILER_MICROSOFT

This macro is defined if the Microsoft Visual C++ compiler is detected. Its value coincides with the compiler's internal macro _MSC_FULL_VER, which is an constant integral expression identifying the compiler version, e.g. the value 193030705 identifies the initial release version of the Visual C++ 2022 compiler. See the compiler's documentation for details.



Backend / Library Macros

This section enlists macros defined by the build system, which specify what types of third-party libraries and backends are available to FEAT.


FEAT_HAVE_ALGLIB

This macro is defined by the build system if the FEAT kernel is linked against the ALGLIB library.


FEAT_HAVE_CGAL

This macro is defined by the build system if the FEAT kernel is linked against the CGAL library.


FEAT_HAVE_BOOST

This macro is defined by the build system if the FEAT kernel is linked against the BOOST library.


FEAT_HAVE_DEATH_HANDLER

This macro is defined by the build system if the FEAT kernel is linked against the DeathHandler library.


FEAT_HAVE_CUDA

This macro is defined by the build system if the FEAT kernel is linked against the CUDA library.

If defined, the LAFEM subsystem of the FEAT kernel will offer corresponding specializations for the containters and operations using CUDA as a work-horse.


FEAT_HAVE_CUDSS

This macro is defined by the build system if the FEAT kernel is linked against the cuDSS library.


FEAT_HAVE_FPARSER

This macro is defined by the build system if the FEAT kernel is linked against the fparser library.


FEAT_HAVE_FLOATX

This macro is defined by the build system if the FEAT kernel has support for datatypes offered by the FloatX library.


FEAT_HAVE_HALFMATH

This macro is defined by the build system if the FEAT kernel has support for halfmath datatypes. The datatypes name is half_float::half.


FEAT_HAVE_HYPRE

This macro is defined by the build system if the FEAT kernel is linked against the HYPRE library.


FEAT_HAVE_METIS

This macro is defined by the build system if the FEAT kernel is linked against the METIS library.


FEAT_HAVE_MKL

This macro is defined by the build system if the FEAT kernel is linked against the Intel MKL library.

If defined, the LAFEM subsystem of the FEAT kernel will offer corresponding specializations for the operations using the MKL as a work-horse.


FEAT_HAVE_MPI

This macro is defined by the build system if the FEAT kernel is linked against a MPI library.


FEAT_HAVE_OMP

This macro activates support for OpenMP, a compilerpragma based C++ extension for multithreading. Note, that this also activates support for the parallel version of the Intel MKL Library, if enabled separately.


FEAT_HAVE_PARMETIS

This macro is defined by the build system if the FEAT kernel is linked against the ParMETIS library.

Note
If this macro is defined, then FEAT_HAVE_METIS is also defined.

FEAT_HAVE_QUADMATH

This macro is defined by the build system if the FEAT kernel is linked against the quadmath library, which is included in the GCC compiler since version 4.6.0. If defined, corresponding specializations and overloads for the datatype __float128 are supplied.


FEAT_HAVE_SUPERLU_DIST

This macro is defined by the build system if the FEAT kernel is linked against the SuperLU_DIST library.


FEAT_HAVE_TRIANGLE

This macro is defined by the build system if the FEAT kernel is linked against the triangle library, which offers a set of 2D triangular mesh generators.

Note
If you want to include the triangle.h header file, you first have to define the following preprocessor macros, before including the header itself:
#define ANSI_DECLARATORS
#define REAL double
#define VOID void

FEAT_HAVE_TRILINOS

This macro is defined by the build system if the FEAT kernel is linked against the trilinos library, a collection of reusable scientific software libraries, known in particular for linear solvers, non-linear solvers, transient solvers, optimization solvers, and uncertainty quantification (UQ) solvers.


FEAT_HAVE_UMFPACK

This macro is defined by the build system if the FEAT kernel is linked against the UMFPACK library, which is part of the SuiteSparse library package.


FEAT_HAVE_ZFP

This macro is defined by the build system if the FEAT kernel is linked against the zfp library.


FEAT_HAVE_ZLIB

This macro is defined by the build system if the FEAT kernel is linked against the zlib library.


FEAT_HAVE_ZOLTAN

This macro is defined by the build system if the FEAT kernel is linked against the zoltan library.



User-Defineable Macros

This section enlists miscellaneous macros that can be defined by the user via the build-system to affect various parts of the FEAT kernel.


FEAT_EICKT

This macro can be defined to enable explicit instantiation of all common kernel templates.

Note
This macro is defined if the command line option --eickt is passed to the configure script.

FEAT_INDEX_U32

This macro can be defined to affect the definition of the FEAT::Index data type in the kernel base-header.

Effects:
If undefined, FEAT::Index is a typedef for std::uint64_t.
If defined, FEAT::Index is a typedef for std::uint32_t.


FEAT_NO_CONFIG

This macro can be defined to avoid config-header inclusion in the kernel base-header.

Effects:
If undefined, the kernel base-header will include the header feat_config.hpp from the FEAT root directory at the beginning of the file.

Note
This macro is automatically defined by the Visual Studio build system.

FEAT_OVERRIDE_MPI_OPS

This macro can be defined to override the default MPI operation implmentations by custom implementations.

Effects:
If defined, the MPI wrapper classes and functions implemented in the FEAT::Dist namespace will use custom implementations of the Dist::op_sum, Dist::op_max and Dist::op_min operations, which provide support for additional custom datatypes such as the 128-bit float supplied by the quadmath library.

Remarks
Overriding the default implementations supplied by the MPI library seems to have a negative impact on performance for the default data types in some cases. Therefore, it is advised to define this macro only if support for additional datatypes is required.
Note
This macro is defined if the command line option --ovr_mpi_ops is passed to the configure script.

FEAT_MPI_THREAD_MULTIPLE

This macro can be defined to distribute the actual executoin of asynchronous mpi calls to separate threads.

Effects:
If defined, the SynchScalarTicket starts a new thread for its MPI calls and thus enforces truly asynchronous execution. In accordance to [Wittmann13], the MPI_Wait call follows directly after the previous mpi call to unconditionally trigger the start of all mpi communication.

Note
This macro is defined if the command line option --mpi_thread_multiple is passed to the configure script.

FEAT_USE_MKL_SPARSE_EXECUTOR

Use the new intel mkl sparse executor interface for sparse matrix vector products.


FEAT_UNROLL_BANDED

This macro can be defined to enable loop unrolling of the SparseMatrixBanded kernels via template meta programming.

Note
This macro is defined if the command line option --unroll_banded is passed to the configure script.


Code-Generation Control Macros

This section enlist various macros which control the compiler's code generation.


FEAT_PRAGMA_IVDEP

This macro can be used to instruct the compiler to ignore assumed vector dependencies. To use this loop pragma, place it immediately before - not in - a loop definition. The pragma takes effect for the scope of the loop that follows it.

See also:


FEAT_PRAGMA_OMP

This macro is used to declare OpenMP pragmas in FEAT3 code and its one and only parameter is the omp directive part following the #pragma omp, so as an example, the typical #pragma omp parallel for simply becomes FEAT_PRAGMA_OMP(parallel for). The reason for why one should use this macro (instead of the direct #pragma omp directive) is that the FEAT_PRAGMA_OMP macro can be deactivated via the build system if FEAT3 is configured to build without OpenMP support enabled, which would result in 'unknown pragma' warnings otherwise.

FEAT_PRAGMA_OMP(parallel for shared(alpha)) // <==> #pragma omp parallel for shared(alpha)
for(int i = 0; i < n; ++i)
y[i] *= alpha*x[i];

FORCE_INLINE

This macro can be used to force the compiler to compile a function inline. The semantics of FORCE_INLINE are exactly the same as those for the C++ inline keyword.


NOINLINE

This macro can be used to force the compiler to compile a function without inlining.



Miscellaneous Macros

This section enlists various macros which do not fit into any other section.


FEAT_DISABLE_WARNINGS / FEAT_RESTORE_WARNINGS

This macro pair can be used to modify the compiler's diagnostics settings to suppress warnings for the inclusion of third-party header includes.

Attention
This macro pair is meant only for third-party includes and shall not be used to suppress warning arising from FEAT code!
Note
This macro pair may not be supported by all compilers. Furthermore, some warnings cannot be disabled, so there is no guarantee that the compiler will remain quiet even if this macro pair is in use.

Example:

// suppress warnings for third-party header
FEAT_DISABLE_WARNINGS
// include third-party header producing compiler warnings
#include <thirdparty/some_library/wicked_header.h>
// restore previous diagnostics settings
FEAT_RESTORE_WARNINGS
// ...
FEAT Kernel base header.

FEAT_GIT_SHA1

This macro contains the git sha1 checksum of the current HEAD in FEAT_SOURCE_DIR, at the time configure was executed.


FEAT_F128C(x)

This functional macro can be used to define 128-bit floating point constants if FEAT is configured to link against the quadmath library. The exact definition of this macro is as follows:

#ifdef FEAT_HAVE_QUADMATH
# define FEAT_F128C(x) x##Q
#else
# define FEAT_F128C(x) x
#endif


Build-System Macros

This section enlists the macros defined directly by the buildsystem, specifying the current build mode.

Attention
The macros in this section are highly platform dependent by definition, i.e. there is no guarantee that a specific macro is defined on all platforms. Your code should not rely on any of these macros being defined!

FEAT_DEBUG_MODE

This macro is defined if the corresponding build is a debug build. If defined, the kernel base-header defines the DEBUG macro.


VISUAL_STUDIO

This macro is defined as 1 by the hand-made Visual Studio project files. It must be left undefined by the CMake and any other build system, independent of whether the MS VC++ compiler is used or not.


FEAT_TESTING_VC

This macro is defined as 1 by the Visual Studio regression test system to disable error popup dialogs and install a custom exception filter for the Windows OS.


FEAT_SOURCE_DIR

This macro contains a string literal specifying the full absolute path to the root source directory.


FEAT_BINARY_DIR

This macro contains a string literal specifying the full absolute path to the root binary directory.


FEAT_BUILD_ID

This macro contains a string literal specifying the user provided build id string, that was passed to the configure_feat script.


FEAT_CPU_TYPE

This macro contains a string literal describing the detected target cpu type.


FEAT_SYSTEM_HOST_COMPILER

The system compiler the actual host compiler will rely on, e.g. using its header files etc.


FEAT_CUDA_HOST_COMPILER

The host compiler that will be used by nvcc for host code compilation.


CMAKE_CXX_COMPILER_ID

Descriptive compiler name, as detected by cmake.


FEAT_COMPILER_ID

Descriptive compiler name, as set by the configure_feat script.


CMAKE_CXX_COMPILER_VERSION

Compiler version, as detected by cmake.


CMAKE_CXX_COMPILER

Path to the used host compiler.


FEAT_USE_COMPILER_WRAPPER

This macro indicates, if defined, that a compiler wrapper like ccache or distcc is used to compile FEAT.


CMAKE_CXX_COMPILER_ARG1

Contains the 'real' compiler, if we use a COMPILER_WRAPPER. Is empty, if we don't.


CMAKE_CXX_COMPILER_ARG1_PATH

Path to CMAKE_CXX_COMPILER_ARG1, if any.


CMAKE_CXX_FLAGS

The CXXFLAGS of the host compiler.


FEAT_CUDA_NVCC_EXECUTABLE

Path to the used nvcc compiler.


FEAT_CUDA_NVCC_FLAGS

The CXXFLAGS of the nvcc compiler.


FEAT_CUDA_VERSION

Version of the cuda SDK.


FEAT_CUDA_VERSION_MAJOR

Major version of the cuda SDK.


FEAT_CUDA_ARCH

Compile for this CUDA device architecture


MPI_CXX_COMPILER

Absolute path to mpi compiler wrapper.


MPIEXEC

Absolute path to mpi execution wrapper.


CMAKE_MPI_VERSION

MPI Library version.


FEAT_HOSTNAME

Hostname of the computer in use.


CMAKE_COMMAND

Full path of the cmake binary.


CMAKE_GENERATOR

The 'makefile' generator used by cmake.