Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.h @ 55:3bac84e4e56e
Works with correct matrix mult Nov 4 -- switch animators macros, many updates
Changed all queues back to VMSQ variants #defines
correct, protected, work-stealing, with compiler switch in and out
| author | Me |
|---|---|
| date | Thu, 04 Nov 2010 18:13:18 -0700 |
| parents | f8508572f3de |
| children | 26d53313a8f2 |
comparison
equal
deleted
inserted
replaced
| 22:caa939667a34 | 23:9f7dea935484 |
|---|---|
| 9 #ifndef _VMS_H | 9 #ifndef _VMS_H |
| 10 #define _VMS_H | 10 #define _VMS_H |
| 11 #define __USE_GNU | 11 #define __USE_GNU |
| 12 | 12 |
| 13 #include "VMS_primitive_data_types.h" | 13 #include "VMS_primitive_data_types.h" |
| 14 #include "Queue_impl/BlockingQueue.h" | 14 #include "Queue_impl/PrivateQueue.h" |
| 15 #include "Histogram/Histogram.h" | 15 #include "Histogram/Histogram.h" |
| 16 #include "DynArray/DynArray.h" | 16 #include "DynArray/DynArray.h" |
| 17 #include "Hash_impl/PrivateHash.h" | 17 #include "Hash_impl/PrivateHash.h" |
| 18 #include "vmalloc.h" | 18 #include "vmalloc.h" |
| 19 | 19 |
| 20 #include <pthread.h> | 20 #include <pthread.h> |
| 21 #include <sys/time.h> | 21 #include <sys/time.h> |
| 22 | 22 |
| 23 | 23 |
| 24 //=============================== Debug =================================== | 24 //=============================== Debug =================================== |
| 25 //These defines turn types of bug messages on and off | 25 // |
| 26 #define dbgProbes FALSE | |
| 27 #define dbgAppFlow FALSE | |
| 28 | |
| 29 //When SEQUENTIAL is defined, VMS does sequential exe in the main thread | 26 //When SEQUENTIAL is defined, VMS does sequential exe in the main thread |
| 30 // It still does co-routines and all the mechanisms are the same, it just | 27 // It still does co-routines and all the mechanisms are the same, it just |
| 31 // has only a single thread and animates VPs one at a time | 28 // has only a single thread and animates VPs one at a time |
| 32 //#define SEQUENTIAL | 29 //#define SEQUENTIAL |
| 33 | 30 |
| 31 //#define USE_WORK_STEALING | |
| 32 | |
| 34 //turns on the probe-instrumentation in the application -- when not | 33 //turns on the probe-instrumentation in the application -- when not |
| 35 // defined, the calls to the probe functions turn into comments | 34 // defined, the calls to the probe functions turn into comments |
| 36 #define STATS__ENABLE_PROBES | 35 #define STATS__ENABLE_PROBES |
| 37 | 36 |
| 38 | 37 //These defines turn types of bug messages on and off |
| 39 #define DEBUG(msg)// printf(msg); fflush(stdin); | 38 // be sure debug messages are un-commented (next block of defines) |
| 40 #define DEBUG_MSG( bool, msg) //if( bool){ printf(msg); fflush(stdin);} | 39 #define dbgProbes FALSE /* for issues inside probes themselves*/ |
| 41 #define PRINT1_DEBUG(msg, param) //printf(msg, param); fflush(stdin); | 40 #define dbgAppFlow TRUE /* Top level flow of application code -- general*/ |
| 42 #define PRINT2_DEBUG(msg, p1, p2) //printf(msg, p1, p2); fflush(stdin); | 41 #define dbgB2BMaster FALSE/* in coreloop, back to back master VPs*/ |
| 43 | 42 #define dbgRqstHdlr FALSE /* in request handler code*/ |
| 44 #define PRINT_ERROR(msg) printf(msg); fflush(stdin); | 43 |
| 45 #define PRINT1_ERROR(msg, param) printf(msg, param); fflush(stdin); | 44 //Comment or un- the substitute half to turn on/off types of debug message |
| 46 #define PRINT2_ERROR(msg, p1, p2) printf(msg, p1, p2); fflush(stdin); | 45 #define DEBUG( bool, msg) \ |
| 46 if( bool){ printf(msg); fflush(stdin);} | |
| 47 #define DEBUG1( bool, msg, param) \ | |
| 48 if(bool){printf(msg, param); fflush(stdin);} | |
| 49 #define DEBUG2( bool, msg, p1, p2) \ | |
| 50 //if(bool) {printf(msg, p1, p2); fflush(stdin);} | |
| 51 | |
| 52 #define ERROR(msg) printf(msg); fflush(stdin); | |
| 53 #define ERROR1(msg, param) printf(msg, param); fflush(stdin); | |
| 54 #define ERROR2(msg, p1, p2) printf(msg, p1, p2); fflush(stdin); | |
| 47 | 55 |
| 48 //=========================== STATS ======================= | 56 //=========================== STATS ======================= |
| 49 | 57 |
| 50 //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and | 58 //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and |
| 51 // compiled-in that saves the low part of the time stamp count just before | 59 // compiled-in that saves the low part of the time stamp count just before |
| 54 // rollover of low portion into high portion. | 62 // rollover of low portion into high portion. |
| 55 #define MEAS__TIME_STAMP_SUSP | 63 #define MEAS__TIME_STAMP_SUSP |
| 56 #define MEAS__TIME_MASTER | 64 #define MEAS__TIME_MASTER |
| 57 #define MEAS__NUM_TIMES_TO_RUN 100000 | 65 #define MEAS__NUM_TIMES_TO_RUN 100000 |
| 58 | 66 |
| 67 //For code that calculates normalization-offset between TSC counts of | |
| 68 // different cores. | |
| 59 #define NUM_TSC_ROUND_TRIPS 10 | 69 #define NUM_TSC_ROUND_TRIPS 10 |
| 60 | 70 |
| 61 | 71 |
| 62 //========================= Hardware related Constants ===================== | 72 //========================= Hardware related Constants ===================== |
| 63 //This value is the number of hardware threads in the shared memory | 73 //This value is the number of hardware threads in the shared memory |
| 64 // machine | 74 // machine |
| 65 #define NUM_CORES 4 | 75 #define NUM_CORES 4 |
| 66 | 76 |
| 67 // balance amortizing master fixed overhead vs imbalance potential | 77 // tradeoff amortizing master fixed overhead vs imbalance potential |
| 68 #define NUM_SCHED_SLOTS 3 | 78 // when work-stealing, can make bigger, at risk of losing cache affinity |
| 79 #define NUM_SCHED_SLOTS 5 | |
| 69 | 80 |
| 70 #define MIN_WORK_UNIT_CYCLES 20000 | 81 #define MIN_WORK_UNIT_CYCLES 20000 |
| 71 | 82 |
| 72 #define MASTERLOCK_RETRIES 10000 | 83 #define MASTERLOCK_RETRIES 10000 |
| 73 | 84 |
| 80 | 91 |
| 81 //============================== | 92 //============================== |
| 82 | 93 |
| 83 #define SUCCESS 0 | 94 #define SUCCESS 0 |
| 84 | 95 |
| 85 #define writeVMSQ writeSRSWQ | 96 #define writeVMSQ writePrivQ |
| 86 #define readVMSQ readSRSWQ | 97 #define readVMSQ readPrivQ |
| 87 #define makeVMSQ makeSRSWQ | 98 #define makeVMSQ makePrivQ |
| 88 #define VMSQueueStruc SRSWQueueStruc | 99 #define numInVMSQ numInPrivQ |
| 100 #define VMSQueueStruc PrivQueueStruc | |
| 89 | 101 |
| 90 | 102 |
| 91 | 103 |
| 92 //=========================================================================== | 104 //=========================================================================== |
| 93 typedef unsigned long long TSCount; | 105 typedef unsigned long long TSCount; |
| 94 | 106 |
| 95 typedef struct _SchedSlot SchedSlot; | 107 typedef struct _SchedSlot SchedSlot; |
| 96 typedef struct _VMSReqst VMSReqst; | 108 typedef struct _VMSReqst VMSReqst; |
| 97 typedef struct _VirtProcr VirtProcr; | 109 typedef struct _VirtProcr VirtProcr; |
| 98 typedef struct _IntervalProbe IntervalProbe; | 110 typedef struct _IntervalProbe IntervalProbe; |
| 111 typedef struct _GateStruc GateStruc; | |
| 112 | |
| 99 | 113 |
| 100 typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx | 114 typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx |
| 101 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv | 115 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv |
| 102 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr | 116 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr |
| 103 typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr | 117 typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr |
| 188 { | 202 { |
| 189 SlaveScheduler slaveScheduler; | 203 SlaveScheduler slaveScheduler; |
| 190 RequestHandler requestHandler; | 204 RequestHandler requestHandler; |
| 191 | 205 |
| 192 SchedSlot ***allSchedSlots; | 206 SchedSlot ***allSchedSlots; |
| 193 SRSWQueueStruc **readyToAnimateQs; | 207 VMSQueueStruc **readyToAnimateQs; |
| 194 VirtProcr **masterVPs; | 208 VirtProcr **masterVPs; |
| 195 | 209 |
| 196 void *semanticEnv; | 210 void *semanticEnv; |
| 197 void *OSEventStruc; //for future, when add I/O to BLIS | 211 void *OSEventStruc; //for future, when add I/O to BLIS |
| 198 MallocProlog *freeListHead; | 212 MallocProlog *freeListHead; |
| 203 | 217 |
| 204 int32 setupComplete; | 218 int32 setupComplete; |
| 205 int32 masterLock; | 219 int32 masterLock; |
| 206 | 220 |
| 207 int32 numMasterInARow[NUM_CORES];//detect back-to-back masterVP | 221 int32 numMasterInARow[NUM_CORES];//detect back-to-back masterVP |
| 222 GateStruc **workStealingGates[ NUM_CORES ]; //concurrent work-steal | |
| 223 int32 workStealingLock; | |
| 224 | |
| 208 int32 numProcrsCreated; //gives ordering to processor creation | 225 int32 numProcrsCreated; //gives ordering to processor creation |
| 209 | 226 |
| 210 //=========== MEASUREMENT STUFF ============= | 227 //=========== MEASUREMENT STUFF ============= |
| 211 IntervalProbe **intervalProbes; | 228 IntervalProbe **intervalProbes; |
| 212 PrivDynArrayInfo *dynIntervalProbesInfo; | 229 PrivDynArrayInfo *dynIntervalProbesInfo; |
| 214 int32 masterCreateProbeID; | 231 int32 masterCreateProbeID; |
| 215 float64 createPtInSecs; | 232 float64 createPtInSecs; |
| 216 } | 233 } |
| 217 MasterEnv; | 234 MasterEnv; |
| 218 | 235 |
| 219 //============================= | 236 //========================= Extra Stuff Data Strucs ======================= |
| 220 typedef struct | 237 typedef struct |
| 221 { | 238 { |
| 222 | 239 |
| 223 } | 240 } |
| 224 VMSExcp; | 241 VMSExcp; |
| 225 | 242 |
| 243 struct _GateStruc | |
| 244 { | |
| 245 int32 gateClosed; | |
| 246 int32 preGateProgress; | |
| 247 int32 waitProgress; | |
| 248 int32 exitProgress; | |
| 249 }; | |
| 250 //GateStruc | |
| 226 | 251 |
| 227 //======================= OS Thread related =============================== | 252 //======================= OS Thread related =============================== |
| 228 | 253 |
| 229 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype | 254 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype |
| 230 void * coreLoop_Seq( void *paramsIn ); //standard PThreads fn prototype | 255 void * coreLoop_Seq( void *paramsIn ); //standard PThreads fn prototype |
| 340 /* inputs */ : \ | 365 /* inputs */ : \ |
| 341 /* clobber */ : "%eax", "%edx" \ | 366 /* clobber */ : "%eax", "%edx" \ |
| 342 ); | 367 ); |
| 343 //===== | 368 //===== |
| 344 | 369 |
| 370 #include "SwitchAnimators.h" | |
| 345 #include "probes.h" | 371 #include "probes.h" |
| 346 | 372 |
| 347 #endif /* _VMS_H */ | 373 #endif /* _VMS_H */ |
| 348 | 374 |
