Presentation is loading. Please wait.

Presentation is loading. Please wait.

Charm++ overview L. V. Kale. Parallel Programming Decomposition – what to do in parallel –Tasks (loop iterations, functions,.. ) that can be done in parallel.

Similar presentations


Presentation on theme: "Charm++ overview L. V. Kale. Parallel Programming Decomposition – what to do in parallel –Tasks (loop iterations, functions,.. ) that can be done in parallel."— Presentation transcript:

1 Charm++ overview L. V. Kale

2 Parallel Programming Decomposition – what to do in parallel –Tasks (loop iterations, functions,.. ) that can be done in parallel Mapping: –Which processor does each task Scheduling (sequencing) –On each processor Machine dependent expression –Express the above decisions for the particular parallel machine

3 Spectrum of parallel Languages Specialization LevelLevel MPI Parallelizing fortran compiler Machine dependent expression Scheduling (sequencing) Mapping Decomposition What is automated Charm++

4 Data Driven Objects Asynchronous method invocation Prioritized scheduling Object Arrays Object Groups: –global object with a “representative” on each PE Information sharing abstractions –readonly data –accumulators –distributed tables

5 Data Driven Execution Scheduler Message Q Objects

6 CkChareID mainhandle; main::main(CkArgMsg * m) { int i, low = 0; for (i=0; i<100; i++) new CProxy_piPart(); responders = 100; count = 0; mainhandle = thishandle; // readonly initialization } void main::results(DataMsg *msg) { count += msg->count; if (0 == --responders) { CkPrintf("pi=: %f \n", 4.0*count/100000); CkExit(); } } argc/argv Execution begins here Exit scheduler after method returns

7 piPart::piPart() { // declarations.. CProxy_main mainproxy(mainhandle); srand48((long) this); mySamples = 100000/100; for (i= 0; i<= mySamples; i++) { x = drand48(); y = drand48(); if ((x*x + y*y) <= 1.0) localCount++; } DataMsg *result = new DataMsg; result->count = localCount; mainproxy.results(result); delete this; }

8 Chares (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: of an instance of chare class C –new CProxy_C(msg); –Creates an instance of C on a specified processor “pe” new CProxy_C (msg, pe); –Cproxy_C: a proxy class generated by Charm for chare class C declared by the user

9 Messages 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;

10 Remote method invocation Proxy Classes: –For each chare class C, the system generates a proxy class. (C : CProxy_C) Each chare has a global ID (ChareID) –Global: in the sense of being valid on all processors –thishandle (analogous to this) gets you the ChareID –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->method(msg);

11 Object Arrays A collection of chares, –with a single global name for the collection, and –each member addressed by an index –Mapping of element objects to processors handled by the system A[0]A[1]A[2]A[3]A[..] A[3] A[0] User’s view System view

12 Object 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 = new Cproxy_C(msg) –remote invocation: CProxy_C p(groupId); p.methodName(msg); // p.methodName(msg, peNum); p.LocalBranch->f(….);

13 Information sharing abstractions Observation: –Information is shared in several specific modes in parallel programs Other models support only a limited sets of modes: –Shared memory: everything is shared: sledgehammer approach –Message passing: messages are the only method Charm++: identifies and supports several modes –Readonly / writeonce –Tables (hash tables) –accumulators –Monotonic variables

14 Compiling Charm++ programs Need to define an interface specification file –mod.ci for each module mod –Contains declarations that the system uses to produce proxy classes –These produced classes must be included in your mod.C file –See examples provided on the class web site. More information: –Manuals, example programs, papers http://charm.cs.uiuc.edu These slides are currently at: –http://charm.cs.uiuc.edu/kale/cse320

15 Fortran 90 version Quick implementation on top of Charm++ How to use: –follow example program, with the same basic concepts –Only use object arrays, for now Most useful construct Object groups can be implemented in C++, if needed

16 Further Reading More information: –Manuals, example programs, papers http://charm.cs.uiuc.edu These slides are currently at: –http://charm.cs.uiuc.edu/kale/cse320


Download ppt "Charm++ overview L. V. Kale. Parallel Programming Decomposition – what to do in parallel –Tasks (loop iterations, functions,.. ) that can be done in parallel."

Similar presentations


Ads by Google