Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Compute.C

Go to the documentation of this file.
00001 
00007 /*
00008    Top of Compute hierarchy.  
00009    enqueueWork() - delivers Compute object itself to queue up for doWork()
00010    doWork() - called by work queue
00011 */
00012 
00013 #include "main.h"
00014 #include "charm++.h"
00015 
00016 #include "WorkDistrib.decl.h"
00017 #include "WorkDistrib.h"
00018 
00019 #include "NamdTypes.h"
00020 #include "Box.h"
00021 #include "OwnerBox.h"
00022 
00023 #include "Node.h"
00024 #include "Compute.h"
00025 #include "Priorities.h"
00026 
00027 #define MIN_DEBUG_LEVEL 4
00028 // #define DEBUGM
00029 #include "Debug.h"
00030 
00031 
00032 Compute::Compute(ComputeID c) : basePriority(0), cid(c),
00033         localWorkMsg(new (PRIORITY_SIZE) LocalWorkMsg) { 
00034   doAtomUpdate = false;
00035   computeType = ComputeMap::Object()->type(c);
00036 }
00037 
00038 Compute::~Compute() {
00039   delete localWorkMsg;
00040 }
00041 
00042 void Compute::enqueueWork() {
00043   if (!this) { DebugM(4,"This Compute is NULL!!!\n"); }
00044   if ( ! noWork() )
00045   {
00046     WorkDistrib::messageEnqueueWork(this);  // should be in ComputeMgr?
00047   }
00048 }
00049 
00050 //---------------------------------------------------------------------
00051 // Signal from patch or proxy that data is ready.
00052 // When all Patches and Proxies needed by this Compute object
00053 // have checked-in, we are ready to enqueueWork()
00054 //---------------------------------------------------------------------
00055 void Compute::patchReady(PatchID patchID, int doneMigration, int seq) { 
00056   if (doneMigration) { // If any patch has done migration - we must remap
00057     doAtomUpdate = true; 
00058   }
00059   sequenceNumber = seq;
00060 
00061   if (numPatches <= 0) {
00062       DebugM(5,"Compute::patchReady("<<patchID<<")-call not valid!\n");
00063   } else {
00064     if (! --patchReadyCounter) {
00065       patchReadyCounter = numPatches;
00066       if (doAtomUpdate) {
00067         atomUpdate();
00068         doAtomUpdate = false;
00069       }
00070       enqueueWork();
00071     }
00072   }
00073 }
00074 
00075 
00076 int Compute::noWork() {
00077   return 0;
00078 }
00079 
00080 void Compute::doWork() {
00081     DebugM(5,"Default Compute::doWork() called.\n");
00082 }
00083 

Generated on Thu Jul 24 04:07:39 2008 for NAMD by  doxygen 1.3.9.1