diff options
author | schnetter <schnetter@2e825fa2-fb71-486d-8b7f-a5ff3f0f6cb8> | 2008-02-20 22:57:16 +0000 |
---|---|---|
committer | schnetter <schnetter@2e825fa2-fb71-486d-8b7f-a5ff3f0f6cb8> | 2008-02-20 22:57:16 +0000 |
commit | f416c3e4020b66b2e8e04e968acc7e9b6b04649d (patch) | |
tree | 7aa32e7833ca9edcc177414d37c26d3a2c74bc2a | |
parent | ea43ffae6e3ed06b1399827205862fb1758a07e0 (diff) |
Check that the timers are initialised correctly.
Some whitespace change.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Slab/trunk@57 2e825fa2-fb71-486d-8b7f-a5ff3f0f6cb8
-rw-r--r-- | src/slab.c | 69 |
1 files changed, 38 insertions, 31 deletions
@@ -6,7 +6,7 @@ Set up the slab exchange information in advance Slab in several stages Test slabbing without MPI - Allow using / not setting the ghost zones + Allow not setting the ghost zones Allow not using / not setting the boundaries Allow different numbers of ghost zones at the lower and upper boundary */ @@ -20,6 +20,7 @@ #undef CHECK /* Omit all self-checks? (Overrides CHECK) */ +#undef NDEBUG #define NDEBUG /* Byte value for poison checks: use 255 for nan, or e.g. 113 for a @@ -73,19 +74,19 @@ CCTK_FILEVERSION(TAT_Slab_slab_c); -static int timer_init; -static int timer_copy_in; -static int timer_xfer; -static int timer_copy_back; +static int timer_init = -1; +static int timer_copy_in = -1; +static int timer_xfer = -1; +static int timer_copy_back = -1; -int -Slab_InitTimers (void) +void +Slab_InitTimers (CCTK_ARGUMENTS) { + DECLARE_CCTK_ARGUMENTS; timer_init = CCTK_TimerCreate ("Slab/init"); timer_copy_in = CCTK_TimerCreate ("Slab/copy in"); timer_xfer = CCTK_TimerCreate ("Slab/xfer"); timer_copy_back = CCTK_TimerCreate ("Slab/copy back"); - return 0; } int @@ -467,17 +468,23 @@ mpi_type (int const cactustype) struct bbox { - int off, len, str; + int off; /* offset */ + int len; /* length */ + int str; /* stride */ }; struct arrays { - struct bbox global, local, active, slab; + struct bbox global; /* global region (all processors) */ + struct bbox local; /* this processor's region */ + struct bbox active; /* ??? */ + struct bbox slab; /* the slab that should be transferred */ }; struct info { - struct arrays src, dst; - int xpose; - int flip; + struct arrays src; /* source region */ + struct arrays dst; /* destination region */ + int xpose; /* exchange axes */ + int flip; /* change directions of axes */ }; @@ -1187,8 +1194,8 @@ Slab_MultiTransfer (cGH const * restrict const cctk ifcheck assert (srcindj>=0 && srcindj<srclenj); ifcheck assert (srcindk>=0 && srcindk<srclenk); for (var=0; var<nvars; ++var) { - ((CCTK_REAL*restrict)srcdata)[srcoffset[n] + var * srcelems[n] + bufind] - = ((const CCTK_REAL*restrict)srcptrs[var])[srcind]; + ((CCTK_REAL*)srcdata)[srcoffset[n] + var * srcelems[n] + bufind] + = ((const CCTK_REAL*)srcptrs[var])[srcind]; } } } @@ -1234,8 +1241,8 @@ Slab_MultiTransfer (cGH const * restrict const cctk ifcheck assert (srcindj>=0 && srcindj<srclenj); ifcheck assert (srcindk>=0 && srcindk<srclenk); for (var=0; var<nvars; ++var) { - ((CCTK_REAL*restrict)srcdata)[srcoffset[n] + var * srcelems[n] + bufind] - = ((const CCTK_REAL*restrict)srcptrs[var])[srcind]; + ((CCTK_REAL*)srcdata)[srcoffset[n] + var * srcelems[n] + bufind] + = ((const CCTK_REAL*)srcptrs[var])[srcind]; } } } @@ -1279,8 +1286,8 @@ Slab_MultiTransfer (cGH const * restrict const cctk assert (srcind < srclentot); assert (bufind < (size_t)srccount[n]); for (var=0; var<nvars; ++var) { - ((CCTK_REAL*restrict)srcdata)[srcoffset[n] + var * srcelems[n] + bufind] - = ((const CCTK_REAL*restrict)srcptrs[var])[srcind]; + ((CCTK_REAL*)srcdata)[srcoffset[n] + var * srcelems[n] + bufind] + = ((const CCTK_REAL*)srcptrs[var])[srcind]; } } } @@ -1448,8 +1455,8 @@ Slab_MultiTransfer (cGH const * restrict const cctk ifcheck assert (dstindj>=0 && dstindj<dstlenj); ifcheck assert (dstindk>=0 && dstindk<dstlenk); for (var=0; var<nvars; ++var) { - ((CCTK_REAL*restrict)dstptrs[var])[dstind] - = ((const CCTK_REAL*restrict)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; + ((CCTK_REAL*)dstptrs[var])[dstind] + = ((const CCTK_REAL*)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; } } } @@ -1492,8 +1499,8 @@ Slab_MultiTransfer (cGH const * restrict const cctk ifcheck assert (dstindj>=0 && dstindj<dstlenj); ifcheck assert (dstindk>=0 && dstindk<dstlenk); for (var=0; var<nvars; ++var) { - ((CCTK_REAL*restrict)dstptrs[var])[dstind] - = ((const CCTK_REAL*restrict)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; + ((CCTK_REAL*)dstptrs[var])[dstind] + = ((const CCTK_REAL*)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; } } } @@ -1536,8 +1543,8 @@ Slab_MultiTransfer (cGH const * restrict const cctk ifcheck assert (dstindj>=0 && dstindj<dstlenj); ifcheck assert (dstindk>=0 && dstindk<dstlenk); for (var=0; var<nvars; ++var) { - ((CCTK_REAL*restrict)dstptrs[var])[dstind] - = ((const CCTK_REAL*restrict)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; + ((CCTK_REAL*)dstptrs[var])[dstind] + = ((const CCTK_REAL*)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; } } } @@ -1548,7 +1555,7 @@ Slab_MultiTransfer (cGH const * restrict const cctk && dstdetail[n*SLAB_MAXDIM+1].str==1 && dstdetail[n*SLAB_MAXDIM+2].str==1 && dsttype == CCTK_VARIABLE_REAL) { - /* Optimised version for a special case: flip in y direction */ + /* Optimised version for a special case: flip in x and y direction */ int const dstoffi = info[0].dst.local.off; int const dstoffj = info[1].dst.local.off; @@ -1580,8 +1587,8 @@ Slab_MultiTransfer (cGH const * restrict const cctk ifcheck assert (dstindj>=0 && dstindj<dstlenj); ifcheck assert (dstindk>=0 && dstindk<dstlenk); for (var=0; var<nvars; ++var) { - ((CCTK_REAL*restrict)dstptrs[var])[dstind] - = ((const CCTK_REAL*restrict)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; + ((CCTK_REAL*)dstptrs[var])[dstind] + = ((const CCTK_REAL*)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; } } } @@ -1590,7 +1597,7 @@ Slab_MultiTransfer (cGH const * restrict const cctk } else if (dstdetail[n*SLAB_MAXDIM ].str==1 && dstdetail[n*SLAB_MAXDIM+1].str==1 && dstdetail[n*SLAB_MAXDIM+2].str==1 - && dsttype == CCTK_VARIABLE_REAL) { + && dsttype == CCTK_VARIABLE_REAL) { /* Optimised version for CCTK_REAL and stride 1 */ for (k = 0; k < dstdetail[n*SLAB_MAXDIM+2].len; ++k) { @@ -1626,8 +1633,8 @@ Slab_MultiTransfer (cGH const * restrict const cctk ifcheck assert (bufind < (size_t)dstcount[n]); ifcheck assert (dstind < dstlentot); for (var=0; var<nvars; ++var) { - ((CCTK_REAL*restrict)dstptrs[var])[dstind] - = ((const CCTK_REAL*restrict)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; + ((CCTK_REAL*)dstptrs[var])[dstind] + = ((const CCTK_REAL*)dstdata)[dstoffset[n] + var * dstelems[n] + bufind]; } } } |