charm.start(entry=None, classes=, modules=, interactive=False):
Start the runtime system. This is required in all processes, and registers chare types with the runtime.
entryis the user-defined “entry point” to start the application. The runtime transfers control to this entry point after it has initialized.
entrycan be a Python function or a chare type. If it is a chare type, the runtime will create an instance of this chare on one PE (typically PE 0), and transfer control to the chare’s constructor. The entry point function (or chare constructor) must have only one parameter, which is used to receive the application’s arguments.
True, an entry point is not needed and instead Charm4py will transfer control to a Read-Eval-Print Loop (REPL) loop on PE0.
charm.start(), Charm4py automatically registers any chare types that are defined in the
__main__module. If desired, a list of chare types can also be passed explictly using the
classesoptional parameter. These must be references to the classes that are to be registered, and can reference classes in other modules. The
modulesparameter can be used to automatically register any chare types defined in the specified list of modules. These are to be given by their names.
charm4pyis imported and the program exits without calling
charm.start(), a warning will be printed. This is to remind users in case they forget to start the runtime (otherwise the program might hang or exit without any output).
Exits the parallel program, shutting down all processes. Can be called from any chare or process after the runtime has started. The
exitCodewill be received by the OS on exit.
exit()function from a chare has the same effect (Charm4py intercepts the SystemExit exception and calls
Aborts the program, printing the specified
messageand a stack trace of the PE which aborted. It can be called from any chare or process after the runtime has started.
Returns the PE number on which the caller is currently running.
Some chares can migrate between PEs during execution. As such, the value returned by
myPe()can vary for these chares.
Returns the total number of PEs that the application is running on.
Makes the calling thread block until all of the chares in the collections referenced by the given proxies have been created on the system.
This can only be called from within the context of a threaded method, and the caller must have initiated the creation of the collections.
charm.getTopoTreeEdges(pe, root_pe, pes=None, bfactor=4):
Returns a tuple containing the parent PE and the list of children PEs of
pein a tree spanning the given
pes, or all PEs if
root_pemust be in the first position of
pemust be a member of
bfactoris the desired branching factor (number of children of each PE in the tree).
In most systems, the resulting tree should be such that a physical node or host will have only one incoming edge (from parent).
Print profiling metrics and statistics.
charm4py.Options.PROFILINGmust have been set to