Title: Charm overview
1Charm overview
2Parallel Programming tasks
- Decomposition (what to do in parallel)
- Mapping
- Scheduling (sequencing)
- Machine dependent expression
3Spectrum of parallel Languages
Leve l
MPI
Specialization
4Charm
- Data Driven Objects
- Asynchronous method invocation
- Object Arrays
- Object Groups
- global object with a representative on each PE
- Prioritized scheduling
5Data Driven Execution
Scheduler
Scheduler
Message Q
Message Q
6Chares (Data driven Objects)
- Regular C classes,
- with some methods designated as remotely
invokable (called entry methods) - entry methods have only one parameter of type
message - Creation
- CProxy_CckNew(msg)
- Creates an instance of C on some pe
- CProxy_CckNew(msg, pe)
7Messages
- A user-defined C class
- inherits from a system-defined class
- messages can be communicated to others as
parameters - Has regular data fields
- Declaration normal C,
- inherit from a system defined class
- Creation (just usual C)
- MsgType m new MsgType
8Remote method invocation
- Proxy Classes
- For each chare class, the system generates a
proxy class. (C CProxy_C) - Each chare has a global ID (ChareID)
- thishandle (analogous to this)
- You can send thishandle in messages
- Given a handle h, you can create a proxy
- CProxy_C p(h) // or q new CProxy_C(h)
- p.method(msg) // or q-gtmethod(msg)
9Object Groups
- A group of objects (chares)
- with exactly one representative on each processor
- A single Id for the group as a whole
- invoke methods in a branch (asynchronously), all
branches (broadcast), or in the local branch - creation
- groupId CProxy_CckNew(msg)
- remote invocation
- CProxy_C p(groupId)
- p.methodName(msg) // p.methodName(msg, peNum)
- p.LocalBranch-gtf(.)
10CkChareID mainhandle mainmain(CkArgMsg m)
int i, low 0 for (i0 ilt100 i)
new CProxy_piPart() responders 100 count
0 mainhandle thishandle // readonly
initialization void mainresults(DataMsg
msg) count msg-gtcount if (0
--responders) CkPrintf("pi f \n",
4.0count/100000) CkExit()
11piPartpiPart() // declarations..
srand48((long) this) mySamples 100000/100
for (i 0 ilt mySamples i) x
drand48() y drand48() if ((xx yy)
lt 1.0) localCount DataMsg result
new DataMsg result-gtcount localCount
CProxy_main mainproxy(mainhandle)
mainproxy.results(result) delete this