[pooma-dev] RFA: Patch: Miscellaneous Array, Engine, and Field Changes
Dave Nystrom
wdn at lanl.gov
Fri May 11 17:23:46 UTC 2001
Hi Jeffrey,
Do your changes fix the problems I was reporting with instantiation and also
compiling for parallel with Cheetah?
Thanks,
Dave
Jeffrey Oldham writes:
> OK to commit this patch?
>
> Attached is a patch of miscellaneous changes found when trying to
> explicitly instantiate various Arrays and Fields. I removed
> Array::innerDomain() because it invoked engines' innerDomain(), which
> did not seem to be defined. I used analogies to add domain() and
> makeOwnCopy().
>
> 2001-05-10 Jeffrey D. Oldham <oldham at codesourcery.com>
>
> * Array/Array.h: Add View0 to comment listing implemented classes.
> (Array::innerDomain): Remove the function since engines do not
> implement it.
> * Engine/CompressibleBlock.h
> (CompressibleBlockController::CompressibleBlockController):
> Reorder member initialization order.
> * Engine/CompressibleBrick.cpp
> (Engine<Dim,T,CompressibleBrickView>::makeOwnCopy()): New
> function.
> * Engine/CompressibleBrick.h (Engine<Dim, T,
> CompressibleBrick>::domain()): Likewise.
> (Engine<Dim,T,CompressibleBrickView>::domain()): Likewise.
> (Engine<Dim,T,CompressibleBrickView>::makeOwnCopy()): New
> declaration.
> (ElementProperties<Engine<Dim, T, CompressibleBrickView> >): New
> definition.
> * Layout/Node.h (Node::Node): Reorder member initialization order.
> * NewField/FieldEngine/FieldEngine.NoGeometry.h
> (FieldEngine<NoGeometry<Dim>, T, EngineTag>::physicalCellDomain):
> s/shrink/shrinkRight/
> (FieldEngine<NoGeometry<Dim>, T, EngineTag>::totalCellDomain):
> Likewise.
>
> Tested on sequential Linux using g++ 3.0 by building library
> Approved by ???you???
>
> Thanks,
> Jeffrey D. Oldham
> oldham at codesourcery.comIndex: Array/Array.h
> ===================================================================
> RCS file: /home/pooma/Repository/r2/src/Array/Array.h,v
> retrieving revision 1.139
> diff -c -p -r1.139 Array.h
> *** Array/Array.h 2001/04/20 21:16:23 1.139
> --- Array/Array.h 2001/05/11 02:37:11
> ***************
> *** 29,34 ****
> --- 29,35 ----
> //-----------------------------------------------------------------------------
> // Classes:
> // Array
> + // View0
> // View[1-7]<Array,various domains>
> // LeafFunctor<Array, DomainFunctorTag>
> // LeafFunctor<Array, ViewFunctorTag<Domain> >
> *************** public:
> *** 1763,1773 ****
> inline Domain_t domain() const
> {
> return engine_m.domain();
> - }
> -
> - inline Domain_t innerDomain() const
> - {
> - return engine_m.innerDomain();
> }
>
> inline Domain_t physicalDomain() const
> --- 1764,1769 ----
> Index: Engine/CompressibleBlock.h
> ===================================================================
> RCS file: /home/pooma/Repository/r2/src/Engine/CompressibleBlock.h,v
> retrieving revision 1.27
> diff -c -p -r1.27 CompressibleBlock.h
> *** Engine/CompressibleBlock.h 2000/07/11 22:13:00 1.27
> --- Engine/CompressibleBlock.h 2001/05/11 02:37:13
> *************** private:
> *** 531,541 ****
>
> CompressibleBlockController(const CompressibleBlockController& model)
> : Observable<T*>(ptr_m),
> - size_m(model.size_m),
> compressible_m(!Pooma::neverCompress()),
> dataObject_m(model.dataObject_m.affinity()),
> ! ucOffset_m(model.ucOffset_m),
> ! viewcount_m(0)
> {
> // Lock the model while we get information pertaining to it
> // being compressed or not (such data can't be initialized in
> --- 531,541 ----
>
> CompressibleBlockController(const CompressibleBlockController& model)
> : Observable<T*>(ptr_m),
> compressible_m(!Pooma::neverCompress()),
> + viewcount_m(0),
> dataObject_m(model.dataObject_m.affinity()),
> ! size_m(model.size_m),
> ! ucOffset_m(model.ucOffset_m)
> {
> // Lock the model while we get information pertaining to it
> // being compressed or not (such data can't be initialized in
> Index: Engine/CompressibleBrick.cpp
> ===================================================================
> RCS file: /home/pooma/Repository/r2/src/Engine/CompressibleBrick.cpp,v
> retrieving revision 1.24
> diff -c -p -r1.24 CompressibleBrick.cpp
> *** Engine/CompressibleBrick.cpp 2000/07/11 23:06:40 1.24
> --- Engine/CompressibleBrick.cpp 2001/05/11 02:37:13
> *************** Engine(const Engine<Dim,T,CompressibleBr
> *** 501,506 ****
> --- 501,542 ----
>
> //-----------------------------------------------------------------------------
> //
> + // Engine<Dim,T,CompressibleBrickView> & makeOwnCopy()
> + //
> + // Causes the CompressibleBrickView-Engine to obtain a private copy of the data
> + // that it refers to.
> + //
> + //-----------------------------------------------------------------------------
> +
> + template <int Dim, class T>
> + Engine<Dim,T,CompressibleBrickView> &Engine<Dim,T,CompressibleBrickView>::makeOwnCopy()
> + {
> + // JIM: This is probably not thread safe???
> + // There is a race from checking isShared to getting into cblock's
> + // makeOwnCopy, which is thread safe. As a result, this should only
> + // be called after a blockAndEvaluate() to ensure that nobody else
> + // is messing with the underlying CBC while this is
> + // occuring. (Logically, this is necessary anyway since you probably
> + // want a copy of the data that results from all previous
> + // computations having taken place.) Also, as mentioned elsewhere,
> + // the current implementation results in copying uncompressed data
> + // in the parse thread, which will result in incorrect memory
> + // affinity.
> +
> + if (cblock_m.isControllerValidUnlocked() && cblock_m.isShared())
> + {
> + cblock_m.detach(this);
> + cblock_m.makeOwnCopy();
> + cblock_m.attach(this);
> +
> + data0_m = cblock_m.data() + (cblock_m.compressed() ? 0 : baseOffset());
> + }
> +
> + return *this;
> + }
> +
> + //-----------------------------------------------------------------------------
> + //
> // Engine<Dim, T, CompressibleBrickView>::
> // elementsCompressed() const
> //
> Index: Engine/CompressibleBrick.h
> ===================================================================
> RCS file: /home/pooma/Repository/r2/src/Engine/CompressibleBrick.h,v
> retrieving revision 1.67
> diff -c -p -r1.67 CompressibleBrick.h
> *** Engine/CompressibleBrick.h 2000/07/11 23:06:40 1.67
> --- Engine/CompressibleBrick.h 2001/05/11 02:37:14
> *************** public:
> *** 237,242 ****
> --- 237,250 ----
>
> inline Layout_t layout() const { return Layout_t(domain_m); }
>
> + //---------------------------------------------------------------------------
> + // Return the domain and base domain.
> +
> + inline const Domain_t &domain() const
> + {
> + return layout().domain();
> + }
> +
> // Get a private copy of data viewed by this Engine.
>
> Engine_t &makeOwnCopy();
> *************** public:
> *** 557,562 ****
> --- 565,582 ----
> ElementRef_t operator()(const Loc<Dim> &) const;
> Element_t read(const Loc<Dim> &) const;
>
> + //---------------------------------------------------------------------------
> + // Return the domain and base domain.
> +
> + inline const Domain_t &domain() const
> + {
> + return Layout_t(domain_m).domain();
> + }
> +
> + // Get a private copy of data viewed by this Engine.
> +
> + Engine_t &makeOwnCopy();
> +
> // Return the block controller (uncompressed).
> // See comments in CompressibleBrick above.
>
> *************** struct NewEngine<Engine<Dim,T,Compressib
> *** 801,806 ****
> --- 821,831 ----
> template <int Dim, class T>
> struct ElementProperties<Engine<Dim, T, CompressibleBrick> >
> : public MakeOwnCopyProperties<Engine<Dim, T, CompressibleBrick> >
> + { };
> +
> + template <int Dim, class T>
> + struct ElementProperties<Engine<Dim, T, CompressibleBrickView> >
> + : public MakeOwnCopyProperties<Engine<Dim, T, CompressibleBrickView> >
> { };
>
>
> Index: Layout/Node.h
> ===================================================================
> RCS file: /home/pooma/Repository/r2/src/Layout/Node.h,v
> retrieving revision 1.35
> diff -c -p -r1.35 Node.h
> *** Layout/Node.h 2001/05/04 15:41:28 1.35
> --- Layout/Node.h 2001/05/11 02:37:15
> *************** public:
> *** 121,128 ****
> Node(const Domain_t &owned, const AllocatedDomain_t &allocated,
> Context_t c, ID_t gid, ID_t lid = (-1))
> : domain_m(owned), allocated_m(allocated),
> ! context_m(c), global_m(gid), local_m(lid),
> ! affinity_m(-1)
> {
> PAssert(owned.size() >= 0);
> PAssert(allocated.size() >= 0);
> --- 121,128 ----
> Node(const Domain_t &owned, const AllocatedDomain_t &allocated,
> Context_t c, ID_t gid, ID_t lid = (-1))
> : domain_m(owned), allocated_m(allocated),
> ! local_m(lid), global_m(gid),
> ! context_m(c), affinity_m(-1)
> {
> PAssert(owned.size() >= 0);
> PAssert(allocated.size() >= 0);
> *************** public:
> *** 130,137 ****
> }
>
> Node(const Domain_t &d, Context_t c, ID_t gid, ID_t lid = (-1))
> ! : domain_m(d), allocated_m(d), context_m(c), global_m(gid), local_m(lid),
> ! affinity_m(-1)
> {
> PAssert(d.size() >= 0);
> PAssert(gid >= 0);
> --- 130,138 ----
> }
>
> Node(const Domain_t &d, Context_t c, ID_t gid, ID_t lid = (-1))
> ! : domain_m(d), allocated_m(d),
> ! local_m(lid), global_m(gid),
> ! context_m(c), affinity_m(-1)
> {
> PAssert(d.size() >= 0);
> PAssert(gid >= 0);
> *************** public:
> *** 152,159 ****
>
> Node(int affinity, const Domain_t &d,
> Context_t c, ID_t gid, ID_t lid = (-1))
> ! : domain_m(d), allocated_m(d), context_m(c), global_m(gid), local_m(lid),
> ! affinity_m(affinity)
> {
> PAssert(d.size() >= 0);
> PAssert(gid >= 0);
> --- 153,161 ----
>
> Node(int affinity, const Domain_t &d,
> Context_t c, ID_t gid, ID_t lid = (-1))
> ! : domain_m(d), allocated_m(d),
> ! local_m(lid), global_m(gid),
> ! context_m(c), affinity_m(affinity)
> {
> PAssert(d.size() >= 0);
> PAssert(gid >= 0);
> *************** public:
> *** 172,180 ****
>
> template<class ODom, class OAlloc>
> Node(const Node<ODom,OAlloc> &n)
> ! : domain_m(n.domain()), context_m(n.context()), allocated_m(n.allocated()),
> ! global_m(n.globalID()), local_m(n.localID()),
> ! affinity_m(n.affinity())
> {
> }
>
> --- 174,182 ----
>
> template<class ODom, class OAlloc>
> Node(const Node<ODom,OAlloc> &n)
> ! : domain_m(n.domain()), allocated_m(n.allocated()),
> ! local_m(n.localID()), global_m(n.globalID()),
> ! context_m(n.context()), affinity_m(n.affinity())
> {
> }
>
> Index: NewField/FieldEngine/FieldEngine.NoGeometry.h
> ===================================================================
> RCS file: /home/pooma/Repository/r2/src/NewField/FieldEngine/FieldEngine.NoGeometry.h,v
> retrieving revision 1.4
> diff -c -p -r1.4 FieldEngine.NoGeometry.h
> *** NewField/FieldEngine/FieldEngine.NoGeometry.h 2001/04/10 23:13:25 1.4
> --- NewField/FieldEngine/FieldEngine.NoGeometry.h 2001/05/11 02:37:15
> *************** public:
> *** 254,267 ****
> // This field-engine always has vert-centering and the total domain is
> // given by the engine.
>
> ! inline const Domain_t &physicalCellDomain() const
> {
> ! return shrink(physicalDomain(), 1);
> }
>
> inline Domain_t totalCellDomain() const
> {
> ! return shrink(engine_m.domain(), 1);
> }
>
> Domain_t physicalDomain() const
> --- 254,267 ----
> // This field-engine always has vert-centering and the total domain is
> // given by the engine.
>
> ! inline const Domain_t physicalCellDomain() const
> {
> ! return shrinkRight(physicalDomain(), 1);
> }
>
> inline Domain_t totalCellDomain() const
> {
> ! return shrinkRight(engine_m.domain(), 1);
> }
>
> Domain_t physicalDomain() const
More information about the pooma-dev
mailing list