diff options
author | schnetter <> | 2002-01-02 16:14:00 +0000 |
---|---|---|
committer | schnetter <> | 2002-01-02 16:14:00 +0000 |
commit | e8176fefae61fb350d868bd425af279781d6a12f (patch) | |
tree | c1a70d950bad0d868f098c708893b0ed839cf3ec /Carpet/CarpetReduce/src | |
parent | d32f908366804837c207124dcc4b1ac34b7e8293 (diff) |
Introduced a new component iterator that loops only over the
Introduced a new component iterator that loops only over the
(processor-)local components. Used this instead of the generic one in
all appropriate places. This should reduce the overhead when running
on multiple processors.
darcs-hash:20020102161408-07bb3-d8e788affd20e6d3222ee1c054acaeb25019090d.gz
Diffstat (limited to 'Carpet/CarpetReduce/src')
-rw-r--r-- | Carpet/CarpetReduce/src/reduce.cc | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/Carpet/CarpetReduce/src/reduce.cc b/Carpet/CarpetReduce/src/reduce.cc index 0e95369af..0a0b18a5b 100644 --- a/Carpet/CarpetReduce/src/reduce.cc +++ b/Carpet/CarpetReduce/src/reduce.cc @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetReduce/src/reduce.cc,v 1.2 2002/01/01 16:48:32 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetReduce/src/reduce.cc,v 1.3 2002/01/02 17:14:08 schnetter Exp $ #include <assert.h> #include <limits.h> @@ -15,7 +15,7 @@ #include "reduce.hh" -static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetReduce/src/reduce.cc,v 1.2 2002/01/01 16:48:32 schnetter Exp $"; +static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetReduce/src/reduce.cc,v 1.3 2002/01/02 17:14:08 schnetter Exp $"; @@ -547,47 +547,45 @@ namespace CarpetReduce { Initialise (cgh, proc, num_outvals, myoutvals, outtype, mycounts, red); - BEGIN_COMPONENT_LOOP(cgh) { - if (hh->is_local(reflevel,component)) { - - int dims[dim], nghostzones[dim]; - ierr = CCTK_GrouplshVI(cgh, num_dims, dims, vi); - assert (!ierr); - ierr = CCTK_GroupnghostzonesVI(cgh, num_dims, nghostzones, vi); - assert (!ierr); - for (int d=0; d<num_dims; ++d) { - assert (dims[d]>=0); - assert (nghostzones[d]>=0 && 2*nghostzones[d]<=dims[d]); - } - - const void** const inarrays = new (const void*) [num_invars]; - for (int n=0; n<num_invars; ++n) { - inarrays[n] = CCTK_VarDataPtrI(cgh, 0, invars[n]); - assert (inarrays[n]); - } - - const int intype = CCTK_VarTypeI(vi); - for (int n=0; n<num_invars; ++n) { - assert (CCTK_VarTypeI(invars[n]) == intype); - } - - int mydims[dim], mynghostzones[dim]; - for (int d=0; d<num_dims; ++d) { - mydims[d] = dims[d]; - mynghostzones[d] = nghostzones[d]; - } - for (int d=num_dims; d<dim; ++d) { - mydims[d] = 1; - mynghostzones[d] = 0; - } - - Reduce (cgh, proc, mydims, mynghostzones, num_invars, inarrays, intype, - num_outvals, myoutvals, outtype, mycounts, red); - - delete [] inarrays; - + BEGIN_LOCAL_COMPONENT_LOOP(cgh) { + + int dims[dim], nghostzones[dim]; + ierr = CCTK_GrouplshVI(cgh, num_dims, dims, vi); + assert (!ierr); + ierr = CCTK_GroupnghostzonesVI(cgh, num_dims, nghostzones, vi); + assert (!ierr); + for (int d=0; d<num_dims; ++d) { + assert (dims[d]>=0); + assert (nghostzones[d]>=0 && 2*nghostzones[d]<=dims[d]); + } + + const void** const inarrays = new (const void*) [num_invars]; + for (int n=0; n<num_invars; ++n) { + inarrays[n] = CCTK_VarDataPtrI(cgh, 0, invars[n]); + assert (inarrays[n]); + } + + const int intype = CCTK_VarTypeI(vi); + for (int n=0; n<num_invars; ++n) { + assert (CCTK_VarTypeI(invars[n]) == intype); } - } END_COMPONENT_LOOP(cgh); + + int mydims[dim], mynghostzones[dim]; + for (int d=0; d<num_dims; ++d) { + mydims[d] = dims[d]; + mynghostzones[d] = nghostzones[d]; + } + for (int d=num_dims; d<dim; ++d) { + mydims[d] = 1; + mynghostzones[d] = 0; + } + + Reduce (cgh, proc, mydims, mynghostzones, num_invars, inarrays, intype, + num_outvals, myoutvals, outtype, mycounts, red); + + delete [] inarrays; + + } END_LOCAL_COMPONENT_LOOP(cgh); Finalise (cgh, proc, num_outvals, outvals, outtype, myoutvals, mycounts, red); |