Skip to Content.
Sympa Menu

charm - Re: [charm] Global variables in Charm++

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] Global variables in Charm++


Chronological Thread 
  • From: Phil Miller <mille121 AT illinois.edu>
  • To: "Kale, Laxmikant V" <kale AT illinois.edu>
  • Cc: Nikhil Jain <nikhil.life AT gmail.com>, "Kunzman, David M" <david.m.kunzman AT intel.com>, "Van Der Wijngaart, Rob F" <rob.f.van.der.wijngaart AT intel.com>, Charm Mailing List <charm AT cs.illinois.edu>, "Hammond, Jeff R" <jeff.r.hammond AT intel.com>, "Mattson, Timothy G" <timothy.g.mattson AT intel.com>
  • Subject: Re: [charm] Global variables in Charm++
  • Date: Mon, 29 Sep 2014 17:06:23 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm/>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>



From: "<Van Der Wijngaart>", Rob F <rob.f.van.der.wijngaart AT intel.com>

Actually, as I wrote last week, I wanted to be able to define something a little more complex, which turned out to be totally unpalatable by charmc:

readonly double weight[2*RADIUS+1][2*RADIUS+1]; 

Why would that be a reasonable thing to do for a readonly variable, one may ask? The reason is that this is an array that specifies the weights of a stencil. In my workload I allow different stencil sizes and different weights. But once defined, weight is a global constant. I let the user specify the constant symbol RADIUS, and use that to compute weight’s dimensions. In the .C file I can do that to my heart’s content, but not in the .ci file. To me that is not reasonable.



I realize after some further thought that things like this may have come up before, with a much more 'pleasant' looking workaround, as follows:
======
// In WEIGH_DIM.h:

#define WEIGHT_DIM ((2*RADIUS+1)*(2*RADIUS+1))
======
// In foo.ci:
include "WEIGHT_DIM.h";
readonly double WEIGHT[WEIGHT_DIM];
======

I just tested that this compiles and links, and it should work fine, since Charm++ will see a simple 1D array.



Archive powered by MHonArc 2.6.16.

Top of Page