00001
00007
00008
00009
00010
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
00029 #include "Debug.h"
00030
00031 Compute::Compute(ComputeID c) : gbisPhase(1),basePriority(0), cid(c),
00032 localWorkMsg(new (PRIORITY_SIZE) LocalWorkMsg) {
00033 gbisPhasePriority[0] = 0;
00034 gbisPhasePriority[1] = 0;
00035 gbisPhasePriority[2] = 0;
00036 doAtomUpdate = false;
00037 computeType = ComputeMap::Object()->type(c);
00038 ldObjHandle.id.id[0] = -1;
00039 }
00040
00041 Compute::~Compute() {
00042 delete localWorkMsg;
00043 }
00044
00045 void Compute::enqueueWork() {
00046 if (!this) { DebugM(4,"This Compute is NULL!!!\n"); }
00047 if ( ! noWork() ) {
00048
00049 WorkDistrib::messageEnqueueWork(this);
00050 } else {
00051
00052 }
00053 }
00054
00055
00056
00057
00058
00059
00060
00061 void Compute::patchReady(PatchID patchID, int doneMigration, int seq) {
00062 if (doneMigration) {
00063 doAtomUpdate = true;
00064 }
00065
00066 if (numPatches <= 0) {
00067 DebugM(5,"Compute::patchReady("<<patchID<<")-call not valid!\n");
00068 } else {
00069 if (! --patchReadyCounter) {
00070 patchReadyCounter = numPatches;
00071
00072 sequenceNumber = seq;
00073 if (doAtomUpdate) {
00074 atomUpdate();
00075 doAtomUpdate = false;
00076 }
00077 enqueueWork();
00078 }
00079 }
00080 }
00081
00082 void Compute::gbisP2PatchReady(PatchID pid, int seq) {
00083
00084 if (! --patchReadyCounter) {
00085 patchReadyCounter = numPatches;
00086
00087 sequenceNumber = seq;
00088 enqueueWork();
00089 }
00090 }
00091
00092 void Compute::gbisP3PatchReady(PatchID pid, int seq) {
00093 if (! --patchReadyCounter) {
00094 patchReadyCounter = numPatches;
00095
00096 sequenceNumber = seq;
00097 enqueueWork();
00098 }
00099 }
00100
00101
00102 int Compute::noWork() {
00103 return 0;
00104 }
00105
00106 void Compute::doWork() {
00107 DebugM(5,"Default Compute::doWork() called.\n");
00108 }
00109