Skip to content

Commit

Permalink
Add macro for loop unrolling across compilers (AMReX-Codes#3701)
Browse files Browse the repository at this point in the history
  • Loading branch information
atmyers authored Jan 17, 2024
1 parent 03f5936 commit 9b799ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Src/Base/AMReX_Extension.H
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,18 @@
#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(__clang__) || defined(__CUDACC__) || defined(__HIP__) || defined(__INTEL_CLANG_COMPILER)
#define AMREX_UNROLL_LOOP(n) _Pragma(AMREX_TO_STRING(unroll (n)))
#elif defined(__GNUC__)
#define AMREX_UNROLL_LOOP(n) _Pragma(AMREX_TO_STRING(GCC unroll (n)))
#else
#define AMREX_UNROLL_LOOP(n)
#endif

// __attribute__((weak))

#if defined(AMREX_TYPECHECK)
Expand Down

0 comments on commit 9b799ef

Please sign in to comment.