changeset 5:833c981134dd SingleMaster

Two versions -- normal and sequential for debugging
author Me
date Mon, 09 Aug 2010 02:29:31 -0700
parents b7a974ccc6f4
children 98fd084badde 7fd2b56b5694
files VMSHW_Request_Handlers.c VMSHW_lib.c
diffstat 2 files changed, 31 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/VMSHW_Request_Handlers.c	Wed Jul 28 13:16:31 2010 -0700
     1.2 +++ b/VMSHW_Request_Handlers.c	Mon Aug 09 02:29:31 2010 -0700
     1.3 @@ -95,8 +95,8 @@
     1.4      {    //waiting request is another send, so stack this up on list
     1.5        semReq->    nextReqInHashEntry = waitingReq->nextReqInHashEntry;
     1.6        waitingReq->nextReqInHashEntry = semReq;
     1.7 -      printf("linked requests: %d, %d  |  ", semReq, waitingReq );
     1.8 -      printf("type: %d, %d\n", semReq->reqType, waitingReq->reqType );
     1.9 +         //printf("linked requests: %d, %d  |  ", semReq, waitingReq );
    1.10 +         //printf("type: %d, %d\n", semReq->reqType, waitingReq->reqType );
    1.11        return;
    1.12      }
    1.13     else
     2.1 --- a/VMSHW_lib.c	Wed Jul 28 13:16:31 2010 -0700
     2.2 +++ b/VMSHW_lib.c	Mon Aug 09 02:29:31 2010 -0700
     2.3 @@ -17,7 +17,13 @@
     2.4  //==========================================================================
     2.5  
     2.6  void
     2.7 +VMSHW__init();
     2.8 +
     2.9 +void
    2.10  VMSHW__init_Seq();
    2.11 +
    2.12 +void
    2.13 +VMSHW__init_Helper();
    2.14  //==========================================================================
    2.15  
    2.16  
    2.17 @@ -79,13 +85,17 @@
    2.18   *When all the processors, including the seed, have dissipated, then this
    2.19   * function returns.  The results will have been written by side-effect via
    2.20   * pointers read from, or written into initData.
    2.21 + *
    2.22 + *NOTE: no Threads should exist in the outside program that might touch
    2.23 + * any of the data reachable from initData passed in to here
    2.24   */
    2.25  void
    2.26  VMSHW__create_seed_procr_and_do_work( VirtProcrFnPtr fnPtr, void *initData )
    2.27   { VMSHWSemEnv *semEnv;
    2.28     VirtProcr *seedProcr;
    2.29  
    2.30 -   VMSHW__init();
    2.31 +   VMSHW__init(); //uncomment to do multi-thd
    2.32 +//   VMSHW__init_Seq();  //uncomment to debug
    2.33  
    2.34     semEnv = _VMSMasterEnv->semanticEnv;
    2.35  
    2.36 @@ -96,10 +106,8 @@
    2.37     writePrivQ( seedProcr, semEnv->readyVirtProcrQ );
    2.38     semEnv->numVirtPr = 1;
    2.39  
    2.40 -      //NOTE: no Threads should exist in the outside program that might touch
    2.41 -      // any of the data reachable from initData given to the seed procr
    2.42 -//   VMS__start_the_work_then_wait_until_done();
    2.43 -   VMS__start_the_work_then_wait_until_done_Seq();
    2.44 +   VMS__start_the_work_then_wait_until_done();   //uncomment to do multi-thd
    2.45 +//   VMS__start_the_work_then_wait_until_done_Seq();  //uncomment to debug
    2.46  
    2.47     VMSHW__cleanup_after_shutdown();
    2.48   }
    2.49 @@ -118,12 +126,26 @@
    2.50   */
    2.51  void
    2.52  VMSHW__init()
    2.53 - { VMSHWSemEnv *semanticEnv;
    2.54 + {
    2.55 +   VMS__init();
    2.56 +      //masterEnv, a global var, now is partially set up by init_VMS
    2.57  
    2.58 -//   VMS__init();
    2.59 +   VMSHW__init_Helper();
    2.60 + }
    2.61 +
    2.62 +void
    2.63 +VMSHW__init_Seq()
    2.64 + {
    2.65     VMS__init_Seq();
    2.66        //masterEnv, a global var, now is partially set up by init_VMS
    2.67  
    2.68 +   VMSHW__init_Helper();
    2.69 + }
    2.70 +
    2.71 +void
    2.72 +VMSHW__init_Helper()
    2.73 + { VMSHWSemEnv *semanticEnv;
    2.74 + 
    2.75        //Hook up the semantic layer's plug-ins to the Master virt procr
    2.76     _VMSMasterEnv->requestHandler = &VMSHW__Request_Handler;
    2.77     _VMSMasterEnv->slaveScheduler = &VMSHW__schedule_virt_procr;