00001 // File: seq.C 00002 // Module for sequential simulation strategy class 00003 #include "pose.h" 00004 00005 void seq::Step() { 00006 00007 // execute event if checkpointing is not in progress or if the 00008 // timestamp is before the GVT at which a checkpoint is occurring 00009 if ((eq->currentPtr->timestamp < seqLastCheckpointGVT) || (!seqCheckpointInProgress)) { 00010 00011 Event *ev; 00012 // Prepare to execute an event 00013 ev = eq->currentPtr; 00014 currentEvent = ev; 00015 if (ev->timestamp < POSE_GlobalTS) 00016 CkPrintf("WARNING: SEQUENTIAL POSE BUG! Event timestamp %d is less than a previous one! This is due to stupid Charm++ Scheduler implementation and needs to be fixed.\n", ev->timestamp); 00017 POSE_GlobalTS = ev->timestamp; 00018 parent->ResolveFn(ev->fnIdx, ev->msg); // execute it 00019 if (userObj->OVT() > POSE_GlobalClock) 00020 POSE_GlobalClock = userObj->OVT(); 00021 ev->done = 1; 00022 eq->ShiftEvent(); // move on to next event 00023 eq->CommitDoneEvents(parent); 00024 00025 // checkpoint if appropriate 00026 if ((userObj->myHandle == 0) && (seqCheckpointInProgress == 0) && (POSE_GlobalClock > 0) && 00027 (((pose_config.checkpoint_gvt_interval > 0) && (POSE_GlobalClock >= (seqLastCheckpointGVT + pose_config.checkpoint_gvt_interval))) || 00028 ((pose_config.checkpoint_time_interval > 0) && 00029 ((CmiWallTimer() + seqStartTime) >= (seqLastCheckpointTime + (double)pose_config.checkpoint_time_interval))))) { 00030 // start quiescence detection on the sim chare 00031 seqCheckpointInProgress = 1; 00032 seqLastCheckpointGVT = POSE_GlobalClock; 00033 seqLastCheckpointTime = CmiWallTimer() + seqStartTime; 00034 } 00035 00036 } else { 00037 00038 // if in the process of checkpointing, store info so Step() can be 00039 // called for this event on restart/resume 00040 Skipped_Event se; 00041 se.simIndex = userObj->myHandle; 00042 se.timestamp = eq->tsOfLastInserted; 00043 00044 // store skipped event 00045 POSE_Skipped_Events.enq(se); 00046 00047 } 00048 00049 }