PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
context.h
Go to the documentation of this file.
1 
14 #ifndef _PLASMA_CONTEXT_H_
15 #define _PLASMA_CONTEXT_H_
16 
17 #include <stdio.h>
18 #include "quark.h"
19 
21 
22 /***************************************************************************/
25 typedef struct plasma_context_struct {
26  /* Initialization flag */
28 
29  /* Thread control */
35 
36  /* Master-worker communication */
39  volatile PLASMA_enum action;
41  unsigned char args_buff[ARGS_BUFF_SIZE];
42 
43  /* Boolean flags */
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 #ifdef BUSY_WAITING
63  volatile int barrier_in[CONTEXT_THREADS_MAX];
64  volatile int barrier_out[CONTEXT_THREADS_MAX];
65 #else
66  int volatile barrier_id; /*+ ID of the barrier +*/
67  int volatile barrier_nblocked_thrds; /*+ Number of threads lock in the barrier +*/
68  pthread_mutex_t barrier_synclock; /*+ mutex for the barrier +*/
69  pthread_cond_t barrier_synccond; /*+ condition for the barrier +*/
70 #endif
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 */
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
88 
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92 
93 /***************************************************************************/
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);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif