Lecture 15: Charm++ Abhinav Bhatele, Department of Computer Science - - PowerPoint PPT Presentation

lecture 15 charm
SMART_READER_LITE
LIVE PREVIEW

Lecture 15: Charm++ Abhinav Bhatele, Department of Computer Science - - PowerPoint PPT Presentation

Introduction to Parallel Computing (CMSC498X / CMSC818X) Lecture 15: Charm++ Abhinav Bhatele, Department of Computer Science Task-based programming models Describe program / computation in terms of tasks Tasks might be short-lived or


slide-1
SLIDE 1

Lecture 15: Charm++

Abhinav Bhatele, Department of Computer Science

Introduction to Parallel Computing (CMSC498X / CMSC818X)

slide-2
SLIDE 2

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Task-based programming models

  • Describe program / computation in terms of tasks
  • Tasks might be short-lived or persistent throughout program execution
  • Notable examples: Charm++, StarPU, HPX, Legion
  • Attempt at classification: https://link.springer.com/article/10.1007/s11227-018-2238-4

2

slide-3
SLIDE 3

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Charm++: Key principles

  • Programmer decomposes data and work into objects (called chares)
  • Decoupled from number of processes or cores
  • Runtime assigns objects to physical resources (cores and nodes)
  • Each object can only access its own data
  • Request data from other objects via remote method invocation: foo.get_data()
  • Asynchronous message-driven execution

3

slide-4
SLIDE 4

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Hello World in Charm++

4

Charm++ Tutorial: http://charmplusplus.org/tutorial/ArrayHelloWorld.html

mainmodule hello { array [1D] Hello { entry Hello(); entry void sayHi(); }; };

slide-5
SLIDE 5

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Hello World in Charm++

4

Charm++ Tutorial: http://charmplusplus.org/tutorial/ArrayHelloWorld.html

mainmodule hello { array [1D] Hello { entry Hello(); entry void sayHi(); }; }; void Hello ::sayHi() { CkPrintf("Hello from chare %d on processor %d.\n”, thisIndex, CkMyPe()); }

slide-6
SLIDE 6

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Hello World in Charm++

4

Charm++ Tutorial: http://charmplusplus.org/tutorial/ArrayHelloWorld.html

mainmodule hello { array [1D] Hello { entry Hello(); entry void sayHi(); }; }; void Hello ::sayHi() { CkPrintf("Hello from chare %d on processor %d.\n”, thisIndex, CkMyPe()); } Main::Main(CkArgMsg* msg) { numObjects = 5; // number of objects CProxy_Hello helloArray = CProxy_Hello::ckNew(numObjects); helloArray.sayHi(); }

slide-7
SLIDE 7

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Compiling a charm program

  • Charm translator for .ci file
  • Generates charm_hello.decl.h and charm_hello.def.h
  • C++ code:

5

charmc hello.ci charmc -c hello.C charmc -o hello hello.o

slide-8
SLIDE 8

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Chare arrays

  • User can create indexed collection of data-driven objects
  • Different kinds: 1D, 2D, 3D, …
  • Mapping of array elements (objects) to hardware resources handled by the runtime

system (RTS)

6

CProxy_Hello helloArray = CProxy_Hello::ckNew(numElements);

slide-9
SLIDE 9

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Object-based virtualization

7

  • User programs in terms of chares or objects

User View System View

slide-10
SLIDE 10

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Over-decomposition

  • Create lots of “small” objects per physical core
  • Objects grouped into arrays: 1D, 2D, …
  • System assigns objects to processors and can migrate objects between physical

resources

  • Facilitates automatic load balancing

8

slide-11
SLIDE 11

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Message-driven execution

  • An object is scheduled by the runtime scheduler only when a message for it is

received

  • Facilitates adaptive overlap of computation and communication

9

slide-12
SLIDE 12

Abhinav Bhatele (CMSC498X/CMSC818X) LIVE RECORDING

Cost of creating more objects?

  • Context switch overhead
  • Cache performance
  • Memory overhead
  • Fine-grained messages

10

slide-13
SLIDE 13

Abhinav Bhatele 5218 Brendan Iribe Center (IRB) / College Park, MD 20742 phone: 301.405.4507 / e-mail: bhatele@cs.umd.edu