Charm++ Message-Passing Parallel Language and Runtime
repository·main·Indexed 42 days ago
https://github.com/charmplusplus/charmA message-passing parallel language and runtime system implemented as C++ libraries, designed for efficiency and portability across architectures from single-node multicore systems to large-scale distributed clusters. Includes tools like charmrun for execution and a flexible build system supporting various communication methods such as netlrts, MPI, and UCX.
What's inside Charm++
- Charisma is an orchestration language designed for migratable parallel objects. It provides a way to define and manage the behavior and orchestration of parallel objects within the Charm++ ecosystem.
Overview of AMPI Extensions
mainAMPI (Adaptive MPI) provides extensions to the standard MPI specification to support advanced features like migration, serialization, and load balancing. All AMPI extensions are prefixed with
AMPI_(e.g.,AMPI_Migrate,AMPI_Register_pup).Most extensions are available in C, C++, and Fortran. However, two specific functions are only available in Fortran:
AMPI_Command_argument_countAMPI_Get_command_argument
Key functional areas provided by these extensions include:
- Serialization: Packing and unpacking program state.
- Load Balancing and Migration: Moving tasks between processors.
- Checkpointing and Fault Tolerance.
Overview of Fortran90 Bindings for Charm++ (f90charm)
mainThe
f90charmmodule provides a Fortran90 interface to the Charm++ parallel object language. It allows developers to write Fortran90 programs that utilize parallel object arrays (Chare Arrays) and message passing, similar to the C++ Charm++ experience.To develop a program with
f90charm, you must follow these steps:- Write a Charm Interface file (
.ci) to declare Chare arrays and entry methods. - Write a Fortran90 program using
f90charmmain()as the entry point. - Implement Chare entry methods and allocation subroutines in Fortran90.
- Compile and link with the Charm Fortran library.
- Run the program.
- Write a Charm Interface file (
What is Adaptive MPI (AMPI)?
mainAdaptive MPI (AMPI) is an implementation of the MPI standard built on top of the Charm++ runtime system. It allows developers to run standard MPI code while leveraging Charm++'s advanced features such as:
- Process Virtualization: Mapping MPI ranks to Charm++ user-level threads (Virtual Processors or VPs) rather than OS processes.
- Over-decomposition: Using more virtual processors (VPs) than physical processors (PEs) to improve performance.
- Communication/Computation Overlap: Automatically overlapping communication with computation by scheduling other ready VPs when one is blocked on a message.
- Dynamic Load Balancing: Automatically migrating VPs between physical processors to balance computational load based on runtime measurements.
- Fault Tolerance: Leveraging the Charm++ runtime for resilience.
AMPI currently supports the MPI-2.2 standard, with preliminary support for MPI-3.1 features (including non-blocking and neighborhood collectives).
Overview of Charm++ Debugger features
mainThe Charm++ debugging system consists of a Java GUI client (running on a desktop) and a Charm++ server (running as part of your parallel program). They communicate over a network using a secure protocol.
Key capabilities include:
- State Inspection: View major programmer-visible entities like array elements and messages in queues across the parallel machine. Objects and messages are extracted as raw data and interpreted by the client.
- Breakpoints: Set and remove breakpoints on remote entry points to capture control flow.
- Processor Control: Freeze and unfreeze the execution of specific processors to create consistent snapshots for examination.
- Sequential Debugging: Attach a sequential debugger (like
gdb) to a specific subset of processes to manage the debugging scope.
What is POSE (Parallel Object-oriented Simulation Environment)?
mainPOSE is a tool for Parallel Discrete Event Simulation (PDES) built on top of Charm++. It leverages Charm++'s message-driven execution model but introduces discrete timestamps to control the execution of messages in simulated time.
Key concepts:
- Chares vs. Posers: While Charm++ uses chares (parallel objects), POSE refers to these entities as posers.
- Time Management: POSE manages Object Virtual Time (OVT) for individual posers and a Global Virtual Time (GVT) for the entire simulation.
- Synchronization Strategies: Users can choose synchronization strategies on a per-class basis. POSE is optimized for adaptive synchronization strategies (specifically
adapt4for stability oradeptfor development), which are optimistic and handle rollbacks, cancellations, and checkpointing automatically.
What is boost.context and when to use it
mainboost.context is a foundational library used to implement cooperative multitasking on a single thread. It provides an
execution_contextabstraction that captures the entire execution state, including:- The stack (containing local variables)
- The stack pointer
- All CPU registers and flags
- The instruction pointer
An
execution_contextrepresents a specific point in an application's execution path. It allows you to suspend execution from within nested functions and later resume from that exact point.Key Use Cases:
- Building coroutines.
- Implementing cooperative threads (userland threads).
- Implementing C++ equivalents to C#
yield.
Performance Advantage: Unlike OS thread context switches which require expensive system calls (often >1000 CPU cycles on x86),
boost.contexttransfers control within a single thread using fewer than 100 CPU cycles, as it avoids kernel involvement.Overview of CkIO for Parallel I/O
mainCkIO is a library designed for parallel I/O in Charm++. It provides high-performance reading and writing by using aggregation to minimize contention on I/O nodes and align with the stripe sizes of parallel file systems (like Lustre).
Key Concepts:
- Output Aggregation: Data is sent to PEs corresponding to the file's stripes and aggregated until a full stripe is ready, then written in a single operation.
- Input Aggregation: Uses intermediate chares called "Buffer Chares" to aggregate read requests. The user should tune the number of Buffer Chares to optimize granularity based on file size and PE count.
- Session-Oriented: CkIO uses a callback-centric, session-based workflow. You open a file, start a session (read or write), perform operations via callbacks, and then close the session/file.
What is liveViz and how does it work?
mainliveViz is a visualization library for Charm++ that acts as a reducer for 2D-image data. It follows a client-server model where image assembly is performed on the server side.
Individual chares compute small chunks (array elements) of a large 2D image. liveViz collects these chunks and combines them into a single large image. The final assembled image is then viewed using a Java-based liveViz client.
Overview of Projections Performance Analysis
mainProjections is a performance analysis and visualization framework for Charm++ applications. It consists of two main parts:
- Event Tracing Component: A low-perturbation framework that records performance data (e.g., entry method starts/ends, message sends, scheduler idle time). Most users do not need to manually instrument code as the runtime handles this automatically.
- Java-based Visualization Tool: A component used to visually study performance data and locate issues.
Workflow:
- Link your application with appropriate trace generation modules (tracemodes) and execute it.
- Use the Java-based tool to analyze the generated trace data.
What is the TRAM library?
mainThe Topological Routing and Aggregation Module (TRAM) is a library designed to optimize many-to-many and all-to-all collective communication patterns in Charm++ applications. It works by mapping communication onto a user-defined N-dimensional virtual grid topology of Processing Elements (PEs).
Key characteristics:
- Topological Routing: PEs communicate directly only with their 'peers' (neighbors in the grid). Non-peer communication is routed through intermediate destinations.
- Aggregation: TRAM reduces network overhead by buffering and aggregating multiple 'data items' of a single type into fewer, larger messages.
- Implementation: TRAM is implemented as a Charm++ group, meaning an instance of TRAM has one 'local instance' object on every PE used in the run.
What is Structured Dagger (SDAG)?
mainStructured Dagger (SDAG) is a notation used in Charm++
.ci(interface) files to provide structured control flow across a chare's entry methods.In the standard message-driven model, control flow is often fragmented across multiple methods, requiring manual management of flags, buffers, and counters to synchronize incoming messages. SDAG allows you to express these dependencies using structured constructs like
serial,when,for, andwhiledirectly within the.cifile. This enables "program-order execution," where the sequence of operations is clearly defined and the runtime handles the underlying buffering and triggering of messages.To use SDAG, your C++ class must:
- Inherit from the generated
CBase_<ChareName>class. - Include the generated-code macro
<ChareName>_SDAG_CODEwithin the class definition.
// C++ implementation requirement class ComputeObject : public CBase_ComputeObject { ComputeObject_SDAG_CODE // ... members ... };- Inherit from the generated