diff options
author | eschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2013-06-13 18:52:10 +0000 |
---|---|---|
committer | eschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2013-06-13 18:52:10 +0000 |
commit | 05e9c2f64639941021983e4a72208564bcb2e2ff (patch) | |
tree | 142701916f4cac906fdf8ff212f343465aa68935 /src | |
parent | c5d9678bc6f429aea4ad16c874a46cbb4df2b0c0 (diff) |
Honour CCTK_DISABLE_OMP_COLLAPSE
Also add CCTK_ATTRIBUTE_UNUSED.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@5027 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rwxr-xr-x | src/include/cctk_Loop.h.pl | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/include/cctk_Loop.h.pl b/src/include/cctk_Loop.h.pl index 4e69b04a..5e9006a8 100755 --- a/src/include/cctk_Loop.h.pl +++ b/src/include/cctk_Loop.h.pl @@ -195,6 +195,18 @@ push @lines, ( (nl '# include <cctk_WarnLevel.h>'), (nl '# include <cGH.h>'), (nl '# include <assert.h>'), + (nl ''), + (nl '# ifndef CCTK_DISABLE_OMP_COLLAPSE'), + (nl '# define CCTK_PRAGMA_OMP_FOR_COLLAPSE_1 _Pragma("omp for collapse(1)")'), + (nl '# define CCTK_PRAGMA_OMP_FOR_COLLAPSE_2 _Pragma("omp for collapse(2)")'), + (nl '# define CCTK_PRAGMA_OMP_FOR_COLLAPSE_3 _Pragma("omp for collapse(3)")'), + (nl '# define CCTK_PRAGMA_OMP_FOR_COLLAPSE_4 _Pragma("omp for collapse(4)")'), + (nl '# else'), + (nl '# define CCTK_PRAGMA_OMP_FOR_COLLAPSE_1 _Pragma("omp for")'), + (nl '# define CCTK_PRAGMA_OMP_FOR_COLLAPSE_2 _Pragma("omp for")'), + (nl '# define CCTK_PRAGMA_OMP_FOR_COLLAPSE_3 _Pragma("omp for")'), + (nl '# define CCTK_PRAGMA_OMP_FOR_COLLAPSE_4 _Pragma("omp for")'), + (nl '# endif'), (nl '#endif /* #ifdef CCODE */'), ); @@ -249,7 +261,7 @@ for $dim (1,2,3,4) { # Export loop bounds in the i direction (bsnl ' int const imin CCTK_ATTRIBUTE_UNUSED = cctki0_imin;'), (bsnl ' int const imax CCTK_ATTRIBUTE_UNUSED = cctki0_imax;'), - (bsnl ' [DIM==1?:_Pragma("omp for collapse([DIM-1])")]'), + (bsnl ' [DIM==1?:CCTK_PRAGMA_OMP_FOR_COLLAPSE_[DIM-1]]'), (reverse (rpt (bsnl ' [I==1?:for (int [C]=cctki0_[C]min; [C]<cctki0_[C]max; ++[C]) {]'))), # Align i-loop to vector size (bsnl (' int const cctki0_ioff = ' . (sep '', rpt '[I==1?(cctki0_imin:+cctki0_[C-1]ash*([C]]') . (sep '', rpt ')') . ' % cctki0_istr;')), @@ -261,7 +273,7 @@ for $dim (1,2,3,4) { (bsnl '#define CCTK_ENDLOOP[DIM]STR_NORMAL(name)'), (bsnl ' }'), (rpt (bsnl ' }')), - (bsnl ' typedef cctki0_loop[DIM]_normal_##name cctki0_ensure_proper_nesting;'), + (bsnl ' typedef cctki0_loop[DIM]_normal_##name cctki0_ensure_proper_nesting CCTK_ATTRIBUTE_UNUSED;'), (bsnl ' } while (0)'), (nl ''), (nl ''), @@ -338,7 +350,7 @@ for $dim (1,2,3,4) { (nl ''), (bsnl '#define CCTK_ENDLOOP[DIM]STR_INTERIOR(name)'), (bsnl ' } CCTK_ENDLOOP[DIM]STR(name##_interior);'), - (bsnl ' typedef cctki2_loop[DIM]_interior_##name cctki2_ensure_proper_nesting;'), + (bsnl ' typedef cctki2_loop[DIM]_interior_##name cctki2_ensure_proper_nesting CCTK_ATTRIBUTE_UNUSED;'), (bsnl ' } while(0)'), (nl ''), (nl ''), @@ -409,7 +421,7 @@ for $dim (1,2,3,4) { (bsnl ' } CCTK_ENDLOOP[DIM]STR_NORMAL(name##_boundaries);'), (bsnl ' } /* if bbox */'), (reverse (rpt (bsnl ' } /* for dir */'))), - (bsnl ' typedef cctki2_loop[DIM]_boundaries_##name cctki2_ensure_proper_nesting;'), + (bsnl ' typedef cctki2_loop[DIM]_boundaries_##name cctki2_ensure_proper_nesting CCTK_ATTRIBUTE_UNUSED;'), (bsnl ' } while (0)'), (nl ''), (nl ''), @@ -482,7 +494,7 @@ for $dim (1,2,3,4) { (bsnl ' } CCTK_ENDLOOP[DIM]STR_NORMAL(name##_intboundaries);'), (bsnl ' } /* if bbox */'), (reverse (rpt (bsnl ' } /* for dir */'))), - (bsnl ' typedef cctki2_loop[DIM]_intboundaries_##name cctki2_ensure_proper_nesting;'), + (bsnl ' typedef cctki2_loop[DIM]_intboundaries_##name cctki2_ensure_proper_nesting CCTK_ATTRIBUTE_UNUSED;'), (bsnl ' } while (0)'), (nl ''), (nl ''), @@ -518,7 +530,7 @@ for $dim (1,2,3,4) { (nl ''), (bsnl '#define CCTK_ENDLOOP[DIM]STR_ALL(name)'), (bsnl ' } CCTK_ENDLOOP[DIM]STR(name##_all);'), - (bsnl ' typedef cctki3_loop[DIM]_all_##name cctki3_ensure_proper_nesting;'), + (bsnl ' typedef cctki3_loop[DIM]_all_##name cctki3_ensure_proper_nesting CCTK_ATTRIBUTE_UNUSED;'), (bsnl ' } while (0)'), (nl ''), (nl ''), @@ -561,7 +573,7 @@ for $dim (1,2,3,4) { (nl ''), (bsnl '#define CCTK_ENDLOOP[DIM]STR_INT(name)'), (bsnl ' } CCTK_ENDLOOP[DIM]STR_INTERIOR(name##_int);'), - (bsnl ' typedef cctki3_loop[DIM]_int_##name cctki3_ensure_proper_nesting;'), + (bsnl ' typedef cctki3_loop[DIM]_int_##name cctki3_ensure_proper_nesting CCTK_ATTRIBUTE_UNUSED;'), (bsnl ' } while (0)'), (nl ''), (nl ''), @@ -610,7 +622,7 @@ for $dim (1,2,3,4) { (nl ''), (bsnl '#define CCTK_ENDLOOP[DIM]STR_BND(name)'), (bsnl ' } CCTK_ENDLOOP[DIM]STR_BOUNDARIES(name##_bnd);'), - (bsnl ' typedef cctki3_loop[DIM]_bnd_##name cctki3_ensure_proper_nesting;'), + (bsnl ' typedef cctki3_loop[DIM]_bnd_##name cctki3_ensure_proper_nesting CCTK_ATTRIBUTE_UNUSED;'), (bsnl ' } while (0)'), (nl ''), (nl ''), @@ -659,7 +671,7 @@ for $dim (1,2,3,4) { (nl ''), (bsnl '#define CCTK_ENDLOOP[DIM]STR_INTBND(name)'), (bsnl ' } CCTK_ENDLOOP[DIM]STR_INTBOUNDARIES(name##_intbnd);'), - (bsnl ' typedef cctki3_loop[DIM]_intbnd_##name cctki3_ensure_proper_nesting;'), + (bsnl ' typedef cctki3_loop[DIM]_intbnd_##name cctki3_ensure_proper_nesting CCTK_ATTRIBUTE_UNUSED;'), (bsnl ' } while (0)'), (nl ''), (nl '#endif /* #ifdef CCODE */'), |