Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff 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 |
line diff
1.1 --- a/VMS.h Tue Nov 02 16:43:01 2010 -0700 1.2 +++ b/VMS.h Thu Nov 04 18:13:18 2010 -0700 1.3 @@ -11,7 +11,7 @@ 1.4 #define __USE_GNU 1.5 1.6 #include "VMS_primitive_data_types.h" 1.7 -#include "Queue_impl/BlockingQueue.h" 1.8 +#include "Queue_impl/PrivateQueue.h" 1.9 #include "Histogram/Histogram.h" 1.10 #include "DynArray/DynArray.h" 1.11 #include "Hash_impl/PrivateHash.h" 1.12 @@ -22,28 +22,36 @@ 1.13 1.14 1.15 //=============================== Debug =================================== 1.16 - //These defines turn types of bug messages on and off 1.17 -#define dbgProbes FALSE 1.18 -#define dbgAppFlow FALSE 1.19 - 1.20 +// 1.21 //When SEQUENTIAL is defined, VMS does sequential exe in the main thread 1.22 // It still does co-routines and all the mechanisms are the same, it just 1.23 // has only a single thread and animates VPs one at a time 1.24 //#define SEQUENTIAL 1.25 1.26 +//#define USE_WORK_STEALING 1.27 + 1.28 //turns on the probe-instrumentation in the application -- when not 1.29 // defined, the calls to the probe functions turn into comments 1.30 #define STATS__ENABLE_PROBES 1.31 1.32 + //These defines turn types of bug messages on and off 1.33 + // be sure debug messages are un-commented (next block of defines) 1.34 +#define dbgProbes FALSE /* for issues inside probes themselves*/ 1.35 +#define dbgAppFlow TRUE /* Top level flow of application code -- general*/ 1.36 +#define dbgB2BMaster FALSE/* in coreloop, back to back master VPs*/ 1.37 +#define dbgRqstHdlr FALSE /* in request handler code*/ 1.38 1.39 -#define DEBUG(msg)// printf(msg); fflush(stdin); 1.40 -#define DEBUG_MSG( bool, msg) //if( bool){ printf(msg); fflush(stdin);} 1.41 -#define PRINT1_DEBUG(msg, param) //printf(msg, param); fflush(stdin); 1.42 -#define PRINT2_DEBUG(msg, p1, p2) //printf(msg, p1, p2); fflush(stdin); 1.43 + //Comment or un- the substitute half to turn on/off types of debug message 1.44 +#define DEBUG( bool, msg) \ 1.45 + if( bool){ printf(msg); fflush(stdin);} 1.46 +#define DEBUG1( bool, msg, param) \ 1.47 + if(bool){printf(msg, param); fflush(stdin);} 1.48 +#define DEBUG2( bool, msg, p1, p2) \ 1.49 + //if(bool) {printf(msg, p1, p2); fflush(stdin);} 1.50 1.51 -#define PRINT_ERROR(msg) printf(msg); fflush(stdin); 1.52 -#define PRINT1_ERROR(msg, param) printf(msg, param); fflush(stdin); 1.53 -#define PRINT2_ERROR(msg, p1, p2) printf(msg, p1, p2); fflush(stdin); 1.54 +#define ERROR(msg) printf(msg); fflush(stdin); 1.55 +#define ERROR1(msg, param) printf(msg, param); fflush(stdin); 1.56 +#define ERROR2(msg, p1, p2) printf(msg, p1, p2); fflush(stdin); 1.57 1.58 //=========================== STATS ======================= 1.59 1.60 @@ -56,6 +64,8 @@ 1.61 #define MEAS__TIME_MASTER 1.62 #define MEAS__NUM_TIMES_TO_RUN 100000 1.63 1.64 + //For code that calculates normalization-offset between TSC counts of 1.65 + // different cores. 1.66 #define NUM_TSC_ROUND_TRIPS 10 1.67 1.68 1.69 @@ -64,8 +74,9 @@ 1.70 // machine 1.71 #define NUM_CORES 4 1.72 1.73 - // balance amortizing master fixed overhead vs imbalance potential 1.74 -#define NUM_SCHED_SLOTS 3 1.75 + // tradeoff amortizing master fixed overhead vs imbalance potential 1.76 + // when work-stealing, can make bigger, at risk of losing cache affinity 1.77 +#define NUM_SCHED_SLOTS 5 1.78 1.79 #define MIN_WORK_UNIT_CYCLES 20000 1.80 1.81 @@ -82,10 +93,11 @@ 1.82 1.83 #define SUCCESS 0 1.84 1.85 -#define writeVMSQ writeSRSWQ 1.86 -#define readVMSQ readSRSWQ 1.87 -#define makeVMSQ makeSRSWQ 1.88 -#define VMSQueueStruc SRSWQueueStruc 1.89 +#define writeVMSQ writePrivQ 1.90 +#define readVMSQ readPrivQ 1.91 +#define makeVMSQ makePrivQ 1.92 +#define numInVMSQ numInPrivQ 1.93 +#define VMSQueueStruc PrivQueueStruc 1.94 1.95 1.96 1.97 @@ -96,6 +108,8 @@ 1.98 typedef struct _VMSReqst VMSReqst; 1.99 typedef struct _VirtProcr VirtProcr; 1.100 typedef struct _IntervalProbe IntervalProbe; 1.101 +typedef struct _GateStruc GateStruc; 1.102 + 1.103 1.104 typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx 1.105 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv 1.106 @@ -190,7 +204,7 @@ 1.107 RequestHandler requestHandler; 1.108 1.109 SchedSlot ***allSchedSlots; 1.110 - SRSWQueueStruc **readyToAnimateQs; 1.111 + VMSQueueStruc **readyToAnimateQs; 1.112 VirtProcr **masterVPs; 1.113 1.114 void *semanticEnv; 1.115 @@ -205,6 +219,9 @@ 1.116 int32 masterLock; 1.117 1.118 int32 numMasterInARow[NUM_CORES];//detect back-to-back masterVP 1.119 + GateStruc **workStealingGates[ NUM_CORES ]; //concurrent work-steal 1.120 + int32 workStealingLock; 1.121 + 1.122 int32 numProcrsCreated; //gives ordering to processor creation 1.123 1.124 //=========== MEASUREMENT STUFF ============= 1.125 @@ -216,13 +233,21 @@ 1.126 } 1.127 MasterEnv; 1.128 1.129 -//============================= 1.130 +//========================= Extra Stuff Data Strucs ======================= 1.131 typedef struct 1.132 { 1.133 1.134 } 1.135 VMSExcp; 1.136 1.137 +struct _GateStruc 1.138 + { 1.139 + int32 gateClosed; 1.140 + int32 preGateProgress; 1.141 + int32 waitProgress; 1.142 + int32 exitProgress; 1.143 + }; 1.144 +//GateStruc 1.145 1.146 //======================= OS Thread related =============================== 1.147 1.148 @@ -342,6 +367,7 @@ 1.149 ); 1.150 //===== 1.151 1.152 +#include "SwitchAnimators.h" 1.153 #include "probes.h" 1.154 1.155 #endif /* _VMS_H */
