Salome HOME
Playground documentation
[modules/yacs.git] / doc / resource.rst
1 .. _resource:
2
3 **************************************************
4 Concurrent branches and multiple machine execution
5 **************************************************
6
7 .. _concurrent:
8
9 Execution of concurrent branches
10 ================================
11 YACS can execute calculation nodes of a scheme simultaneously.  
12 However, simultaneous execution of a large number of nodes can saturate the system.  
13 The maximum number of simultaneous executions can be controlled by fixing the maximum number of threads used with the 
14 YACS_MAX_THREADS environment variable. By default, this value is equal to 50.
15
16 Each of these threads needs some memory (stack) for its execution. If too much stack is allocated for each thread,
17 the system can run out of memory. If too little stack is allocated, you can experience some random crashes as the
18 thread writes to memory outside its allocated stack. The stack size for YACS threads can be controlled with the
19 YACS_THREADS_STACK_SIZE environment variable. It defines the size of the stack for each thread in bytes. The
20 default value is 1048576 (1MB).
21
22
23 .. _multi:
24
25 Execution on multiple machines
26 ==============================
27 YACS can execute the nodes of a scheme on several machines where SALOME is
28 already installed.
29 Each machine is a resource which has to be declared in the resources catalog
30 (see :ref:`catalogResources`).
31
32 Every node is executed by a container.
33 Containers use a set of constraints and rules for choosing the resource where
34 the node will be executed (see :ref:`containers`).
35
36
37 Execution on multiple machines with mutliples HP container types
38 ================================================================
39
40 For a complex graph using multiples HP containers it can be really difficult to determine the best values 
41 of pool sizes for each HP container type and the numbers of branchs of the ForEach loops. In order to let Yacs resolves 
42 this problem by itself, one can use the Playground feature: ::
43
44    pilot.PlayGround()
45    machineCatalog=[('is2541',8),] # [('machine name', 'nb cores on machine'), ...]
46    pg.setData(machineCatalog)
47    p.fitToPlayGround(pg)
48
49 Principle:
50 The graph is analyzed and recursively, for all fork, the current domain is equitably divided into sub-domains 
51 (one for each sub-branch). A domain of a branch corresponds to the cores from the machine catalog which will be used 
52 for the execution of the nodes of this branch. This division in sub-domains assures that one core will be used by at 
53 most one container at once, even if it can be used by different HP containers type during the whole execution of a graph.
54
55 Once all the domains have been set, the numbers of branchs of the ForEach loops are calculated in order to use the whole domain associated in runtime.
56 Note: If a branch does not contain any ForEach loop, the size of its domain is reduced to the minimal size.