44
55< h1 > Execution Model</ h1 >
66
7-
7+ < p >
88A basic unit of parallel computation in Charm++ programs is a chare. A chare
99is similar to a process, an actor, an ADA task, etc. At its most basic level,
1010it is just a C++ object. A Charm++ computation consists of a large number of
@@ -14,7 +14,8 @@ <h1>Execution Model</h1>
1414So, these method invocations are sometimes referred to as messages. (besides,
1515in the implementation, the method invocations are packaged as messages
1616anyway). Chares can be created dynamically.
17-
17+ </ p >
18+ < p >
1819Conceptually, the system maintains a “work-pool” consisting of seeds for new
1920chares, and messages for existing chares. The Charm++ runtime system ( Charm
2021RTS) may pick multiple items, non-deterministically, from this pool and
@@ -33,46 +34,53 @@ <h1>Execution Model</h1>
3334a constructor invocation) for a new Chare, and invokes the method specified by
3435the message. When the method returns control back to the scheduler, it repeats
3536the cycle. I.e. there is no pre-emptive scheduling of other invocations.
36-
37+ </ p >
38+ < p >
3739When a chare method executes, it may create method invocations for other
3840chares. The Charm Runtime System (RTS, sometimes referred to as the Chare
3941Kernel in the manual) locates the PE where the targeted chare resides, and
4042delivers the invocation to the scheduler on that PE.
41-
43+ </ p >
44+ < p >
4245Methods of a chare that can be remotely invoked are called entry methods.
4346Entry methods may take serializable parameters, or a pointer to a message
4447object. Since chares can be created on remote processors, obviously some
4548constructor of a chare needs to be an entry method. Ordinary entry methods [1]
4649are completely non-preemptive- Charm++ will not interrupt an executing method
4750to start any other work, and all calls made are asynchronous.
48-
51+ </ p >
52+ < p >
4953Charm++ provides dynamic seed-based load balancing. Thus location (processor
5054number) need not be specified while creating a remote chare. The Charm RTS
5155will then place the remote chare on a suitable processor. Thus one can imagine
5256chare creation as generating only a seed for the new chare, which may take
5357root on some specific processor at a later time.
54-
58+ </ p >
59+ < p >
5560Chares can be grouped into collections. The types of collections of chares
5661supported in Charm++ are: chare-arrays, chare-groups, and chare-nodegroups,
5762referred to as arrays, groups, and nodegroups throughout this manual for
5863brevity. A Chare-array is a collection of an arbitrary number of migratable
5964chares, indexed by some index type, and mapped to processors according to a
6065user-defined map group. A group (nodegroup) is a collection of chares, with
6166exactly one member element on each PE (“node”).
62-
67+ </ p >
68+ < p >
6369Charm++ does not allow global variables, except readonly variables. A chare
6470can normally only access its own data directly. However, each chare is
6571accessible by a globally valid name. So, one can think of Charm++ as
6672supporting a global object space.
67-
73+ </ p >
74+ < p >
6875Every Charm++ program must have at least one mainchare. Each mainchare is
6976created by the system on processor 0 when the Charm++ program starts up.
7077Execution of a Charm++ program begins with the Charm Kernel constructing all
7178the designated mainchares. For a mainchare named X, execution starts at
7279constructor X() or X(CkArgMsg *) which are equivalent. Typically, the
7380mainchare constructor starts the computation by creating arrays, other chares,
7481and groups. It can also be used to initialize shared readonly objects.
75-
82+ </ p >
83+ < p >
7684Charm++ program execution is terminated by the CkExit call. Like the exit
7785system call, CkExit never returns, and it optionally accepts an integer value
7886to specify the exit code that is returned to the calling shell. If no exit
@@ -81,7 +89,8 @@ <h1>Execution Model</h1>
8189entry methods are called after a CkExit. CkExit need not be called on all
8290processors; it is enough to call it from just one processor at the end of the
8391computation.
84-
92+ </ p >
93+ < p >
8594As described so far, the execution of individual Chares is “reactive”: When
8695method A is invoked the chare executes this code, and so on. But very often,
8796chares have specific life-cycles, and the sequence of entry methods they
@@ -95,8 +104,10 @@ <h1>Execution Model</h1>
95104threaded methods run in light-weight user-level threads, and can block waiting
96105for data in a variety of ways. Again, only the particular thread of a
97106particular chare is blocked, while the PE continues executing other chares.
98-
107+ </ p >
108+ < p >
99109The normal entry methods, being asynchronous, are not allowed to return any
100110value, and are declared with a void return type. However, the sync methods are
101111an exception to this. They must be called from a threaded method, and so are
102112allowed to return (certain types of) values.
113+ </ p >
0 commit comments