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

PLASMA 2.4.6

- Main Page
- Modules
- Data Types List

All Data Structures Functions Groups
global.h
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_ZHEEVD 39
97 #define PLASMA_FUNC_CHEEVD 40
98 #define PLASMA_FUNC_DSYEVD 41
99 #define PLASMA_FUNC_SSYEVD 42
100 #define PLASMA_FUNC_ZHEGST 43
101 #define PLASMA_FUNC_CHEGST 44
102 #define PLASMA_FUNC_DSYGST 45
103 #define PLASMA_FUNC_SSYGST 46
104 #define PLASMA_FUNC_ZHEGV 47
105 #define PLASMA_FUNC_CHEGV 48
106 #define PLASMA_FUNC_DSYGV 49
107 #define PLASMA_FUNC_SSYGV 50
108 #define PLASMA_FUNC_ZHEGVD 51
109 #define PLASMA_FUNC_CHEGVD 52
110 #define PLASMA_FUNC_DSYGVD 53
111 #define PLASMA_FUNC_SSYGVD 54
112 #define PLASMA_FUNC_ZHETRD 55
113 #define PLASMA_FUNC_CHETRD 56
114 #define PLASMA_FUNC_DSYTRD 57
115 #define PLASMA_FUNC_SSYTRD 58
116 #define PLASMA_FUNC_ZGESVD 59
117 #define PLASMA_FUNC_CGESVD 60
118 #define PLASMA_FUNC_DGESVD 61
119 #define PLASMA_FUNC_SGESVD 62
120 #define PLASMA_FUNC_ZGEEV 63
121 #define PLASMA_FUNC_CGEEV 64
122 #define PLASMA_FUNC_DGEEV 65
123 #define PLASMA_FUNC_SGEEV 66
124 #define PLASMA_FUNC_ZGEHRD 67
125 #define PLASMA_FUNC_CGEHRD 68
126 #define PLASMA_FUNC_DGEHRD 69
127 #define PLASMA_FUNC_SGEHRD 70
128 #define PLASMA_FUNC_ZGEBRD 71
129 #define PLASMA_FUNC_CGEBRD 72
130 #define PLASMA_FUNC_DGEBRD 73
131 #define PLASMA_FUNC_SGEBRD 74
132
133 /***************************************************************************/
136 #define plasma_pack_args_1( \
137 type1, arg1) \
138 { \
139 type1 var1 = (arg1); \
140 unsigned char *plasma_ptr = plasma->args_buff; \
141 if (sizeof(type1) > ARGS_BUFF_SIZE) \
142 plasma_fatal_error("plasma_pack_args_1", "arguments buffer too small"); \
143 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
144 }
145
146 #define plasma_pack_args_2( \
147 type1, arg1, \
148 type2, arg2) \
149 { \
150 type1 var1 = (arg1); \
151 type2 var2 = (arg2); \
152 unsigned char *plasma_ptr = plasma->args_buff; \
153 if (sizeof(type1) + \
154 sizeof(type2) > ARGS_BUFF_SIZE) \
155 plasma_fatal_error("plasma_pack_args_2", "arguments buffer too small"); \
156 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
157 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
158 }
159
160 #define plasma_pack_args_3( \
161 type1, arg1, \
162 type2, arg2, \
163 type3, arg3) \
164 { \
165 type1 var1 = (arg1); \
166 type2 var2 = (arg2); \
167 type3 var3 = (arg3); \
168 unsigned char *plasma_ptr = plasma->args_buff; \
169 if (sizeof(type1) + \
170 sizeof(type2) + \
171 sizeof(type3) > ARGS_BUFF_SIZE) \
172 plasma_fatal_error("plasma_pack_args_3", "arguments buffer too small"); \
173 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
174 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
175 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
176 }
177
178 #define plasma_pack_args_4( \
179 type1, arg1, \
180 type2, arg2, \
181 type3, arg3, \
182 type4, arg4) \
183 { \
184 type1 var1 = (arg1); \
185 type2 var2 = (arg2); \
186 type3 var3 = (arg3); \
187 type4 var4 = (arg4); \
188 unsigned char *plasma_ptr = plasma->args_buff; \
189 if (sizeof(type1) + \
190 sizeof(type2) + \
191 sizeof(type3) + \
192 sizeof(type4) > ARGS_BUFF_SIZE) \
193 plasma_fatal_error("plasma_pack_args_4", "arguments buffer too small"); \
194 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
195 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
196 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
197 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
198 }
199
200 #define plasma_pack_args_5( \
201 type1, arg1, \
202 type2, arg2, \
203 type3, arg3, \
204 type4, arg4, \
205 type5, arg5) \
206 { \
207 type1 var1 = (arg1); \
208 type2 var2 = (arg2); \
209 type3 var3 = (arg3); \
210 type4 var4 = (arg4); \
211 type5 var5 = (arg5); \
212 unsigned char *plasma_ptr = plasma->args_buff; \
213 if (sizeof(type1) + \
214 sizeof(type2) + \
215 sizeof(type3) + \
216 sizeof(type4) + \
217 sizeof(type5) > ARGS_BUFF_SIZE) \
218 plasma_fatal_error("plasma_pack_args_5", "arguments buffer too small"); \
219 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
220 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
221 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
222 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
223 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
224 }
225
226 #define plasma_pack_args_6( \
227 type1, arg1, \
228 type2, arg2, \
229 type3, arg3, \
230 type4, arg4, \
231 type5, arg5, \
232 type6, arg6) \
233 { \
234 type1 var1 = (arg1); \
235 type2 var2 = (arg2); \
236 type3 var3 = (arg3); \
237 type4 var4 = (arg4); \
238 type5 var5 = (arg5); \
239 type6 var6 = (arg6); \
240 unsigned char *plasma_ptr = plasma->args_buff; \
241 if (sizeof(type1) + \
242 sizeof(type2) + \
243 sizeof(type3) + \
244 sizeof(type4) + \
245 sizeof(type5) + \
246 sizeof(type6) > ARGS_BUFF_SIZE) \
247 plasma_fatal_error("plasma_pack_args_6", "arguments buffer too small"); \
248 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
249 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
250 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
251 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
252 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
253 memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
254 }
255
256 #define plasma_pack_args_7( \
257 type1, arg1, \
258 type2, arg2, \
259 type3, arg3, \
260 type4, arg4, \
261 type5, arg5, \
262 type6, arg6, \
263 type7, arg7) \
264 { \
265 type1 var1 = (arg1); \
266 type2 var2 = (arg2); \
267 type3 var3 = (arg3); \
268 type4 var4 = (arg4); \
269 type5 var5 = (arg5); \
270 type6 var6 = (arg6); \
271 type7 var7 = (arg7); \
272 unsigned char *plasma_ptr = plasma->args_buff; \
273 if (sizeof(type1) + \
274 sizeof(type2) + \
275 sizeof(type3) + \
276 sizeof(type4) + \
277 sizeof(type5) + \
278 sizeof(type6) + \
279 sizeof(type7) > ARGS_BUFF_SIZE) \
280 plasma_fatal_error("plasma_pack_args_7", "arguments buffer too small"); \
281 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
282 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
283 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
284 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
285 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
286 memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
287 memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
288 }
289
290 #define plasma_pack_args_8( \
291 type1, arg1, \
292 type2, arg2, \
293 type3, arg3, \
294 type4, arg4, \
295 type5, arg5, \
296 type6, arg6, \
297 type7, arg7, \
298 type8, arg8) \
299 { \
300 type1 var1 = (arg1); \
301 type2 var2 = (arg2); \
302 type3 var3 = (arg3); \
303 type4 var4 = (arg4); \
304 type5 var5 = (arg5); \
305 type6 var6 = (arg6); \
306 type7 var7 = (arg7); \
307 type8 var8 = (arg8); \
308 unsigned char *plasma_ptr = plasma->args_buff; \
309 if (sizeof(type1) + \
310 sizeof(type2) + \
311 sizeof(type3) + \
312 sizeof(type4) + \
313 sizeof(type5) + \
314 sizeof(type6) + \
315 sizeof(type7) + \
316 sizeof(type8) > ARGS_BUFF_SIZE) \
317 plasma_fatal_error("plasma_pack_args_8", "arguments buffer too small"); \
318 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
319 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
320 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
321 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
322 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
323 memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
324 memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
325 memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
326 }
327
328 #define plasma_pack_args_9( \
329 type1, arg1, \
330 type2, arg2, \
331 type3, arg3, \
332 type4, arg4, \
333 type5, arg5, \
334 type6, arg6, \
335 type7, arg7, \
336 type8, arg8, \
337 type9, arg9) \
338 { \
339 type1 var1 = (arg1); \
340 type2 var2 = (arg2); \
341 type3 var3 = (arg3); \
342 type4 var4 = (arg4); \
343 type5 var5 = (arg5); \
344 type6 var6 = (arg6); \
345 type7 var7 = (arg7); \
346 type8 var8 = (arg8); \
347 type9 var9 = (arg9); \
348 unsigned char *plasma_ptr = plasma->args_buff; \
349 if (sizeof(type1) + \
350 sizeof(type2) + \
351 sizeof(type3) + \
352 sizeof(type4) + \
353 sizeof(type5) + \
354 sizeof(type6) + \
355 sizeof(type7) + \
356 sizeof(type8) + \
357 sizeof(type9) > ARGS_BUFF_SIZE) \
358 plasma_fatal_error("plasma_pack_args_9", "arguments buffer too small"); \
359 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
360 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
361 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
362 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
363 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
364 memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
365 memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
366 memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
367 memcpy(plasma_ptr, &var9, sizeof(type9)); plasma_ptr += sizeof(type9); \
368 }
369
370 #define plasma_pack_args_10( \
371 type1, arg1, \
372 type2, arg2, \
373 type3, arg3, \
374 type4, arg4, \
375 type5, arg5, \
376 type6, arg6, \
377 type7, arg7, \
378 type8, arg8, \
379 type9, arg9, \
380 type10, arg10) \
381 { \
382 type1 var1 = (arg1); \
383 type2 var2 = (arg2); \
384 type3 var3 = (arg3); \
385 type4 var4 = (arg4); \
386 type5 var5 = (arg5); \
387 type6 var6 = (arg6); \
388 type7 var7 = (arg7); \
389 type8 var8 = (arg8); \
390 type9 var9 = (arg9); \
391 type10 var10 = (arg10); \
392 unsigned char *plasma_ptr = plasma->args_buff; \
393 if (sizeof(type1) + \
394 sizeof(type2) + \
395 sizeof(type3) + \
396 sizeof(type4) + \
397 sizeof(type5) + \
398 sizeof(type6) + \
399 sizeof(type7) + \
400 sizeof(type8) + \
401 sizeof(type9) + \
402 sizeof(type10) > ARGS_BUFF_SIZE) \
403 plasma_fatal_error("plasma_pack_args_9", "arguments buffer too small"); \
404 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
405 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
406 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
407 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
408 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
409 memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
410 memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
411 memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
412 memcpy(plasma_ptr, &var9, sizeof(type9)); plasma_ptr += sizeof(type9); \
413 memcpy(plasma_ptr, &var10, sizeof(type10)); plasma_ptr += sizeof(type10); \
414 }
415
416
417 #define plasma_pack_args_11( \
418 type1, arg1, \
419 type2, arg2, \
420 type3, arg3, \
421 type4, arg4, \
422 type5, arg5, \
423 type6, arg6, \
424 type7, arg7, \
425 type8, arg8, \
426 type9, arg9, \
427 type10, arg10, \
428 type11, arg11) \
429 { \
430 type1 var1 = (arg1); \
431 type2 var2 = (arg2); \
432 type3 var3 = (arg3); \
433 type4 var4 = (arg4); \
434 type5 var5 = (arg5); \
435 type6 var6 = (arg6); \
436 type7 var7 = (arg7); \
437 type8 var8 = (arg8); \
438 type9 var9 = (arg9); \
439 type10 var10 = (arg10); \
440 type11 var11 = (arg11); \
441 unsigned char *plasma_ptr = plasma->args_buff; \
442 if (sizeof(type1) + \
443 sizeof(type2) + \
444 sizeof(type3) + \
445 sizeof(type4) + \
446 sizeof(type5) + \
447 sizeof(type6) + \
448 sizeof(type7) + \
449 sizeof(type8) + \
450 sizeof(type9) + \
451 sizeof(type10) + \
452 sizeof(type11) > ARGS_BUFF_SIZE) \
453 plasma_fatal_error("plasma_pack_args_11", "arguments buffer too small"); \
454 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
455 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
456 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
457 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
458 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
459 memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
460 memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
461 memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
462 memcpy(plasma_ptr, &var9, sizeof(type9)); plasma_ptr += sizeof(type9); \
463 memcpy(plasma_ptr, &var10, sizeof(type10)); plasma_ptr += sizeof(type10); \
464 memcpy(plasma_ptr, &var11, sizeof(type11)); plasma_ptr += sizeof(type11); \
465 }
466
467 #define plasma_pack_args_12( \
468 type1, arg1, \
469 type2, arg2, \
470 type3, arg3, \
471 type4, arg4, \
472 type5, arg5, \
473 type6, arg6, \
474 type7, arg7, \
475 type8, arg8, \
476 type9, arg9, \
477 type10, arg10, \
478 type11, arg11, \
479 type12, arg12) \
480 { \
481 type1 var1 = (arg1); \
482 type2 var2 = (arg2); \
483 type3 var3 = (arg3); \
484 type4 var4 = (arg4); \
485 type5 var5 = (arg5); \
486 type6 var6 = (arg6); \
487 type7 var7 = (arg7); \
488 type8 var8 = (arg8); \
489 type9 var9 = (arg9); \
490 type10 var10 = (arg10); \
491 type11 var11 = (arg11); \
492 type12 var12 = (arg12); \
493 unsigned char *plasma_ptr = plasma->args_buff; \
494 if (sizeof(type1) + \
495 sizeof(type2) + \
496 sizeof(type3) + \
497 sizeof(type4) + \
498 sizeof(type5) + \
499 sizeof(type6) + \
500 sizeof(type7) + \
501 sizeof(type8) + \
502 sizeof(type9) + \
503 sizeof(type10) + \
504 sizeof(type11) + \
505 sizeof(type12) > ARGS_BUFF_SIZE) \
506 plasma_fatal_error("plasma_pack_args_12", "arguments buffer too small"); \
507 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
508 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
509 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
510 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
511 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
512 memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
513 memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
514 memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
515 memcpy(plasma_ptr, &var9, sizeof(type9)); plasma_ptr += sizeof(type9); \
516 memcpy(plasma_ptr, &var10, sizeof(type10)); plasma_ptr += sizeof(type10); \
517 memcpy(plasma_ptr, &var11, sizeof(type11)); plasma_ptr += sizeof(type11); \
518 memcpy(plasma_ptr, &var12, sizeof(type12)); plasma_ptr += sizeof(type12); \
519 }
520
521
522 #define plasma_pack_args_13( \
523 type1, arg1, \
524 type2, arg2, \
525 type3, arg3, \
526 type4, arg4, \
527 type5, arg5, \
528 type6, arg6, \
529 type7, arg7, \
530 type8, arg8, \
531 type9, arg9, \
532 type10, arg10, \
533 type11, arg11, \
534 type12, arg12, \
535 type13, arg13) \
536 { \
537 type1 var1 = (arg1); \
538 type2 var2 = (arg2); \
539 type3 var3 = (arg3); \
540 type4 var4 = (arg4); \
541 type5 var5 = (arg5); \
542 type6 var6 = (arg6); \
543 type7 var7 = (arg7); \
544 type8 var8 = (arg8); \
545 type9 var9 = (arg9); \
546 type10 var10 = (arg10); \
547 type11 var11 = (arg11); \
548 type12 var12 = (arg12); \
549 type13 var13 = (arg13); \
550 unsigned char *plasma_ptr = plasma->args_buff; \
551 if (sizeof(type1) + \
552 sizeof(type2) + \
553 sizeof(type3) + \
554 sizeof(type4) + \
555 sizeof(type5) + \
556 sizeof(type6) + \
557 sizeof(type7) + \
558 sizeof(type8) + \
559 sizeof(type9) + \
560 sizeof(type10) + \
561 sizeof(type11) + \
562 sizeof(type12) + \
563 sizeof(type13) > ARGS_BUFF_SIZE) \
564 plasma_fatal_error("plasma_pack_args_13", "arguments buffer too small"); \
565 memcpy(plasma_ptr, &var1, sizeof(type1)); plasma_ptr += sizeof(type1); \
566 memcpy(plasma_ptr, &var2, sizeof(type2)); plasma_ptr += sizeof(type2); \
567 memcpy(plasma_ptr, &var3, sizeof(type3)); plasma_ptr += sizeof(type3); \
568 memcpy(plasma_ptr, &var4, sizeof(type4)); plasma_ptr += sizeof(type4); \
569 memcpy(plasma_ptr, &var5, sizeof(type5)); plasma_ptr += sizeof(type5); \
570 memcpy(plasma_ptr, &var6, sizeof(type6)); plasma_ptr += sizeof(type6); \
571 memcpy(plasma_ptr, &var7, sizeof(type7)); plasma_ptr += sizeof(type7); \
572 memcpy(plasma_ptr, &var8, sizeof(type8)); plasma_ptr += sizeof(type8); \
573 memcpy(plasma_ptr, &var9, sizeof(type9)); plasma_ptr += sizeof(type9); \
574 memcpy(plasma_ptr, &var10, sizeof(type10)); plasma_ptr += sizeof(type10); \
575 memcpy(plasma_ptr, &var11, sizeof(type11)); plasma_ptr += sizeof(type11); \
576 memcpy(plasma_ptr, &var12, sizeof(type12)); plasma_ptr += sizeof(type12); \
577 memcpy(plasma_ptr, &var13, sizeof(type13)); plasma_ptr += sizeof(type13); \
578 }
579
580 /***************************************************************************/
583 #define plasma_dynamic_sync() \
584 { \
585 if (plasma->dynamic_section) { \
586 QUARK_Waitall(plasma->quark); \
587 plasma_barrier(plasma); \
588 plasma->dynamic_section = PLASMA_FALSE; \
589 } \
590 }
591
592 /***************************************************************************/
595 #define plasma_static_call(parallel_function) \
596 { \
597 if (plasma->dynamic_section) \
598 plasma_dynamic_sync(); \
599 pthread_mutex_lock(&plasma->action_mutex); \
600 plasma->action = PLASMA_ACT_PARALLEL; \
601 plasma->parallel_func_ptr = &parallel_function; \
602 pthread_mutex_unlock(&plasma->action_mutex); \
603 pthread_cond_broadcast(&plasma->action_condt); \
604 plasma_barrier(plasma); \
605 plasma->action = PLASMA_ACT_STAND_BY; \
606 parallel_function(plasma); \
607 plasma_barrier(plasma); \
608 }
609
610 /***************************************************************************/
613 #define plasma_dynamic_spawn() \
614 { \
615 if (!plasma->dynamic_section) { \
616 plasma->dynamic_section = PLASMA_TRUE; \
617 pthread_mutex_lock(&plasma->action_mutex); \
618 plasma->action = PLASMA_ACT_DYNAMIC; \
619 pthread_mutex_unlock(&plasma->action_mutex); \
620 pthread_cond_broadcast(&plasma->action_condt); \
621 plasma_barrier(plasma); \
622 plasma->action = PLASMA_ACT_STAND_BY; \
623 } \
624 }
625
626 /***************************************************************************/
629 #define plasma_static_call_1( \
630 parallel_function, \
631 type1, arg1) \
632 plasma_pack_args_1( \
633 type1, (arg1)) \
634 plasma_static_call(parallel_function) \
635
636 #define plasma_static_call_2( \
637 parallel_function, \
638 type1, arg1, \
639 type2, arg2) \
640 plasma_pack_args_2( \
641 type1, (arg1), \
642 type2, (arg2)) \
643 plasma_static_call(parallel_function) \
644
645 #define plasma_static_call_3( \
646 parallel_function, \
647 type1, arg1, \
648 type2, arg2, \
649 type3, arg3) \
650 plasma_pack_args_3( \
651 type1, (arg1), \
652 type2, (arg2), \
653 type3, (arg3)) \
654 plasma_static_call(parallel_function) \
655
656 #define plasma_static_call_4( \
657 parallel_function, \
658 type1, arg1, \
659 type2, arg2, \
660 type3, arg3, \
661 type4, arg4) \
662 plasma_pack_args_4( \
663 type1, (arg1), \
664 type2, (arg2), \
665 type3, (arg3), \
666 type4, (arg4)) \
667 plasma_static_call(parallel_function) \
668
669 #define plasma_static_call_5( \
670 parallel_function, \
671 type1, arg1, \
672 type2, arg2, \
673 type3, arg3, \
674 type4, arg4, \
675 type5, arg5) \
676 plasma_pack_args_5( \
677 type1, (arg1), \
678 type2, (arg2), \
679 type3, (arg3), \
680 type4, (arg4), \
681 type5, (arg5)) \
682 plasma_static_call(parallel_function) \
683
684 #define plasma_static_call_6( \
685 parallel_function, \
686 type1, arg1, \
687 type2, arg2, \
688 type3, arg3, \
689 type4, arg4, \
690 type5, arg5, \
691 type6, arg6) \
692 plasma_pack_args_6( \
693 type1, (arg1), \
694 type2, (arg2), \
695 type3, (arg3), \
696 type4, (arg4), \
697 type5, (arg5), \
698 type6, (arg6)) \
699 plasma_static_call(parallel_function) \
700
701 #define plasma_static_call_7( \
702 parallel_function, \
703 type1, arg1, \
704 type2, arg2, \
705 type3, arg3, \
706 type4, arg4, \
707 type5, arg5, \
708 type6, arg6, \
709 type7, arg7) \
710 plasma_pack_args_7( \
711 type1, (arg1), \
712 type2, (arg2), \
713 type3, (arg3), \
714 type4, (arg4), \
715 type5, (arg5), \
716 type6, (arg6), \
717 type7, (arg7)) \
718 plasma_static_call(parallel_function) \
719
720 #define plasma_static_call_8( \
721 parallel_function, \
722 type1, arg1, \
723 type2, arg2, \
724 type3, arg3, \
725 type4, arg4, \
726 type5, arg5, \
727 type6, arg6, \
728 type7, arg7, \
729 type8, arg8) \
730 plasma_pack_args_8( \
731 type1, (arg1), \
732 type2, (arg2), \
733 type3, (arg3), \
734 type4, (arg4), \
735 type5, (arg5), \
736 type6, (arg6), \
737 type7, (arg7), \
738 type8, (arg8)) \
739 plasma_static_call(parallel_function) \
740
741 #define plasma_static_call_9( \
742 parallel_function, \
743 type1, arg1, \
744 type2, arg2, \
745 type3, arg3, \
746 type4, arg4, \
747 type5, arg5, \
748 type6, arg6, \
749 type7, arg7, \
750 type8, arg8, \
751 type9, arg9) \
752 plasma_pack_args_9( \
753 type1, (arg1), \
754 type2, (arg2), \
755 type3, (arg3), \
756 type4, (arg4), \
757 type5, (arg5), \
758 type6, (arg6), \
759 type7, (arg7), \
760 type8, (arg8), \
761 type9, (arg9)) \
762 plasma_static_call(parallel_function) \
763
764 #define plasma_static_call_10( \
765 parallel_function, \
766 type1, arg1, \
767 type2, arg2, \
768 type3, arg3, \
769 type4, arg4, \
770 type5, arg5, \
771 type6, arg6, \
772 type7, arg7, \
773 type8, arg8, \
774 type9, arg9, \
775 type10, arg10) \
776 plasma_pack_args_10( \
777 type1, (arg1), \
778 type2, (arg2), \
779 type3, (arg3), \
780 type4, (arg4), \
781 type5, (arg5), \
782 type6, (arg6), \
783 type7, (arg7), \
784 type8, (arg8), \
785 type9, (arg9), \
786 type10, (arg10)) \
787 plasma_static_call(parallel_function) \
788
789 #define plasma_static_call_11( \
790 parallel_function, \
791 type1, arg1, \
792 type2, arg2, \
793 type3, arg3, \
794 type4, arg4, \
795 type5, arg5, \
796 type6, arg6, \
797 type7, arg7, \
798 type8, arg8, \
799 type9, arg9, \
800 type10, arg10, \
801 type11, arg11) \
802 plasma_pack_args_11( \
803 type1, (arg1), \
804 type2, (arg2), \
805 type3, (arg3), \
806 type4, (arg4), \
807 type5, (arg5), \
808 type6, (arg6), \
809 type7, (arg7), \
810 type8, (arg8), \
811 type9, (arg9), \
812 type10, (arg10), \
813 type11, (arg11)) \
814 plasma_static_call(parallel_function) \
815
816
817 #define plasma_static_call_12( \
818 parallel_function, \
819 type1, arg1, \
820 type2, arg2, \
821 type3, arg3, \
822 type4, arg4, \
823 type5, arg5, \
824 type6, arg6, \
825 type7, arg7, \
826 type8, arg8, \
827 type9, arg9, \
828 type10, arg10, \
829 type11, arg11, \
830 type12, arg12) \
831 plasma_pack_args_12( \
832 type1, (arg1), \
833 type2, (arg2), \
834 type3, (arg3), \
835 type4, (arg4), \
836 type5, (arg5), \
837 type6, (arg6), \
838 type7, (arg7), \
839 type8, (arg8), \
840 type9, (arg9), \
841 type10, (arg10), \
842 type11, (arg11), \
843 type12, (arg12)) \
844 plasma_static_call(parallel_function) \
845
846 #define plasma_static_call_13( \
847 parallel_function, \
848 type1, arg1, \
849 type2, arg2, \
850 type3, arg3, \
851 type4, arg4, \
852 type5, arg5, \
853 type6, arg6, \
854 type7, arg7, \
855 type8, arg8, \
856 type9, arg9, \
857 type10, arg10, \
858 type11, arg11, \
859 type12, arg12, \
860 type13, arg13) \
861 plasma_pack_args_13( \
862 type1, (arg1), \
863 type2, (arg2), \
864 type3, (arg3), \
865 type4, (arg4), \
866 type5, (arg5), \
867 type6, (arg6), \
868 type7, (arg7), \
869 type8, (arg8), \
870 type9, (arg9), \
871 type10, (arg10), \
872 type11, (arg11), \
873 type12, (arg12), \
874 type13, (arg13)) \
875 plasma_static_call(parallel_function) \
876
877 /***************************************************************************/
880 #define plasma_parallel_call_1( \
881 parallel_function, \
882 type1, arg1) \
883 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
884 plasma_pack_args_1( \
885 type1, (arg1)) \
886 plasma_static_call(parallel_function) \
887 } else { \
888 plasma_dynamic_spawn(); \
889 parallel_function##_quark( \
890 arg1); \
891 }
892
893 #define plasma_parallel_call_2( \
894 parallel_function, \
895 type1, arg1, \
896 type2, arg2) \
897 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
898 plasma_pack_args_2( \
899 type1, (arg1), \
900 type2, (arg2)) \
901 plasma_static_call(parallel_function) \
902 } else { \
903 plasma_dynamic_spawn(); \
904 parallel_function##_quark( \
905 arg1, \
906 arg2); \
907 }
908
909 #define plasma_parallel_call_3( \
910 parallel_function, \
911 type1, arg1, \
912 type2, arg2, \
913 type3, arg3) \
914 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
915 plasma_pack_args_3( \
916 type1, (arg1), \
917 type2, (arg2), \
918 type3, (arg3)) \
919 plasma_static_call(parallel_function) \
920 } else { \
921 plasma_dynamic_spawn(); \
922 parallel_function##_quark( \
923 arg1, \
924 arg2, \
925 arg3); \
926 }
927
928 #define plasma_parallel_call_4( \
929 parallel_function, \
930 type1, arg1, \
931 type2, arg2, \
932 type3, arg3, \
933 type4, arg4) \
934 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
935 plasma_pack_args_4( \
936 type1, (arg1), \
937 type2, (arg2), \
938 type3, (arg3), \
939 type4, (arg4)) \
940 plasma_static_call(parallel_function) \
941 } else { \
942 plasma_dynamic_spawn(); \
943 parallel_function##_quark( \
944 arg1, \
945 arg2, \
946 arg3, \
947 arg4); \
948 }
949
950 #define plasma_parallel_call_5( \
951 parallel_function, \
952 type1, arg1, \
953 type2, arg2, \
954 type3, arg3, \
955 type4, arg4, \
956 type5, arg5) \
957 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
958 plasma_pack_args_5( \
959 type1, (arg1), \
960 type2, (arg2), \
961 type3, (arg3), \
962 type4, (arg4), \
963 type5, (arg5)) \
964 plasma_static_call(parallel_function) \
965 } else { \
966 plasma_dynamic_spawn(); \
967 parallel_function##_quark( \
968 arg1, \
969 arg2, \
970 arg3, \
971 arg4, \
972 arg5); \
973 }
974
975 #define plasma_parallel_call_6( \
976 parallel_function, \
977 type1, arg1, \
978 type2, arg2, \
979 type3, arg3, \
980 type4, arg4, \
981 type5, arg5, \
982 type6, arg6) \
983 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
984 plasma_pack_args_6( \
985 type1, (arg1), \
986 type2, (arg2), \
987 type3, (arg3), \
988 type4, (arg4), \
989 type5, (arg5), \
990 type6, (arg6)) \
991 plasma_static_call(parallel_function) \
992 } else { \
993 plasma_dynamic_spawn(); \
994 parallel_function##_quark( \
995 arg1, \
996 arg2, \
997 arg3, \
998 arg4, \
999 arg5, \
1000 arg6); \
1001 }
1002
1003 #define plasma_parallel_call_7( \
1004 parallel_function, \
1005 type1, arg1, \
1006 type2, arg2, \
1007 type3, arg3, \
1008 type4, arg4, \
1009 type5, arg5, \
1010 type6, arg6, \
1011 type7, arg7) \
1012 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
1013 plasma_pack_args_7( \
1014 type1, (arg1), \
1015 type2, (arg2), \
1016 type3, (arg3), \
1017 type4, (arg4), \
1018 type5, (arg5), \
1019 type6, (arg6), \
1020 type7, (arg7)) \
1021 plasma_static_call(parallel_function) \
1022 } else { \
1023 plasma_dynamic_spawn(); \
1024 parallel_function##_quark( \
1025 arg1, \
1026 arg2, \
1027 arg3, \
1028 arg4, \
1029 arg5, \
1030 arg6, \
1031 arg7); \
1032 }
1033
1034 #define plasma_parallel_call_8( \
1035 parallel_function, \
1036 type1, arg1, \
1037 type2, arg2, \
1038 type3, arg3, \
1039 type4, arg4, \
1040 type5, arg5, \
1041 type6, arg6, \
1042 type7, arg7, \
1043 type8, arg8) \
1044 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
1045 plasma_pack_args_8( \
1046 type1, (arg1), \
1047 type2, (arg2), \
1048 type3, (arg3), \
1049 type4, (arg4), \
1050 type5, (arg5), \
1051 type6, (arg6), \
1052 type7, (arg7), \
1053 type8, (arg8)) \
1054 plasma_static_call(parallel_function) \
1055 } else { \
1056 plasma_dynamic_spawn(); \
1057 parallel_function##_quark( \
1058 arg1, \
1059 arg2, \
1060 arg3, \
1061 arg4, \
1062 arg5, \
1063 arg6, \
1064 arg7, \
1065 arg8); \
1066 }
1067
1068 #define plasma_parallel_call_9( \
1069 parallel_function, \
1070 type1, arg1, \
1071 type2, arg2, \
1072 type3, arg3, \
1073 type4, arg4, \
1074 type5, arg5, \
1075 type6, arg6, \
1076 type7, arg7, \
1077 type8, arg8, \
1078 type9, arg9) \
1079 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
1080 plasma_pack_args_9( \
1081 type1, (arg1), \
1082 type2, (arg2), \
1083 type3, (arg3), \
1084 type4, (arg4), \
1085 type5, (arg5), \
1086 type6, (arg6), \
1087 type7, (arg7), \
1088 type8, (arg8), \
1089 type9, (arg9)) \
1090 plasma_static_call(parallel_function) \
1091 } else { \
1092 plasma_dynamic_spawn(); \
1093 parallel_function##_quark( \
1094 arg1, \
1095 arg2, \
1096 arg3, \
1097 arg4, \
1098 arg5, \
1099 arg6, \
1100 arg7, \
1101 arg8, \
1102 arg9); \
1103 }
1104
1105 #define plasma_parallel_call_10( \
1106 parallel_function, \
1107 type1, arg1, \
1108 type2, arg2, \
1109 type3, arg3, \
1110 type4, arg4, \
1111 type5, arg5, \
1112 type6, arg6, \
1113 type7, arg7, \
1114 type8, arg8, \
1115 type9, arg9, \
1116 type10, arg10) \
1117 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
1118 plasma_pack_args_10( \
1119 type1, (arg1), \
1120 type2, (arg2), \
1121 type3, (arg3), \
1122 type4, (arg4), \
1123 type5, (arg5), \
1124 type6, (arg6), \
1125 type7, (arg7), \
1126 type8, (arg8), \
1127 type9, (arg9), \
1128 type10, (arg10)) \
1129 plasma_static_call(parallel_function) \
1130 } else { \
1131 plasma_dynamic_spawn(); \
1132 parallel_function##_quark( \
1133 arg1, \
1134 arg2, \
1135 arg3, \
1136 arg4, \
1137 arg5, \
1138 arg6, \
1139 arg7, \
1140 arg8, \
1141 arg9, \
1142 arg10); \
1143 }
1144
1145 #define plasma_parallel_call_11( \
1146 parallel_function, \
1147 type1, arg1, \
1148 type2, arg2, \
1149 type3, arg3, \
1150 type4, arg4, \
1151 type5, arg5, \
1152 type6, arg6, \
1153 type7, arg7, \
1154 type8, arg8, \
1155 type9, arg9, \
1156 type10, arg10, \
1157 type11, arg11) \
1158 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
1159 plasma_pack_args_11( \
1160 type1, (arg1), \
1161 type2, (arg2), \
1162 type3, (arg3), \
1163 type4, (arg4), \
1164 type5, (arg5), \
1165 type6, (arg6), \
1166 type7, (arg7), \
1167 type8, (arg8), \
1168 type9, (arg9), \
1169 type10, (arg10), \
1170 type11, (arg11)) \
1171 plasma_static_call(parallel_function) \
1172 } else { \
1173 plasma_dynamic_spawn(); \
1174 parallel_function##_quark( \
1175 arg1, \
1176 arg2, \
1177 arg3, \
1178 arg4, \
1179 arg5, \
1180 arg6, \
1181 arg7, \
1182 arg8, \
1183 arg9, \
1184 arg10, \
1185 arg11); \
1186 }
1187
1188
1189
1190 #define plasma_parallel_call_12( \
1191 parallel_function, \
1192 type1, arg1, \
1193 type2, arg2, \
1194 type3, arg3, \
1195 type4, arg4, \
1196 type5, arg5, \
1197 type6, arg6, \
1198 type7, arg7, \
1199 type8, arg8, \
1200 type9, arg9, \
1201 type10, arg10, \
1202 type11, arg11, \
1203 type12, arg12) \
1204 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
1205 plasma_pack_args_12( \
1206 type1, (arg1), \
1207 type2, (arg2), \
1208 type3, (arg3), \
1209 type4, (arg4), \
1210 type5, (arg5), \
1211 type6, (arg6), \
1212 type7, (arg7), \
1213 type8, (arg8), \
1214 type9, (arg9), \
1215 type10, (arg10), \
1216 type11, (arg11), \
1217 type12, (arg12)) \
1218 plasma_static_call(parallel_function) \
1219 } else { \
1220 plasma_dynamic_spawn(); \
1221 parallel_function##_quark( \
1222 arg1, \
1223 arg2, \
1224 arg3, \
1225 arg4, \
1226 arg5, \
1227 arg6, \
1228 arg7, \
1229 arg8, \
1230 arg9, \
1231 arg10, \
1232 arg11, \
1233 arg12); \
1234 }
1235
1236
1237 #define plasma_parallel_call_13( \
1238 parallel_function, \
1239 type1, arg1, \
1240 type2, arg2, \
1241 type3, arg3, \
1242 type4, arg4, \
1243 type5, arg5, \
1244 type6, arg6, \
1245 type7, arg7, \
1246 type8, arg8, \
1247 type9, arg9, \
1248 type10, arg10, \
1249 type11, arg11, \
1250 type12, arg12, \
1251 type13, arg13) \
1252 if (PLASMA_SCHEDULING == PLASMA_STATIC_SCHEDULING) { \
1253 plasma_pack_args_13( \
1254 type1, (arg1), \
1255 type2, (arg2), \
1256 type3, (arg3), \
1257 type4, (arg4), \
1258 type5, (arg5), \
1259 type6, (arg6), \
1260 type7, (arg7), \
1261 type8, (arg8), \
1262 type9, (arg9), \
1263 type10, (arg10), \
1264 type11, (arg11), \
1265 type12, (arg12), \
1266 type13, (arg13)) \
1267 plasma_static_call(parallel_function) \
1268 } else { \
1269 plasma_dynamic_spawn(); \
1270 parallel_function##_quark( \
1271 arg1, \
1272 arg2, \
1273 arg3, \
1274 arg4, \
1275 arg5, \
1276 arg6, \
1277 arg7, \
1278 arg8, \
1279 arg9, \
1280 arg10, \
1281 arg11, \
1282 arg12, \
1283 arg13); \
1284 }
1285
1286 /***************************************************************************/
1289 #define plasma_dynamic_call_1( \
1290 parallel_function, \
1291 type1, arg1) \
1292 plasma_dynamic_spawn(); \
1293 parallel_function##_quark( \
1294 arg1); \
1295
1296 #define plasma_dynamic_call_2( \
1297 parallel_function, \
1298 type1, arg1, \
1299 type2, arg2) \
1300 plasma_dynamic_spawn(); \
1301 parallel_function##_quark( \
1302 arg1, \
1303 arg2); \
1304
1305 #define plasma_dynamic_call_3( \
1306 parallel_function, \
1307 type1, arg1, \
1308 type2, arg2, \
1309 type3, arg3) \
1310 plasma_dynamic_spawn(); \
1311 parallel_function##_quark( \
1312 arg1, \
1313 arg2, \
1314 arg3); \
1315
1316 #define plasma_dynamic_call_4( \
1317 parallel_function, \
1318 type1, arg1, \
1319 type2, arg2, \
1320 type3, arg3, \
1321 type4, arg4) \
1322 plasma_dynamic_spawn(); \
1323 parallel_function##_quark( \
1324 arg1, \
1325 arg2, \
1326 arg3, \
1327 arg4); \
1328
1329 #define plasma_dynamic_call_5( \
1330 parallel_function, \
1331 type1, arg1, \
1332 type2, arg2, \
1333 type3, arg3, \
1334 type4, arg4, \
1335 type5, arg5) \
1336 plasma_dynamic_spawn(); \
1337 parallel_function##_quark( \
1338 arg1, \
1339 arg2, \
1340 arg3, \
1341 arg4, \
1342 arg5); \
1343
1344 #define plasma_dynamic_call_6( \
1345 parallel_function, \
1346 type1, arg1, \
1347 type2, arg2, \
1348 type3, arg3, \
1349 type4, arg4, \
1350 type5, arg5, \
1351 type6, arg6) \
1352 plasma_dynamic_spawn(); \
1353 parallel_function##_quark( \
1354 arg1, \
1355 arg2, \
1356 arg3, \
1357 arg4, \
1358 arg5, \
1359 arg6); \
1360
1361 #define plasma_dynamic_call_7( \
1362 parallel_function, \
1363 type1, arg1, \
1364 type2, arg2, \
1365 type3, arg3, \
1366 type4, arg4, \
1367 type5, arg5, \
1368 type6, arg6, \
1369 type7, arg7) \
1370 plasma_dynamic_spawn(); \
1371 parallel_function##_quark( \
1372 arg1, \
1373 arg2, \
1374 arg3, \
1375 arg4, \
1376 arg5, \
1377 arg6, \
1378 arg7); \
1379
1380 #define plasma_dynamic_call_8( \
1381 parallel_function, \
1382 type1, arg1, \
1383 type2, arg2, \
1384 type3, arg3, \
1385 type4, arg4, \
1386 type5, arg5, \
1387 type6, arg6, \
1388 type7, arg7, \
1389 type8, arg8) \
1390 plasma_dynamic_spawn(); \
1391 parallel_function##_quark( \
1392 arg1, \
1393 arg2, \
1394 arg3, \
1395 arg4, \
1396 arg5, \
1397 arg6, \
1398 arg7, \
1399 arg8); \
1400
1401 #define plasma_dynamic_call_9( \
1402 parallel_function, \
1403 type1, arg1, \
1404 type2, arg2, \
1405 type3, arg3, \
1406 type4, arg4, \
1407 type5, arg5, \
1408 type6, arg6, \
1409 type7, arg7, \
1410 type8, arg8, \
1411 type9, arg9) \
1412 plasma_dynamic_spawn(); \
1413 parallel_function##_quark( \
1414 arg1, \
1415 arg2, \
1416 arg3, \
1417 arg4, \
1418 arg5, \
1419 arg6, \
1420 arg7, \
1421 arg8, \
1422 arg9);
1423
1424 #define plasma_dynamic_call_10( \
1425 parallel_function, \
1426 type1, arg1, \
1427 type2, arg2, \
1428 type3, arg3, \
1429 type4, arg4, \
1430 type5, arg5, \
1431 type6, arg6, \
1432 type7, arg7, \
1433 type8, arg8, \
1434 type9, arg9, \
1435 type10, arg10) \
1436 plasma_dynamic_spawn(); \
1437 parallel_function##_quark( \
1438 arg1, \
1439 arg2, \
1440 arg3, \
1441 arg4, \
1442 arg5, \
1443 arg6, \
1444 arg7, \
1445 arg8, \
1446 arg9, \
1447 arg10);
1448
1449
1450 #define plasma_dynamic_call_11( \
1451 parallel_function, \
1452 type1, arg1, \
1453 type2, arg2, \
1454 type3, arg3, \
1455 type4, arg4, \
1456 type5, arg5, \
1457 type6, arg6, \
1458 type7, arg7, \
1459 type8, arg8, \
1460 type9, arg9, \
1461 type10, arg10, \
1462 type11, arg11) \
1463 plasma_dynamic_spawn(); \
1464 parallel_function##_quark( \
1465 arg1, \
1466 arg2, \
1467 arg3, \
1468 arg4, \
1469 arg5, \
1470 arg6, \
1471 arg7, \
1472 arg8, \
1473 arg9, \
1474 arg10, \
1475 arg11);
1476
1477
1478 #define plasma_dynamic_call_12( \
1479 parallel_function, \
1480 type1, arg1, \
1481 type2, arg2, \
1482 type3, arg3, \
1483 type4, arg4, \
1484 type5, arg5, \
1485 type6, arg6, \
1486 type7, arg7, \
1487 type8, arg8, \
1488 type9, arg9, \
1489 type10, arg10, \
1490 type11, arg11, \
1491 type12, arg12) \
1492 plasma_dynamic_spawn(); \
1493 parallel_function##_quark( \
1494 arg1, \
1495 arg2, \
1496 arg3, \
1497 arg4, \
1498 arg5, \
1499 arg6, \
1500 arg7, \
1501 arg8, \
1502 arg9, \
1503 arg10, \
1504 arg11, \
1505 arg12);
1506
1507 #define plasma_dynamic_call_13( \
1508 parallel_function, \
1509 type1, arg1, \
1510 type2, arg2, \
1511 type3, arg3, \
1512 type4, arg4, \
1513 type5, arg5, \
1514 type6, arg6, \
1515 type7, arg7, \
1516 type8, arg8, \
1517 type9, arg9, \
1518 type10, arg10, \
1519 type11, arg11, \
1520 type12, arg12, \
1521 type13, arg13) \
1522 plasma_dynamic_spawn(); \
1523 parallel_function##_quark( \
1524 arg1, \
1525 arg2, \
1526 arg3, \
1527 arg4, \
1528 arg5, \
1529 arg6, \
1530 arg7, \
1531 arg8, \
1532 arg9, \
1533 arg10, \
1534 arg11, \
1535 arg12, \
1536 arg13);
1537
1538 /***************************************************************************/
1541 #define plasma_unpack_args_1( \
1542 arg1) \
1543 { \
1544 unsigned char *plasma_ptr = plasma->args_buff; \
1545 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1546 }
1547
1548 #define plasma_unpack_args_2( \
1549 arg1, \
1550 arg2) \
1551 { \
1552 unsigned char *plasma_ptr = plasma->args_buff; \
1553 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1554 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1555 }
1556
1557 #define plasma_unpack_args_3( \
1558 arg1, \
1559 arg2, \
1560 arg3) \
1561 { \
1562 unsigned char *plasma_ptr = plasma->args_buff; \
1563 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1564 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1565 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1566 }
1567
1568 #define plasma_unpack_args_4( \
1569 arg1, \
1570 arg2, \
1571 arg3, \
1572 arg4) \
1573 { \
1574 unsigned char *plasma_ptr = plasma->args_buff; \
1575 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1576 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1577 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1578 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1579 }
1580
1581 #define plasma_unpack_args_5( \
1582 arg1, \
1583 arg2, \
1584 arg3, \
1585 arg4, \
1586 arg5) \
1587 { \
1588 unsigned char *plasma_ptr = plasma->args_buff; \
1589 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1590 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1591 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1592 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1593 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1594 }
1595
1596 #define plasma_unpack_args_6( \
1597 arg1, \
1598 arg2, \
1599 arg3, \
1600 arg4, \
1601 arg5, \
1602 arg6) \
1603 { \
1604 unsigned char *plasma_ptr = plasma->args_buff; \
1605 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1606 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1607 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1608 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1609 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1610 memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1611 }
1612
1613 #define plasma_unpack_args_7( \
1614 arg1, \
1615 arg2, \
1616 arg3, \
1617 arg4, \
1618 arg5, \
1619 arg6, \
1620 arg7) \
1621 { \
1622 unsigned char *plasma_ptr = plasma->args_buff; \
1623 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1624 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1625 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1626 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1627 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1628 memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1629 memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1630 }
1631
1632 #define plasma_unpack_args_8( \
1633 arg1, \
1634 arg2, \
1635 arg3, \
1636 arg4, \
1637 arg5, \
1638 arg6, \
1639 arg7, \
1640 arg8) \
1641 { \
1642 unsigned char *plasma_ptr = plasma->args_buff; \
1643 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1644 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1645 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1646 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1647 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1648 memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1649 memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1650 memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1651 }
1652
1653 #define plasma_unpack_args_9( \
1654 arg1, \
1655 arg2, \
1656 arg3, \
1657 arg4, \
1658 arg5, \
1659 arg6, \
1660 arg7, \
1661 arg8, \
1662 arg9) \
1663 { \
1664 unsigned char *plasma_ptr = plasma->args_buff; \
1665 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1666 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1667 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1668 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1669 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1670 memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1671 memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1672 memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1673 memcpy(&arg9, plasma_ptr, sizeof(arg9)); plasma_ptr += sizeof(arg9); \
1674 }
1675
1676 #define plasma_unpack_args_10( \
1677 arg1, \
1678 arg2, \
1679 arg3, \
1680 arg4, \
1681 arg5, \
1682 arg6, \
1683 arg7, \
1684 arg8, \
1685 arg9, \
1686 arg10) \
1687 { \
1688 unsigned char *plasma_ptr = plasma->args_buff; \
1689 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1690 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1691 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1692 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1693 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1694 memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1695 memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1696 memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1697 memcpy(&arg9, plasma_ptr, sizeof(arg9)); plasma_ptr += sizeof(arg9); \
1698 memcpy(&arg10, plasma_ptr, sizeof(arg10)); plasma_ptr += sizeof(arg10); \
1699 }
1700
1701 #define plasma_unpack_args_11( \
1702 arg1, \
1703 arg2, \
1704 arg3, \
1705 arg4, \
1706 arg5, \
1707 arg6, \
1708 arg7, \
1709 arg8, \
1710 arg9, \
1711 arg10, \
1712 arg11) \
1713 { \
1714 unsigned char *plasma_ptr = plasma->args_buff; \
1715 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1716 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1717 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1718 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1719 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1720 memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1721 memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1722 memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1723 memcpy(&arg9, plasma_ptr, sizeof(arg9)); plasma_ptr += sizeof(arg9); \
1724 memcpy(&arg10, plasma_ptr, sizeof(arg10)); plasma_ptr += sizeof(arg10); \
1725 memcpy(&arg11, plasma_ptr, sizeof(arg11)); plasma_ptr += sizeof(arg11); \
1726 }
1727
1728
1729 #define plasma_unpack_args_12( \
1730 arg1, \
1731 arg2, \
1732 arg3, \
1733 arg4, \
1734 arg5, \
1735 arg6, \
1736 arg7, \
1737 arg8, \
1738 arg9, \
1739 arg10, \
1740 arg11, \
1741 arg12) \
1742 { \
1743 unsigned char *plasma_ptr = plasma->args_buff; \
1744 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1745 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1746 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1747 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1748 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1749 memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1750 memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1751 memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1752 memcpy(&arg9, plasma_ptr, sizeof(arg9)); plasma_ptr += sizeof(arg9); \
1753 memcpy(&arg10, plasma_ptr, sizeof(arg10)); plasma_ptr += sizeof(arg10); \
1754 memcpy(&arg11, plasma_ptr, sizeof(arg11)); plasma_ptr += sizeof(arg11); \
1755 memcpy(&arg12, plasma_ptr, sizeof(arg12)); plasma_ptr += sizeof(arg12); \
1756 }
1757
1758 #define plasma_unpack_args_13( \
1759 arg1, \
1760 arg2, \
1761 arg3, \
1762 arg4, \
1763 arg5, \
1764 arg6, \
1765 arg7, \
1766 arg8, \
1767 arg9, \
1768 arg10, \
1769 arg11, \
1770 arg12, \
1771 arg13) \
1772 { \
1773 unsigned char *plasma_ptr = plasma->args_buff; \
1774 memcpy(&arg1, plasma_ptr, sizeof(arg1)); plasma_ptr += sizeof(arg1); \
1775 memcpy(&arg2, plasma_ptr, sizeof(arg2)); plasma_ptr += sizeof(arg2); \
1776 memcpy(&arg3, plasma_ptr, sizeof(arg3)); plasma_ptr += sizeof(arg3); \
1777 memcpy(&arg4, plasma_ptr, sizeof(arg4)); plasma_ptr += sizeof(arg4); \
1778 memcpy(&arg5, plasma_ptr, sizeof(arg5)); plasma_ptr += sizeof(arg5); \
1779 memcpy(&arg6, plasma_ptr, sizeof(arg6)); plasma_ptr += sizeof(arg6); \
1780 memcpy(&arg7, plasma_ptr, sizeof(arg7)); plasma_ptr += sizeof(arg7); \
1781 memcpy(&arg8, plasma_ptr, sizeof(arg8)); plasma_ptr += sizeof(arg8); \
1782 memcpy(&arg9, plasma_ptr, sizeof(arg9)); plasma_ptr += sizeof(arg9); \
1783 memcpy(&arg10, plasma_ptr, sizeof(arg10)); plasma_ptr += sizeof(arg10); \
1784 memcpy(&arg11, plasma_ptr, sizeof(arg11)); plasma_ptr += sizeof(arg11); \
1785 memcpy(&arg12, plasma_ptr, sizeof(arg12)); plasma_ptr += sizeof(arg12); \
1786 memcpy(&arg13, plasma_ptr, sizeof(arg13)); plasma_ptr += sizeof(arg13); \
1787 }
1788
1789 #endif