Skip to Content.
Sympa Menu

charm - Re: [charm] [ppl] Using static data member with ParFUM

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] [ppl] Using static data member with ParFUM


Chronological Thread 
  • From: Aaron Becker <abecker3 AT illinois.edu>
  • To: Fernando Stump <fernando.stump AT gmail.com>
  • Cc: Charm Mailing List <charm AT cs.illinois.edu>, Soheil Soghrati <soheilsoghrati AT gmail.com>
  • Subject: Re: [charm] [ppl] Using static data member with ParFUM
  • Date: Fri, 9 Sep 2011 11:24:04 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

You're right, this is a potential source of errors--all drivers on a
processor will share any static members. One workaround to this issue
if you
need to keep the static members is to replace your static
property_set with a static map<int, property_set> which has an entry
for each chare on the processor. So, instead of accessing
set_.whatever(), you would instead access set_[CkMyPE()].whatever().
This has potentially bad cache behavior, but it does allow you to
retain the static variables and still get correct results.

Aaron

On Fri, Sep 9, 2011 at 10:50 AM, Fernando Stump
<fernando.stump AT gmail.com>
wrote:
> Hi,
>
> I'm using ParFUM to parallelize a C++ FEM code called yafeq. And I'm
> concerned about the use of static data member inside Yafeq. Since I'm not
> very familiar with static data member. Here it is link for what I mean by
> this
> http://msdn.microsoft.com/en-us/library/b1b5y48f.aspx
>
> So yafeq use static containers such as "set_"in this example. That belongs
> to a purely virtual class (Material_base)
>
> class Material_base {
> .
> .
> .
> typedef std::set<Material_property_type> property_set;
> .
> .
> .
>     static property_set set_;                //!< Keep track of properties
> used.
> .
> .
> .
> }
> This container (set_) is being populated in a function that runs in
> parallel i.e. a function that initialize set_ is called inside ParFUM
> driver() which of course can run in parallel in the same node.  Semantically
> I want that each driver have its own (set_).
> Reading on Charm++ and Converse manual, I believe that this is a potential
> source of errors, because the static data member may be shared among
> processes.
> So I would like to ask if this is indeed the case.
> If so, is there a way to solve this issue without removing the static data
> members from the code.
>
> Thanks
> Fernando
>
> _______________________________________________
> charm mailing list
> charm AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/charm
>
> _______________________________________________
> ppl mailing list
> ppl AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/ppl
>
>





Archive powered by MHonArc 2.6.16.

Top of Page