From e182636e93e86e360d4e04f63ef68d2fe3a664d7 Mon Sep 17 00:00:00 2001 From: Seung Hyun Kim Date: Fri, 12 Jul 2024 22:26:15 -0500 Subject: [PATCH] files: module settings --- backend/src/ModuleSettings/Parallel.hpp | 35 ++++++++++++++++++ backend/src/ModuleSettings/Systems.hpp | 30 ++++++++++++++++ backend/src/ModuleSettings/Vectorization.hpp | 22 ++++++++++++ backend/src/ModuleSettings/Version.hpp | 37 ++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 backend/src/ModuleSettings/Parallel.hpp create mode 100644 backend/src/ModuleSettings/Systems.hpp create mode 100644 backend/src/ModuleSettings/Vectorization.hpp create mode 100644 backend/src/ModuleSettings/Version.hpp diff --git a/backend/src/ModuleSettings/Parallel.hpp b/backend/src/ModuleSettings/Parallel.hpp new file mode 100644 index 00000000..b742654a --- /dev/null +++ b/backend/src/ModuleSettings/Parallel.hpp @@ -0,0 +1,35 @@ +#pragma once + +//****************************************************************************** +// Includes +//****************************************************************************** + +namespace elastica { + + //============================================================================ + // + // PARALLEL CONFIGURATION + // + //============================================================================ + +#include "Configuration/Parallel.hpp" + +//****************************************************************************** +/*!\brief Compilation switch for TBB parallelization. + * \ingroup parallel + * + * This compilation switch enables/disables TBB parallelization. In case TBB is + * enabled during compilation, \elastica attempts to parallelize computations, + * if requested by the configuration. In case no parallelization is enabled, + * all computations are performed on a single compute core, even if the + * configuration requests it + */ +#if defined(ELASTICA_USE_SHARED_MEMORY_PARALLELIZATION) && \ + defined(ELASTICA_USE_TBB) +#define ELASTICA_TBB_PARALLEL_MODE 1 +#else +#define ELASTICA_TBB_PARALLEL_MODE 0 +#endif + //**************************************************************************** + +} // namespace elastica diff --git a/backend/src/ModuleSettings/Systems.hpp b/backend/src/ModuleSettings/Systems.hpp new file mode 100644 index 00000000..fa15b96a --- /dev/null +++ b/backend/src/ModuleSettings/Systems.hpp @@ -0,0 +1,30 @@ +#pragma once + +//****************************************************************************** +// Includes +//****************************************************************************** +#include + +namespace elastica { + + //============================================================================ + // + // SYSTEMS CONFIGURATION + // + //============================================================================ + +#include "Configuration/Systems.hpp" + + namespace detail { + + inline bool systems_warnings_enabled() /* noexcept*/ { + // if set to 0 also return true + if (const char* env_v = std::getenv(ENV_ELASTICA_NO_SYSTEM_WARN)) + return not bool(env_v[0]); + else + return true; + } + + } // namespace detail + +} // namespace elastica diff --git a/backend/src/ModuleSettings/Vectorization.hpp b/backend/src/ModuleSettings/Vectorization.hpp new file mode 100644 index 00000000..36fd75e0 --- /dev/null +++ b/backend/src/ModuleSettings/Vectorization.hpp @@ -0,0 +1,22 @@ +#pragma once + +//****************************************************************************** +// Includes +//****************************************************************************** + +// Ideally the check here would include system vectorization macro checks, such +// as in blaze. +// But directly including blaze's vectorization also includes intrinsics headers +// which we want to avoid. + +//****************************************************************************** +/*!\brief Vectorization flag for some Elastica++ kernels + * \ingroup config + * + * This macro enables use of vectorized kernels when available. + */ +#if defined(__APPLE__) && defined(__arm64__) +#define ELASTICA_USE_VECTORIZATION 0 +#else +#define ELASTICA_USE_VECTORIZATION BLAZE_USE_VECTORIZATION +#endif diff --git a/backend/src/ModuleSettings/Version.hpp b/backend/src/ModuleSettings/Version.hpp new file mode 100644 index 00000000..1dc2338e --- /dev/null +++ b/backend/src/ModuleSettings/Version.hpp @@ -0,0 +1,37 @@ +#pragma once + +//****************************************************************************** +/*!\brief Major version of \elastica. + * \ingroup config + * + * \details + * This value corresponds to the major version of \elastica. For + * instance, in \elastica version 3.9.0, the ELASTICA_MAJOR_VERSION corresponds + * to 3. + */ +#define ELASTICA_MAJOR_VERSION 0 +//****************************************************************************** + +//****************************************************************************** +/*!\brief Minor version of \elastica. + * \ingroup config + * + * \details + * This value corresponds to the minor version of \elastica. For + * instance, in \elastica version 3.9.0, the ELASTICA_MINOR_VERSION corresponds + * to 9. + */ +#define ELASTICA_MINOR_VERSION 0 +//****************************************************************************** + +//****************************************************************************** +/*!\brief Patch version of \elastica. + * \ingroup config + * + * \details + * This value corresponds to the patch version of \elastica. For + * instance, in \elastica version 3.9.0, the ELASTICA_PATCH_VERSION corresponds + * to 0. + */ +#define ELASTICA_PATCH_VERSION 2 +//******************************************************************************