comparison VCilk.h @ 0:b456b67cddd0

Initial add -- works, with vmalloc + probes version of VMS
author Me
date Sat, 30 Oct 2010 20:51:40 -0700
parents
children 2845dca6a28b
comparison
equal deleted inserted replaced
-1:000000000000 0:af723d75ab3d
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 */
8
9 #ifndef _VCilk_H
10 #define _VCilk_H
11
12 #include "VMS/Queue_impl/PrivateQueue.h"
13 #include "VMS/Hash_impl/PrivateHash.h"
14 #include "VMS/VMS.h"
15
16 /*This header defines everything specific to the VCilk semantic plug-in
17 */
18 typedef struct _VCilkSemReq VCilkSemReq;
19
20
21 /*Semantic layer-specific data sent inside a request from lib called in app
22 * to request handler called in MasterLoop
23 */
24 enum VCilkReqType
25 {
26 syncReq = 1,
27 mallocReq,
28 freeReq
29 };
30
31 struct _VCilkSemReq
32 { enum VCilkReqType reqType;
33 VirtProcr *requestingPr;
34 int32 sizeToMalloc;
35 void *ptrToFree;
36 VirtProcrFnPtr fnPtr;
37 void *initData;
38 int32 coreToSpawnOnto;
39 }
40 /* VCilkSemReq */;
41
42 typedef struct
43 {
44 PrivQueueStruc **readyVPQs;
45 HashTable *commHashTbl;
46 int32 numVirtPr;
47 int32 nextCoreToGetNewPr;
48 int32 primitiveStartTime;
49 }
50 VCilkSemEnv;
51
52 typedef struct
53 {
54 int32 syncPending;
55 int32 numLiveChildren;
56 VirtProcr *parentPr;
57 }
58 VCilkSemData;
59
60 //===========================================================================
61
62 void
63 VCilk__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
64
65 int32
66 VCilk__giveMinWorkUnitCycles( float32 percentOverhead );
67
68 void inline
69 VCilk__start_primitive();
70
71 int32 inline
72 VCilk__end_primitive_and_give_cycles();
73
74 int32
75 VCilk__giveIdealNumWorkUnits();
76
77 //=======================
78
79 void
80 VCilk__init();
81
82 void
83 VCilk__cleanup_after_shutdown();
84
85 //=======================
86
87 void inline
88 VCilk__spawn( int32 coreToSpawnOnto, VirtProcrFnPtr fnPtr,
89 void *initData, VirtProcr *creatingPr );
90
91 int32
92 VCilk__give_number_of_cores_to_spawn_onto();
93
94 void
95 VCilk__sync( VirtProcr *animatingPr );
96
97 void *
98 VCilk__malloc( int32 sizeToMalloc, VirtProcr *animPr );
99
100 void
101 VCilk__free( void *ptrToFree, VirtProcr *animPr );
102
103 void
104 VCilk__dissipate_procr( VirtProcr *procrToDissipate );
105
106 //=======================
107
108 void
109 VCilk__free_semantic_request( VCilkSemReq *semReq );
110
111
112 //========================= Internal use only =============================
113 void
114 VCilk__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
115
116 VirtProcr *
117 VCilk__schedule_virt_procr( void *_semEnv, int coreNum );
118
119
120 #endif /* _VCilk_H */
121