2 CHARM++ Overview

We think that CHARM++ is easy to use if you are familiar with object-based programming. (But of course that is our opinion, if your opinion differs, you are encouraged to let us know the reasons, and features that you would like to see in CHARM++.) Object-based programming is built around the concept of ``encapsulation'' of data. As implemented in C++, data encapsulation is achieved by grouping together data and methods (also known as functions, subroutines, or procedures) inside of an object.

A class is a blueprint for an object. The encapsulated data is said to be ``private'' to the object, and only the methods of that class can manipulate that data. A method that has the same name as the class is a ``blessed'' method, called a ``Constructor'' for that class. A constructor method is typically responsible for initializing the encapsulated data of an object. Each method, including the constructor can optionally be supplied data in the form of parameters (or arguments). In C++, one can create objects with the new operator that returns a pointer to the object. This pointer can be used to refer to the object, and call methods on that object.

CHARM++ is built on top of C++, and also based on ``encapsulation''. Similar to C++, CHARM++ entities can contain private data, and public methods. The major difference is that these methods can be invoked from remote processors asynchronously. Asynchronous method invocation means that the caller does not wait for the method to be actually executed and does not wait for the method's return value. Therefore, CHARM++ methods (called entry methods) do not have a return value3. Since the actual CHARM++ object on which the method is being invoked may be on a remote processor4, the C++ way of referring to an object, via a pointer, is not valid in CHARM++. Instead, we refer to a remote chare via a ``proxy'', as explained below.



Subsections

November 23, 2009
Charm Homepage