PLASMA
2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
Main Page
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
global.h
Go to the documentation of this file.
1
16
/***************************************************************************/
20
#ifndef _PLASMA_GLOBAL_H_
21
#define _PLASMA_GLOBAL_H_
22
23
#include <
plasma.h
>
24
25
#include <string.h>
26
27
#if defined( _WIN32 ) || defined( _WIN64 )
28
#include "
plasmawinthread.h
"
29
#else
30
#include <pthread.h>
31
#endif
32
33
/***************************************************************************/
36
// maximum contexts
37
#define CONTEXTS_MAX 256
38
// maximum cores per context
39
#define CONTEXT_THREADS_MAX 256
40
// size of parallel functions arguments buffer
41
#define ARGS_BUFF_SIZE 512
42
// cache line size
43
#define CACHE_LINE_SIZE 128
44
// standard page size
45
#define STANDARD_PAGE_SIZE 4096
46
47
/***************************************************************************/
50
#define PLASMA_ACT_STAND_BY 0
51
#define PLASMA_ACT_PARALLEL 1
52
#define PLASMA_ACT_DYNAMIC 2
53
#define PLASMA_ACT_FINALIZE 3
54
55
/***************************************************************************/
58
#define PLASMA_FUNC_SGELS 1
59
#define PLASMA_FUNC_SPOSV 2
60
#define PLASMA_FUNC_SGESV 3
61
#define PLASMA_FUNC_DGELS 4
62
#define PLASMA_FUNC_DPOSV 5
63
#define PLASMA_FUNC_DGESV 6
64
#define PLASMA_FUNC_CGELS 7
65
#define PLASMA_FUNC_CPOSV 8
66
#define PLASMA_FUNC_CGESV 9
67
#define PLASMA_FUNC_ZGELS 10
68
#define PLASMA_FUNC_ZPOSV 11
69
#define PLASMA_FUNC_ZGESV 12
70
#define PLASMA_FUNC_ZCGESV 13
71
#define PLASMA_FUNC_DSGESV 14
72
#define PLASMA_FUNC_ZCPOSV 15
73
#define PLASMA_FUNC_DSPOSV 16
74
#define PLASMA_FUNC_DSGELS 17
75
#define PLASMA_FUNC_ZCGELS 18
76
#define PLASMA_FUNC_SGEMM 19
77
#define PLASMA_FUNC_DGEMM 20
78
#define PLASMA_FUNC_CGEMM 21
79
#define PLASMA_FUNC_ZGEMM 22
80
#define PLASMA_FUNC_SSYMM 23
81
#define PLASMA_FUNC_DSYMM 24
82
#define PLASMA_FUNC_CSYMM 25
83
#define PLASMA_FUNC_ZSYMM 26
84
#define PLASMA_FUNC_CHERK 27
85
#define PLASMA_FUNC_ZHERK 28
86
#define PLASMA_FUNC_SSYRK 29
87
#define PLASMA_FUNC_DSYRK 30
88
#define PLASMA_FUNC_CSYRK 31
89
#define PLASMA_FUNC_ZSYRK 32
90
#define PLASMA_FUNC_CHEMM 33
91
#define PLASMA_FUNC_ZHEMM 34
92
#define PLASMA_FUNC_ZHEEV 35
93
#define PLASMA_FUNC_CHEEV 36
94
#define PLASMA_FUNC_DSYEV 37
95
#define PLASMA_FUNC_SSYEV 38
96
#define PLASMA_FUNC_ZHEGST 39
97
#define PLASMA_FUNC_CHEGST 40
98
#define PLASMA_FUNC_DSYGST 41
99
#define PLASMA_FUNC_SSYGST 42
100
#define PLASMA_FUNC_ZHEGV 43
101
#define PLASMA_FUNC_CHEGV 44
102
#define PLASMA_FUNC_DSYGV 45
103
#define PLASMA_FUNC_SSYGV 46
104
#define PLASMA_FUNC_ZHETRD 47
105
#define PLASMA_FUNC_CHETRD 48
106
#define PLASMA_FUNC_DSYTRD 49
107
#define PLASMA_FUNC_SSYTRD 50
108
#define PLASMA_FUNC_ZGESVD 51
109
#define PLASMA_FUNC_CGESVD 52
110
#define PLASMA_FUNC_DGESVD 53
111
#define PLASMA_FUNC_SGESVD 54
112
#define PLASMA_FUNC_ZGEEV 55
113
#define PLASMA_FUNC_CGEEV 56
114
#define PLASMA_FUNC_DGEEV 57
115
#define PLASMA_FUNC_SGEEV 58
116
#define PLASMA_FUNC_ZGEHRD 59
117
#define PLASMA_FUNC_CGEHRD 60
118
#define PLASMA_FUNC_DGEHRD 61
119
#define PLASMA_FUNC_SGEHRD 62
120
#define PLASMA_FUNC_ZGEBRD 63
121
#define PLASMA_FUNC_CGEBRD 64
122
#define PLASMA_FUNC_DGEBRD 65
123
#define PLASMA_FUNC_SGEBRD 66
124
125
/***************************************************************************/
128
#define plasma_pack_args_1( \
129
type1, arg1) \
130
{ \
131
type1 var1 = (arg1); \
132
unsigned char *plasma_ptr = plasma->args_buff; \
133
if (sizeof(type1) > ARGS_BUFF_SIZE) \
134
plasma_fatal_error("plasma_pack_args_1", "arguments buffer too small"); \
135
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
136
}
137
138
#define plasma_pack_args_2( \
139
type1, arg1, \
140
type2, arg2) \
141
{ \
142
type1 var1 = (arg1); \
143
type2 var2 = (arg2); \
144
unsigned char *plasma_ptr = plasma->args_buff; \
145
if (sizeof(type1) + \
146
sizeof(type2) > ARGS_BUFF_SIZE) \
147
plasma_fatal_error("plasma_pack_args_2", "arguments buffer too small"); \
148
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
149
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
150
}
151
152
#define plasma_pack_args_3( \
153
type1, arg1, \
154
type2, arg2, \
155
type3, arg3) \
156
{ \
157
type1 var1 = (arg1); \
158
type2 var2 = (arg2); \
159
type3 var3 = (arg3); \
160
unsigned char *plasma_ptr = plasma->args_buff; \
161
if (sizeof(type1) + \
162
sizeof(type2) + \
163
sizeof(type3) > ARGS_BUFF_SIZE) \
164
plasma_fatal_error("plasma_pack_args_3", "arguments buffer too small"); \
165
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
166
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
167
memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
168
}
169
170
#define plasma_pack_args_4( \
171
type1, arg1, \
172
type2, arg2, \
173
type3, arg3, \
174
type4, arg4) \
175
{ \
176
type1 var1 = (arg1); \
177
type2 var2 = (arg2); \
178
type3 var3 = (arg3); \
179
type4 var4 = (arg4); \
180
unsigned char *plasma_ptr = plasma->args_buff; \
181
if (sizeof(type1) + \
182
sizeof(type2) + \
183
sizeof(type3) + \
184
sizeof(type4) > ARGS_BUFF_SIZE) \
185
plasma_fatal_error("plasma_pack_args_4", "arguments buffer too small"); \
186
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
187
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
188
memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
189
memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
190
}
191
192
#define plasma_pack_args_5( \
193
type1, arg1, \
194
type2, arg2, \
195
type3, arg3, \
196
type4, arg4, \
197
type5, arg5) \
198
{ \
199
type1 var1 = (arg1); \
200
type2 var2 = (arg2); \
201
type3 var3 = (arg3); \
202
type4 var4 = (arg4); \
203
type5 var5 = (arg5); \
204
unsigned char *plasma_ptr = plasma->args_buff; \
205
if (sizeof(type1) + \
206
sizeof(type2) + \
207
sizeof(type3) + \
208
sizeof(type4) + \
209
sizeof(type5) > ARGS_BUFF_SIZE) \
210
plasma_fatal_error("plasma_pack_args_5", "arguments buffer too small"); \
211
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
212
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
213
memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
214
memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
215
memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
216
}
217
218
#define plasma_pack_args_6( \
219
type1, arg1, \
220
type2, arg2, \
221
type3, arg3, \
222
type4, arg4, \
223
type5, arg5, \
224
type6, arg6) \
225
{ \
226
type1 var1 = (arg1); \
227
type2 var2 = (arg2); \
228
type3 var3 = (arg3); \
229
type4 var4 = (arg4); \
230
type5 var5 = (arg5); \
231
type6 var6 = (arg6); \
232
unsigned char *plasma_ptr = plasma->args_buff; \
233
if (sizeof(type1) + \
234
sizeof(type2) + \
235
sizeof(type3) + \
236
sizeof(type4) + \
237
sizeof(type5) + \
238
sizeof(type6) > ARGS_BUFF_SIZE) \
239
plasma_fatal_error("plasma_pack_args_6", "arguments buffer too small"); \
240
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
241
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
242
memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
243
memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
244
memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
245
memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
246
}
247
248
#define plasma_pack_args_7( \
249
type1, arg1, \
250
type2, arg2, \
251
type3, arg3, \
252
type4, arg4, \
253
type5, arg5, \
254
type6, arg6, \
255
type7, arg7) \
256
{ \
257
type1 var1 = (arg1); \
258
type2 var2 = (arg2); \
259
type3 var3 = (arg3); \
260
type4 var4 = (arg4); \
261
type5 var5 = (arg5); \
262
type6 var6 = (arg6); \
263
type7 var7 = (arg7); \
264
unsigned char *plasma_ptr = plasma->args_buff; \
265
if (sizeof(type1) + \
266
sizeof(type2) + \
267
sizeof(type3) + \
268
sizeof(type4) + \
269
sizeof(type5) + \
270
sizeof(type6) + \
271
sizeof(type7) > ARGS_BUFF_SIZE) \
272
plasma_fatal_error("plasma_pack_args_7", "arguments buffer too small"); \
273
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
274
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
275
memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
276
memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
277
memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
278
memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
279
memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
280
}
281
282
#define plasma_pack_args_8( \
283
type1, arg1, \
284
type2, arg2, \
285
type3, arg3, \
286
type4, arg4, \
287
type5, arg5, \
288
type6, arg6, \
289
type7, arg7, \
290
type8, arg8) \
291
{ \
292
type1 var1 = (arg1); \
293
type2 var2 = (arg2); \
294
type3 var3 = (arg3); \
295
type4 var4 = (arg4); \
296
type5 var5 = (arg5); \
297
type6 var6 = (arg6); \
298
type7 var7 = (arg7); \
299
type8 var8 = (arg8); \
300
unsigned char *plasma_ptr = plasma->args_buff; \
301
if (sizeof(type1) + \
302
sizeof(type2) + \
303
sizeof(type3) + \
304
sizeof(type4) + \
305
sizeof(type5) + \
306
sizeof(type6) + \
307
sizeof(type7) + \
308
sizeof(type8) > ARGS_BUFF_SIZE) \
309
plasma_fatal_error("plasma_pack_args_8", "arguments buffer too small"); \
310
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
311
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
312
memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
313
memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
314
memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
315
memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
316
memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
317
memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
318
}
319
320
#define plasma_pack_args_9( \
321
type1, arg1, \
322
type2, arg2, \
323
type3, arg3, \
324
type4, arg4, \
325
type5, arg5, \
326
type6, arg6, \
327
type7, arg7, \
328
type8, arg8, \
329
type9, arg9) \
330
{ \
331
type1 var1 = (arg1); \
332
type2 var2 = (arg2); \
333
type3 var3 = (arg3); \
334
type4 var4 = (arg4); \
335
type5 var5 = (arg5); \
336
type6 var6 = (arg6); \
337
type7 var7 = (arg7); \
338
type8 var8 = (arg8); \
339
type9 var9 = (arg9); \
340
unsigned char *plasma_ptr = plasma->args_buff; \
341
if (sizeof(type1) + \
342
sizeof(type2) + \
343
sizeof(type3) + \
344
sizeof(type4) + \
345
sizeof(type5) + \
346
sizeof(type6) + \
347
sizeof(type7) + \
348
sizeof(type8) + \
349
sizeof(type9) > ARGS_BUFF_SIZE) \
350
plasma_fatal_error("plasma_pack_args_9", "arguments buffer too small"); \
351
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
352
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
353
memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
354
memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
355
memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
356
memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
357
memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
358
memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
359
memcpy(plasma_ptr, &var9, sizeof(type9)); plasma_ptr += sizeof(type9); \
360
}
361
362
#define plasma_pack_args_10( \
363
type1, arg1, \
364
type2, arg2, \
365
type3, arg3, \
366
type4, arg4, \
367
type5, arg5, \
368
type6, arg6, \
369
type7, arg7, \
370
type8, arg8, \
371
type9, arg9, \
372
type10, arg10) \
373
{ \
374
type1 var1 = (arg1); \
375
type2 var2 = (arg2); \
376
type3 var3 = (arg3); \
377
type4 var4 = (arg4); \
378
type5 var5 = (arg5); \
379
type6 var6 = (arg6); \
380
type7 var7 = (arg7); \
381
type8 var8 = (arg8); \
382
type9 var9 = (arg9); \
383
type10 var10 = (arg10); \
384
unsigned char *plasma_ptr = plasma->args_buff; \
385
if (sizeof(type1) + \
386
sizeof(type2) + \
387
sizeof(type3) + \
388
sizeof(type4) + \
389
sizeof(type5) + \
390
sizeof(type6) + \
391
sizeof(type7) + \
392
sizeof(type8) + \
393
sizeof(type9) + \
394
sizeof(type10) > ARGS_BUFF_SIZE) \
395
plasma_fatal_error("plasma_pack_args_9", "arguments buffer too small"); \
396
memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
397
memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
398
memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
399
memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
400
memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
401
memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
402
memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
403
memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
404
memcpy(plasma_ptr, &var9, sizeof(type9)); plasma_ptr += sizeof(type9); \
405
memcpy(plasma_ptr, &var10, sizeof(type10)); plasma_ptr += sizeof(type10); \
406
}
407
408
/***************************************************************************/
411
#define plasma_dynamic_sync() \
412
{ \
413
if (plasma->dynamic_section) { \
414
QUARK_Waitall(plasma->quark); \
415
plasma_barrier(plasma); \
416
plasma->dynamic_section = PLASMA_FALSE; \
417
} \
418
}
419
420
/***************************************************************************/
423
#define plasma_static_call(parallel_function) \
424
{ \
425
if (plasma->dynamic_section) \
426
plasma_dynamic_sync(); \
427
pthread_mutex_lock(&plasma->action_mutex); \
428
plasma->action = PLASMA_ACT_PARALLEL; \
429
plasma->parallel_func_ptr = ¶llel_function; \
430
pthread_mutex_unlock(&plasma->action_mutex); \
431
pthread_cond_broadcast(&plasma->action_condt); \
432
plasma_barrier(plasma); \
433
plasma->action = PLASMA_ACT_STAND_BY; \
434
parallel_function(plasma); \
435
plasma_barrier(plasma); \
436
}
437
438
/***************************************************************************/
441
#define plasma_dynamic_spawn() \
442
{ \
443
if (!plasma->dynamic_section) { \
444
plasma->dynamic_section = PLASMA_TRUE; \
445
pthread_mutex_lock(&plasma->action_mutex); \
446
plasma->action = PLASMA_ACT_DYNAMIC; \
447
pthread_mutex_unlock(&plasma->action_mutex); \
448
pthread_cond_broadcast(&plasma->action_condt); \
449
plasma_barrier(plasma); \
450
plasma->action = PLASMA_ACT_STAND_BY; \
451
} \
452
}
453
454
/***************************************************************************/
457
#define plasma_static_call_1( \
458
parallel_function, \
459
type1, arg1) \
460
plasma_pack_args_1( \
461
type1, (arg1)) \
462
plasma_static_call(parallel_function) \
463
464
#define plasma_static_call_2( \
465
parallel_function, \
466
type1, arg1, \
467
type2, arg2) \
468
plasma_pack_args_2( \
469
type1, (arg1), \
470
type2, (arg2)) \
471
plasma_static_call(parallel_function) \
472
473
#define plasma_static_call_3( \
474
parallel_function, \
475
type1, arg1, \
476
type2, arg2, \
477
type3, arg3) \
478
plasma_pack_args_3( \
479
type1, (arg1), \
480
type2, (arg2), \
481
type3, (arg3)) \
482
plasma_static_call(parallel_function) \
483
484
#define plasma_static_call_4( \
485
parallel_function, \
486
type1, arg1, \
487
type2, arg2, \
488
type3, arg3, \
489
type4, arg4) \
490
plasma_pack_args_4( \
491
type1, (arg1), \
492
type2, (arg2), \
493
type3, (arg3), \
494
type4, (arg4)) \
495
plasma_static_call(parallel_function) \
496
497
#define plasma_static_call_5( \
498
parallel_function, \
499
type1, arg1, \
500
type2, arg2, \
501
type3, arg3, \
502
type4, arg4, \
503
type5, arg5) \
504
plasma_pack_args_5( \
505
type1, (arg1), \
506
type2, (arg2), \
507
type3, (arg3), \
508
type4, (arg4), \
509
type5, (arg5)) \
510
plasma_static_call(parallel_function) \
511
512
#define plasma_static_call_6( \
513
parallel_function, \
514
type1, arg1, \
515
type2, arg2, \
516
type3, arg3, \
517
type4, arg4, \
518
type5, arg5, \
519
type6, arg6) \
520
plasma_pack_args_6( \
521
type1, (arg1), \
522
type2, (arg2), \
523
type3, (arg3), \
524
type4, (arg4), \
525
type5, (arg5), \
526
type6, (arg6)) \
527
plasma_static_call(parallel_function) \
528
529
#define plasma_static_call_7( \
530
parallel_function, \
531
type1, arg1, \
532
type2, arg2, \
533
type3, arg3, \
534
type4, arg4, \
535
type5, arg5, \
536
type6, arg6, \
537
type7, arg7) \
538
plasma_pack_args_7( \
539
type1, (arg1), \
540
type2, (arg2), \
541
type3, (arg3), \
542
type4, (arg4), \
543
type5, (arg5), \
544
type6, (arg6), \
545
type7, (arg7)) \
546
plasma_static_call(parallel_function) \
547
548
#define plasma_static_call_8( \
549
parallel_function, \
550
type1, arg1, \
551
type2, arg2, \
552
type3, arg3, \
553
type4, arg4, \
554
type5, arg5, \
555
type6, arg6, \
556
type7, arg7, \
557
type8, arg8) \
558
plasma_pack_args_8( \
559
type1, (arg1), \
560
type2, (arg2), \
561
type3, (arg3), \
562
type4, (arg4), \
563
type5, (arg5), \
564
type6, (arg6), \
565
type7, (arg7), \
566
type8, (arg8)) \
567
plasma_static_call(parallel_function) \
568
569
#define plasma_static_call_9( \
570
parallel_function, \
571
type1, arg1, \
572
type2, arg2, \
573
type3, arg3, \
574
type4, arg4, \
575
type5, arg5, \
576
type6, arg6, \
577
type7, arg7, \
578
type8, arg8, \
579
type9, arg9) \
580
plasma_pack_args_9( \
581
type1, (arg1), \
582
type2, (arg2), \
583
type3, (arg3), \
584
type4, (arg4), \
585
type5, (arg5), \
586
type6, (arg6), \
587
type7, (arg7), \
588
type8, (arg8), \
589
type9, (arg9)) \
590
plasma_static_call(parallel_function) \
591
592
#define plasma_static_call_10( \
593
parallel_function, \
594
type1, arg1, \
595
type2, arg2, \
596
type3, arg3, \
597
type4, arg4, \
598
type5, arg5, \
599
type6, arg6, \
600
type7, arg7, \
601
type8, arg8, \
602
type9, arg9, \
603
type10, arg10) \
604
plasma_pack_args_10( \
605
type1, (arg1), \
606
type2, (arg2), \
607
type3, (arg3), \
608
type4, (arg4), \
609
type5, (arg5), \
610
type6, (arg6), \
611
type7, (arg7), \
612
type8, (arg8), \
613
type9, (arg9), \
614
type10, (arg10)) \
615
plasma_static_call(parallel_function) \
616
617
/***************************************************************************/
620
#define plasma_parallel_call_1( \
621
parallel_function, \
622
type1, arg1) \
623
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
624
plasma_pack_args_1( \
625
type1, (arg1)) \
626
plasma_static_call(parallel_function) \
627
} else { \
628
plasma_dynamic_spawn(); \
629
parallel_function##_quark( \
630
arg1); \
631
}
632
633
#define plasma_parallel_call_2( \
634
parallel_function, \
635
type1, arg1, \
636
type2, arg2) \
637
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
638
plasma_pack_args_2( \
639
type1, (arg1), \
640
type2, (arg2)) \
641
plasma_static_call(parallel_function) \
642
} else { \
643
plasma_dynamic_spawn(); \
644
parallel_function##_quark( \
645
arg1, \
646
arg2); \
647
}
648
649
#define plasma_parallel_call_3( \
650
parallel_function, \
651
type1, arg1, \
652
type2, arg2, \
653
type3, arg3) \
654
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
655
plasma_pack_args_3( \
656
type1, (arg1), \
657
type2, (arg2), \
658
type3, (arg3)) \
659
plasma_static_call(parallel_function) \
660
} else { \
661
plasma_dynamic_spawn(); \
662
parallel_function##_quark( \
663
arg1, \
664
arg2, \
665
arg3); \
666
}
667
668
#define plasma_parallel_call_4( \
669
parallel_function, \
670
type1, arg1, \
671
type2, arg2, \
672
type3, arg3, \
673
type4, arg4) \
674
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
675
plasma_pack_args_4( \
676
type1, (arg1), \
677
type2, (arg2), \
678
type3, (arg3), \
679
type4, (arg4)) \
680
plasma_static_call(parallel_function) \
681
} else { \
682
plasma_dynamic_spawn(); \
683
parallel_function##_quark( \
684
arg1, \
685
arg2, \
686
arg3, \
687
arg4); \
688
}
689
690
#define plasma_parallel_call_5( \
691
parallel_function, \
692
type1, arg1, \
693
type2, arg2, \
694
type3, arg3, \
695
type4, arg4, \
696
type5, arg5) \
697
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
698
plasma_pack_args_5( \
699
type1, (arg1), \
700
type2, (arg2), \
701
type3, (arg3), \
702
type4, (arg4), \
703
type5, (arg5)) \
704
plasma_static_call(parallel_function) \
705
} else { \
706
plasma_dynamic_spawn(); \
707
parallel_function##_quark( \
708
arg1, \
709
arg2, \
710
arg3, \
711
arg4, \
712
arg5); \
713
}
714
715
#define plasma_parallel_call_6( \
716
parallel_function, \
717
type1, arg1, \
718
type2, arg2, \
719
type3, arg3, \
720
type4, arg4, \
721
type5, arg5, \
722
type6, arg6) \
723
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
724
plasma_pack_args_6( \
725
type1, (arg1), \
726
type2, (arg2), \
727
type3, (arg3), \
728
type4, (arg4), \
729
type5, (arg5), \
730
type6, (arg6)) \
731
plasma_static_call(parallel_function) \
732
} else { \
733
plasma_dynamic_spawn(); \
734
parallel_function##_quark( \
735
arg1, \
736
arg2, \
737
arg3, \
738
arg4, \
739
arg5, \
740
arg6); \
741
}
742
743
#define plasma_parallel_call_7( \
744
parallel_function, \
745
type1, arg1, \
746
type2, arg2, \
747
type3, arg3, \
748
type4, arg4, \
749
type5, arg5, \
750
type6, arg6, \
751
type7, arg7) \
752
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
753
plasma_pack_args_7( \
754
type1, (arg1), \
755
type2, (arg2), \
756
type3, (arg3), \
757
type4, (arg4), \
758
type5, (arg5), \
759
type6, (arg6), \
760
type7, (arg7)) \
761
plasma_static_call(parallel_function) \
762
} else { \
763
plasma_dynamic_spawn(); \
764
parallel_function##_quark( \
765
arg1, \
766
arg2, \
767
arg3, \
768
arg4, \
769
arg5, \
770
arg6, \
771
arg7); \
772
}
773
774
#define plasma_parallel_call_8( \
775
parallel_function, \
776
type1, arg1, \
777
type2, arg2, \
778
type3, arg3, \
779
type4, arg4, \
780
type5, arg5, \
781
type6, arg6, \
782
type7, arg7, \
783
type8, arg8) \
784
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
785
plasma_pack_args_8( \
786
type1, (arg1), \
787
type2, (arg2), \
788
type3, (arg3), \
789
type4, (arg4), \
790
type5, (arg5), \
791
type6, (arg6), \
792
type7, (arg7), \
793
type8, (arg8)) \
794
plasma_static_call(parallel_function) \
795
} else { \
796
plasma_dynamic_spawn(); \
797
parallel_function##_quark( \
798
arg1, \
799
arg2, \
800
arg3, \
801
arg4, \
802
arg5, \
803
arg6, \
804
arg7, \
805
arg8); \
806
}
807
808
#define plasma_parallel_call_9( \
809
parallel_function, \
810
type1, arg1, \
811
type2, arg2, \
812
type3, arg3, \
813
type4, arg4, \
814
type5, arg5, \
815
type6, arg6, \
816
type7, arg7, \
817
type8, arg8, \
818
type9, arg9) \
819
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
820
plasma_pack_args_9( \
821
type1, (arg1), \
822
type2, (arg2), \
823
type3, (arg3), \
824
type4, (arg4), \
825
type5, (arg5), \
826
type6, (arg6), \
827
type7, (arg7), \
828
type8, (arg8), \
829
type9, (arg9)) \
830
plasma_static_call(parallel_function) \
831
} else { \
832
plasma_dynamic_spawn(); \
833
parallel_function##_quark( \
834
arg1, \
835
arg2, \
836
arg3, \
837
arg4, \
838
arg5, \
839
arg6, \
840
arg7, \
841
arg8, \
842
arg9); \
843
}
844
845
#define plasma_parallel_call_10( \
846
parallel_function, \
847
type1, arg1, \
848
type2, arg2, \
849
type3, arg3, \
850
type4, arg4, \
851
type5, arg5, \
852
type6, arg6, \
853
type7, arg7, \
854
type8, arg8, \
855
type9, arg9, \
856
type10, arg10) \
857
if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
858
plasma_pack_args_10( \
859
type1, (arg1), \
860
type2, (arg2), \
861
type3, (arg3), \
862
type4, (arg4), \
863
type5, (arg5), \
864
type6, (arg6), \
865
type7, (arg7), \
866
type8, (arg8), \
867
type9, (arg9), \
868
type10, (arg10)) \
869
plasma_static_call(parallel_function) \
870
} else { \
871
plasma_dynamic_spawn(); \
872
parallel_function##_quark( \
873
arg1, \
874
arg2, \
875
arg3, \
876
arg4, \
877
arg5, \
878
arg6, \
879
arg7, \
880
arg8, \
881
arg9, \
882
arg10); \
883
}
884
885
/***************************************************************************/
888
#define plasma_dynamic_call_1( \
889
parallel_function, \
890
type1, arg1) \
891
plasma_dynamic_spawn(); \
892
parallel_function##_quark( \
893
arg1); \
894
895
#define plasma_dynamic_call_2( \
896
parallel_function, \
897
type1, arg1, \
898
type2, arg2) \
899
plasma_dynamic_spawn(); \
900
parallel_function##_quark( \
901
arg1, \
902
arg2); \
903
904
#define plasma_dynamic_call_3( \
905
parallel_function, \
906
type1, arg1, \
907
type2, arg2, \
908
type3, arg3) \
909
plasma_dynamic_spawn(); \
910
parallel_function##_quark( \
911
arg1, \
912
arg2, \
913
arg3); \
914
915
#define plasma_dynamic_call_4( \
916
parallel_function, \
917
type1, arg1, \
918
type2, arg2, \
919
type3, arg3, \
920
type4, arg4) \
921
plasma_dynamic_spawn(); \
922
parallel_function##_quark( \
923
arg1, \
924
arg2, \
925
arg3, \
926
arg4); \
927
928
#define plasma_dynamic_call_5( \
929
parallel_function, \
930
type1, arg1, \
931
type2, arg2, \
932
type3, arg3, \
933
type4, arg4, \
934
type5, arg5) \
935
plasma_dynamic_spawn(); \
936
parallel_function##_quark( \
937
arg1, \
938
arg2, \
939
arg3, \
940
arg4, \
941
arg5); \
942
943
#define plasma_dynamic_call_6( \
944
parallel_function, \
945
type1, arg1, \
946
type2, arg2, \
947
type3, arg3, \
948
type4, arg4, \
949
type5, arg5, \
950
type6, arg6) \
951
plasma_dynamic_spawn(); \
952
parallel_function##_quark( \
953
arg1, \
954
arg2, \
955
arg3, \
956
arg4, \
957
arg5, \
958
arg6); \
959
960
#define plasma_dynamic_call_7( \
961
parallel_function, \
962
type1, arg1, \
963
type2, arg2, \
964
type3, arg3, \
965
type4, arg4, \
966
type5, arg5, \
967
type6, arg6, \
968
type7, arg7) \
969
plasma_dynamic_spawn(); \
970
parallel_function##_quark( \
971
arg1, \
972
arg2, \
973
arg3, \
974
arg4, \
975
arg5, \
976
arg6, \
977
arg7); \
978
979
#define plasma_dynamic_call_8( \
980
parallel_function, \
981
type1, arg1, \
982
type2, arg2, \
983
type3, arg3, \
984
type4, arg4, \
985
type5, arg5, \
986
type6, arg6, \
987
type7, arg7, \
988
type8, arg8) \
989
plasma_dynamic_spawn(); \
990
parallel_function##_quark( \
991
arg1, \
992
arg2, \
993
arg3, \
994
arg4, \
995
arg5, \
996
arg6, \
997
arg7, \
998
arg8); \
999
1000
#define plasma_dynamic_call_9( \
1001
parallel_function, \
1002
type1, arg1, \
1003
type2, arg2, \
1004
type3, arg3, \
1005
type4, arg4, \
1006
type5, arg5, \
1007
type6, arg6, \
1008
type7, arg7, \
1009
type8, arg8, \
1010
type9, arg9) \
1011
plasma_dynamic_spawn(); \
1012
parallel_function##_quark( \
1013
arg1, \
1014
arg2, \
1015
arg3, \
1016
arg4, \
1017
arg5, \
1018
arg6, \
1019
arg7, \
1020
arg8, \
1021
arg9);
1022
1023
#define plasma_dynamic_call_10( \
1024
parallel_function, \
1025
type1, arg1, \
1026
type2, arg2, \
1027
type3, arg3, \
1028
type4, arg4, \
1029
type5, arg5, \
1030
type6, arg6, \
1031
type7, arg7, \
1032
type8, arg8, \
1033
type9, arg9, \
1034
type10, arg10) \
1035
plasma_dynamic_spawn(); \
1036
parallel_function##_quark( \
1037
arg1, \
1038
arg2, \
1039
arg3, \
1040
arg4, \
1041
arg5, \
1042
arg6, \
1043
arg7, \
1044
arg8, \
1045
arg9, \
1046
arg10);
1047
1048
/***************************************************************************/
1051
#define plasma_unpack_args_1( \
1052
arg1) \
1053
{ \
1054
unsigned char *plasma_ptr = plasma->args_buff; \
1055
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1056
}
1057
1058
#define plasma_unpack_args_2( \
1059
arg1, \
1060
arg2) \
1061
{ \
1062
unsigned char *plasma_ptr = plasma->args_buff; \
1063
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1064
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1065
}
1066
1067
#define plasma_unpack_args_3( \
1068
arg1, \
1069
arg2, \
1070
arg3) \
1071
{ \
1072
unsigned char *plasma_ptr = plasma->args_buff; \
1073
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1074
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1075
memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1076
}
1077
1078
#define plasma_unpack_args_4( \
1079
arg1, \
1080
arg2, \
1081
arg3, \
1082
arg4) \
1083
{ \
1084
unsigned char *plasma_ptr = plasma->args_buff; \
1085
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1086
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1087
memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1088
memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1089
}
1090
1091
#define plasma_unpack_args_5( \
1092
arg1, \
1093
arg2, \
1094
arg3, \
1095
arg4, \
1096
arg5) \
1097
{ \
1098
unsigned char *plasma_ptr = plasma->args_buff; \
1099
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1100
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1101
memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1102
memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1103
memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1104
}
1105
1106
#define plasma_unpack_args_6( \
1107
arg1, \
1108
arg2, \
1109
arg3, \
1110
arg4, \
1111
arg5, \
1112
arg6) \
1113
{ \
1114
unsigned char *plasma_ptr = plasma->args_buff; \
1115
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1116
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1117
memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1118
memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1119
memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1120
memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1121
}
1122
1123
#define plasma_unpack_args_7( \
1124
arg1, \
1125
arg2, \
1126
arg3, \
1127
arg4, \
1128
arg5, \
1129
arg6, \
1130
arg7) \
1131
{ \
1132
unsigned char *plasma_ptr = plasma->args_buff; \
1133
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1134
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1135
memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1136
memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1137
memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1138
memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1139
memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1140
}
1141
1142
#define plasma_unpack_args_8( \
1143
arg1, \
1144
arg2, \
1145
arg3, \
1146
arg4, \
1147
arg5, \
1148
arg6, \
1149
arg7, \
1150
arg8) \
1151
{ \
1152
unsigned char *plasma_ptr = plasma->args_buff; \
1153
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1154
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1155
memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1156
memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1157
memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1158
memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1159
memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1160
memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1161
}
1162
1163
#define plasma_unpack_args_9( \
1164
arg1, \
1165
arg2, \
1166
arg3, \
1167
arg4, \
1168
arg5, \
1169
arg6, \
1170
arg7, \
1171
arg8, \
1172
arg9) \
1173
{ \
1174
unsigned char *plasma_ptr = plasma->args_buff; \
1175
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1176
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1177
memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1178
memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1179
memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1180
memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1181
memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1182
memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1183
memcpy(&arg9, plasma_ptr, sizeof(arg9)); plasma_ptr += sizeof(arg9); \
1184
}
1185
1186
#define plasma_unpack_args_10( \
1187
arg1, \
1188
arg2, \
1189
arg3, \
1190
arg4, \
1191
arg5, \
1192
arg6, \
1193
arg7, \
1194
arg8, \
1195
arg9, \
1196
arg10) \
1197
{ \
1198
unsigned char *plasma_ptr = plasma->args_buff; \
1199
memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1200
memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1201
memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1202
memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1203
memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1204
memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1205
memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1206
memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1207
memcpy(&arg9, plasma_ptr, sizeof(arg9)); plasma_ptr += sizeof(arg9); \
1208
memcpy(&arg10, plasma_ptr, sizeof(arg10)); plasma_ptr += sizeof(arg10); \
1209
}
1210
#endif
plasma_2.4.5
control
global.h
Generated on Mon Jul 9 2012 12:44:58 for PLASMA by
1.8.1