CnC
 All Classes Namespaces Functions Variables Typedefs Enumerator Friends
Public Member Functions
dist_cnc_init< C1, C2, C3, C4, C5 > Struct Template Reference

List of all members.

Public Member Functions

 dist_cnc_init (bool dist_env, int flag=0)
 dist_cnc_init (int flag, bool dist_env=false)

Detailed Description

template<class C1, class C2 = Internal::void_context, class C3 = Internal::void_context, class C4 = Internal::void_context, class C5 = Internal::void_context>
struct CnC::dist_cnc_init< C1, C2, C3, C4, C5 >

To enable remote CnC you must create one such object. The lifetime of the object defines the "scope" of distribution. Contexts created in the "scope" of the dist_cnc_init objects (e.g. when it exists) will get distributed to participating processes (see Running distCnC).

Usually, a single dist_cnc_init object is created for the entire lifetime of a program. e.g. the dist_cnc_init object is created right when entering main and (auto-)destructed when main terminates. In this default mode all processes other than the root/host process exit the program when the dist_cnc_init objects gets dextructed.

Actually, the current implementation allows only a single dist_cnc_init object at a time for every process. Hence, all contexts on a given process are distributed in the same way. However, an optional parameter/flag allows allows defining the processes that actually "share" the dist_cnc_init object (and so their contexts). An optional flag/parameter is interpreted as a MPI_Comm to be used by the dist_cnc_init scope. This allows different groups of processes (defined by the MPI_Comm's) to work on different CnC contexts/graphs concurrently. If no MPI_Comm was specified (e.g. the default) client processes exit the program when the host dist_cnc_init object is destructed. If a MPI_Comm is provided they also wait until the host process destructs its dist_cnc_init object but simply returns from the constructor rather than exiting the program. Apparently all this only works when using the MPI communication infrastructure.

Additionally, two modes of operation are supported: 1. By default, constructing a dist_cnc_init objects blocks all processes except the root process in the constructor. Hence, code after the object instantiation will be executed only on the host process. 2. If dist_env is set to true, the constructor returns on all processes and execution continues in a SPMD style, e.g. all processes continue program execution. The SPMD style mode allows alternating between MPI phases and CnC phases. This mode is currently supported only using MPI communication. You have to ensure that all processes fully completed their local context creation before putting any data into a context's collection. Similarly, you have to synchronize context-destruction. It is recommended to put a MPI_Barrier right after instantiating a context and just before it gets destructed (e.g. at the end of its scope).

Note:
It is possible to combine SPMD mode and providing a MPI_Comm. You can even change the grouping in phases by using different MPI_Comm's at different times of the execution. E.g. the lifetime of a dist_cnc_object might be a (collective) function call. Make sure each process has only single dist_cnc_object alive at each point in time.
All context classes ever used in the program must be referenced as template arguments if they should be distributed.
All distributed contexts must have all collections they use as members and must be default-constructible.
Pointers as tags are not supported by distCnC.

Execution and other internal details described in CnC::Internal::dist_init

Definition at line 554 of file dist_cnc.h.


Constructor & Destructor Documentation

dist_cnc_init ( bool  dist_env,
int  flag = 0 
) [inline]
Parameters:
dist_envenable SPMD-style access to contexts
flagMPI_Comm to be used (MPI only)

Definition at line 559 of file dist_cnc.h.

: Internal::dist_init< C1, C2, C3, C4, C5 >( flag, dist_env ) {}
dist_cnc_init ( int  flag,
bool  dist_env = false 
) [inline]
Parameters:
dist_envenable SPMD-style access to contexts
flagMPI_Comm to be used (MPI only)

Definition at line 562 of file dist_cnc.h.

: Internal::dist_init< C1, C2, C3, C4, C5 >( flag, dist_env ) {}

The documentation for this struct was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerator Friends