src/LoadBalance/UnsMeshMap.cpp file

Advanced Charm++ array creation with a map using an unstructured grid.

Advanced Charm++ array creation refers to various ways arrays can be created with the Charm++ runtime system. See, Sec. Advanced Array Creation. This class does a distribution that is based on which portion of a distributed sparse matrix resulting from discretization on an unstructured grid residing on a PE should hold a given chare array element. (The one that owns most on-PE rows to minimize off-PE communication.)

Note that to help with performance, it is not advised to do heavy computations in the overridden member functions, procNum() and populateInitial(), since they can be potentially called many times. See also this note on the inner workings of the Charm++ runtime system regarding map objects and array element creation from long-time Charm++ developer, Eric Bohm, also at:

Procnum will be called to construct your chare, the first time a message is sent to it from a node, and each time subsequent sends do not find a precached location record for it. The latter event can occur when many sends have pushed it out of cache, or after migration.

The potential global memory footprint of location management caching is proportional to the total number of objects multiplied by the number of nodes. Therefore, the runtime system keeps a finite number on each node. At the limit, procnum could be called for nearly every message send, therefore procnum should be designed to be inexpensive.

The heavy portion of array element placement should therefore be done in the constructor.