Skip to content

Commit

Permalink
Add macro for loop unrolling across compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
atmyers committed Jan 16, 2024
1 parent 03f5936 commit 8c185ca
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Src/Base/AMReX_Extension.H
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,21 @@
#define AMREX_NO_INLINE
#endif

// unroll loop
#define AMREX_TO_STRING_HELPER(X) #X
#define AMREX_TO_STRING(X) AMREX_TO_STRING_HELPER(X)

#if defined(__GNUC__)
#define AMREX_UNROLL_LOOP(n) _Pragma(AMREX_TO_STRING(GCC unroll (n)))
#elif defined(__clang__) || defined(__CUDACC__) || defined(__HIP__) || defined(__INTEL_CLANG_COMPILER))
#define AMREX_UNROLL_LOOP(n) _Pragma(AMREX_TO_STRING(unroll (n)))
#else
#define AMREX_UNROLL_LOOP(n)
#endif

//#undef AMREX_TO_STRING_HELPER
//#undef AMREX_TO_STRING

// __attribute__((weak))

#if defined(AMREX_TYPECHECK)
Expand Down

0 comments on commit 8c185ca

Please sign in to comment.