PLASMA: /home/mathieu/svn/plasma/trunk/tools/plasma_2.5.0/control/context.h Source File

PLASMA 2.4.6

- Main Page
- Modules
- Data Types List

All Data Structures Functions Groups
context.h
1
14 #ifndef _PLASMA_CONTEXT_H_
15 #define _PLASMA_CONTEXT_H_
16
17 #include <stdio.h>
18 #include "quark.h"
19
20 struct plasma_context_struct;
21
22 /***************************************************************************/
25 typedef struct plasma_context_struct {
26 /* Initialization flag */
27 PLASMA_bool initialized;
28
29 /* Thread control */
30 int world_size, group_size;
31 int thread_bind[CONTEXT_THREADS_MAX];
32 int thread_rank[CONTEXT_THREADS_MAX];
33 pthread_attr_t thread_attr;
34 pthread_t thread_id[CONTEXT_THREADS_MAX];
35
36 /* Master-worker communication */
37 pthread_mutex_t action_mutex;
38 pthread_cond_t action_condt;
39 volatile PLASMA_enum action;
40 void (*parallel_func_ptr)(struct plasma_context_struct*);
41 unsigned char args_buff[ARGS_BUFF_SIZE];
42
43 /* Boolean flags */
44 PLASMA_bool errors_enabled;
45 PLASMA_bool warnings_enabled;
46 PLASMA_bool autotuning_enabled;
47 PLASMA_bool dynamic_section;
48
49 /* Enum flags */
50 PLASMA_enum scheduling; // static or dynamic scheduling
51 PLASMA_enum householder; // "domino" (flat) or tree-based (reduction) Householder
52 PLASMA_enum translation; // In place or Out of place layout conversion
53
54 /* Matrix tile attributes */
55 int nb;
56 int ib;
57 int nbnbsize; // tile size in elements (possibly padded)
58 int ibnbsize; // T or L tile size in elements (---''---)
59 int rhblock; // block size for tree-based (reduction) Householder
60
61 /* Barrier implementation */
62 /* Busy waiting version */
63 volatile int barrier_in[CONTEXT_THREADS_MAX];
64 volatile int barrier_out[CONTEXT_THREADS_MAX];
65
66 /* Conditional version */
67 int volatile barrier_id; /*+ ID of the barrier +*/
68 int volatile barrier_nblocked_thrds; /*+ Number of threads lock in the barrier +*/
69 pthread_mutex_t barrier_synclock; /*+ mutex for the barrier +*/
70 pthread_cond_t barrier_synccond; /*+ condition for the barrier +*/
71
72 /* Static scheduler implementation */
73 int ss_ld; // static scheduler progress table leading dimension
74 volatile int ss_abort; // static scheduler abort flag
75 volatile int *ss_progress; // static scheduler progress table
76
77 /* Dynamic scheduler */
78 Quark *quark;
79 } plasma_context_t;
80
81 /***************************************************************************/
84 typedef struct plasma_context_map_struct {
85 pthread_t thread_id; // thread id
86 plasma_context_t *context; // pointer to associated context
87 } plasma_context_map_t;
88
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92
93 /***************************************************************************/
96 plasma_context_t *plasma_context_create();
97 int plasma_context_insert(plasma_context_t *context, pthread_t thread_id);
98 int plasma_context_remove(plasma_context_t *context, pthread_t thread_id);
99 plasma_context_t *plasma_context_self();
100
101 #ifdef __cplusplus
102 }
103 #endif
104
105 #endif