Skip to content
Snippets Groups Projects
Commit 4066bca3 authored by Simon Praetorius's avatar Simon Praetorius
Browse files

Merge branch 'issue/pragma-omp-simd-warnings' into 'master'

Introduce conditional pragma omp simd only if available

Closes #267

See merge request core/dune-common!1035
parents ad1143b3 7941323f
Branches
Tags
1 merge request!1035Introduce conditional pragma omp simd only if available
Pipeline #40835 passed
Pipeline: Dune Nightly Test

#40836

    ......@@ -24,10 +24,16 @@ namespace Dune {
    # pragma GCC diagnostic ignored "-Wint-in-bool-context"
    #endif
    /*
    * silence warnings about unknown pragmas (e.g. opm simd)
    * Introduce a simd pragma if OpenMP is available in standard version >= 4
    */
    # pragma GCC diagnostic ignored "-Wunknown-pragmas"
    #if _OPENMP >= 201307
    #define DUNE_PRAGMA_OMP_SIMD _Pragma("omp simd")
    #else
    #define DUNE_PRAGMA_OMP_SIMD
    #endif
    /**
    * This class specifies a vector-like type deriving from std::array
    ......@@ -69,7 +75,7 @@ namespace Dune {
    //Prefix operators
    #define DUNE_SIMD_LOOP_PREFIX_OP(SYMBOL) \
    auto operator SYMBOL() { \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    SYMBOL(*this)[i]; \
    } \
    ......@@ -85,7 +91,7 @@ namespace Dune {
    #define DUNE_SIMD_LOOP_UNARY_OP(SYMBOL) \
    auto operator SYMBOL() const { \
    LoopSIMD<T,S,A> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = SYMBOL((*this)[i]); \
    } \
    ......@@ -99,7 +105,7 @@ namespace Dune {
    auto operator!() const {
    Simd::Mask<LoopSIMD<T,S,A>> out;
    #pragma omp simd
    DUNE_PRAGMA_OMP_SIMD
    for(std::size_t i=0; i<S; i++){
    out[i] = !((*this)[i]);
    }
    ......@@ -123,7 +129,7 @@ namespace Dune {
    //Assignment operators
    #define DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL) \
    auto operator SYMBOL(const Simd::Scalar<T> s) { \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    (*this)[i] SYMBOL s; \
    } \
    ......@@ -131,7 +137,7 @@ namespace Dune {
    } \
    \
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v) { \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    (*this)[i] SYMBOL v[i]; \
    } \
    ......@@ -157,7 +163,7 @@ namespace Dune {
    template<class T, std::size_t S, std::size_t A> \
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
    LoopSIMD<T,S,A> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = v[i] SYMBOL s; \
    } \
    ......@@ -166,7 +172,7 @@ namespace Dune {
    template<class T, std::size_t S, std::size_t A> \
    auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
    LoopSIMD<T,S,A> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = s SYMBOL v[i]; \
    } \
    ......@@ -176,7 +182,7 @@ namespace Dune {
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    const LoopSIMD<T,S,A> &w) { \
    LoopSIMD<T,S,A> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = v[i] SYMBOL w[i]; \
    } \
    ......@@ -201,7 +207,7 @@ namespace Dune {
    template<class T, std::size_t S, std::size_t A, class U> \
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
    LoopSIMD<T,S,A> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = v[i] SYMBOL s; \
    } \
    ......@@ -211,7 +217,7 @@ namespace Dune {
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    const LoopSIMD<U,S,AU> &w) { \
    LoopSIMD<T,S,A> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = v[i] SYMBOL w[i]; \
    } \
    ......@@ -229,7 +235,7 @@ namespace Dune {
    template<class T, std::size_t S, std::size_t A, class U> \
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = v[i] SYMBOL s; \
    } \
    ......@@ -238,7 +244,7 @@ namespace Dune {
    template<class T, std::size_t S, std::size_t A> \
    auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = s SYMBOL v[i]; \
    } \
    ......@@ -248,7 +254,7 @@ namespace Dune {
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    const LoopSIMD<T,S,A> &w) { \
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = v[i] SYMBOL w[i]; \
    } \
    ......@@ -269,7 +275,7 @@ namespace Dune {
    template<class T, std::size_t S, std::size_t A> \
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = v[i] SYMBOL s; \
    } \
    ......@@ -278,7 +284,7 @@ namespace Dune {
    template<class T, std::size_t S, std::size_t A> \
    auto operator SYMBOL(const Simd::Mask<T> s, const LoopSIMD<T,S,A> &v) { \
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = s SYMBOL v[i]; \
    } \
    ......@@ -288,7 +294,7 @@ namespace Dune {
    auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
    const LoopSIMD<T,S,A> &w) { \
    Simd::Mask<LoopSIMD<T,S,A>> out; \
    _Pragma("omp simd") \
    DUNE_PRAGMA_OMP_SIMD \
    for(std::size_t i=0; i<S; i++){ \
    out[i] = v[i] SYMBOL w[i]; \
    } \
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment