From 05e9c2f64639941021983e4a72208564bcb2e2ff Mon Sep 17 00:00:00 2001 From: eschnett Date: Thu, 13 Jun 2013 18:52:10 +0000 Subject: 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 --- src/include/cctk_Loop.h.pl | 30 +++++++++++++++++++++--------- 1 file 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 '), (nl '# include '), (nl '# include '), + (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]