The first example demonstrates an application solving a so-called irregular problem. An irregular problem is characterized by some inherent coarse-grained or large-grained structure implying quite deterministic decomposition of the whole program into a set of programs running in parallel and interacting via message passing. As rule, there are essential differences in volumes of computations and communications to perform by different programs. So, in mpC one can define a network object, to execute the set of programs, and specify performances of its virtual processors and lengths of its links in accordance with the different volumes of computations and communications, and mpC programming environment will map the virtual processors onto underlying hardware in such a way to ensure an efficient execution of the application.
The second example demonstrates an application solving a so-called regular problem. Unlike an irregular problem, for a regular problem a decomposition of the whole program into a large set of small equivalent programs, running in parallel and interacting via message passing, is the most natural one. The main idea of efficient solving a regular problem is to reduce it to an irregular problem the structure of which is determined by the topology of underlying hardware rather than the topology of the problem. So, the whole program is decomposed into a set of programs each made of a number of the small equivalent programs stuck together and running on a separate processor of the underlying hardware. To do it in mpC, one can detect with a special library function the topology of the underlying hardware, define a network object having the same topology and distribute computations and communications in accordance with the topology to ensure efficient execution of the program.
Matrix multiplication.This is an example of regular application. Download the mpC source file.