The Multiphase Shared Arrays (MSA) library provides a specialized shared memory abstraction in Charm++ that provides automatic memory management. Explicitly shared memory provides the convenience of shared memory programming while exposing the performance issues to programmers and the ``intelligent'' ARTS.
Each MSA is accessed in one specific mode
during each phase of execution:
mode, in which any thread can read
any element of the array;
which each element of the array is written to (possibly multiple
times) by at most one worker thread, and no reads are allowed
mode, in which any threads can add values to any array
element, and no reads or writes are permitted.
call is used to denote the end of a phase.
We permit multiple copies of a page of data on different
processors and provide automatic fetching and caching of remote data.
For example, initially an array might be put in
mode while it is populated with data from a file.
This determines the cache
behavior and the
permitted operations on the array during this phase.
means every thread can write to a different element of the array.
The user is responsible for ensuring that two threads do not write to
the same element; the system helps by detecting violations.
From the cache maintenance viewpoint, each
page of the data can be over-written on it's owning processor without
worrying about transferring ownership or maintaining coherence.
, the data is simply merged.
Subsequently, the array may be
for a while, thereafter data
'd into it, followed by it returning to
phase, each local copy of the page on each processor could
have its accumulations tracked independently without maintaining page
coherence, and the results combined at the end of the phase.
operations also include set-theoretic union
operations, i.e. appending items to a set of objects would also be a
User-level or compiler-inserted explicit
calls can be used to
A software engineering benefit that accrues from the explicitly shared memory programming paradigm is the (relative) ease and simplicity of programming. No complex, buggy data-distribution and messaging calculations are required to access data.
To use MSA in a Charm++ program:
build Charm++ for your architecture, e.g.
cd charm/netlrts-linux/tmp/libs/ck-libs/multiphaseSharedArrays/; make
#include ``msa/msa.h''in your header file.
charmcwith the option ``
The API is as follows: See the example programs in