#include <ComputeMap.h>
Public Types | |
| enum | { numPidsAllocated = 8 } |
Public Member Functions | |
| void | checkMap () |
| ~ComputeMap (void) | |
| void | registerCompute (ComputeID cid, Compute *c) |
| int | numComputes (void) |
| int | node (ComputeID cid) |
| void | setNode (ComputeID cid, NodeID node) |
| NodeID | newNode (ComputeID cid) |
| void | setNewNode (ComputeID cid, NodeID node) |
| int | numPids (ComputeID cid) |
| int | pid (ComputeID cid, int i) |
| int | trans (ComputeID cid, int i) |
| ComputeType | type (ComputeID cid) |
| int | partition (ComputeID cid) |
| int | numPartitions (ComputeID cid) |
| void | setNumPartitions (ComputeID cid, char numPartitions) |
| char | newNumPartitions (ComputeID cid) |
| void | setNewNumPartitions (ComputeID cid, char numPartitions) |
| int | allocateCids () |
| ComputeID | storeCompute (int node, int maxPids, ComputeType type, int partition=-1, int numPartitions=0) |
| void | newPid (ComputeID cid, int pid, int trans=13) |
| ComputeID | cloneCompute (ComputeID src, int partition) |
| void | printComputeMap (void) |
| void | saveComputeMap (const char *fname) |
| void | loadComputeMap (const char *fname) |
| Compute * | compute (ComputeID cid) |
Static Public Member Functions | |
| ComputeMap * | Instance () |
| ComputeMap * | Object () |
Protected Member Functions | |
| void | pack (ComputeData *buf) |
| void | unpack (int n, ComputeData *buf) |
| void | initPtrs () |
| void | extendPtrs () |
| ComputeMap (void) | |
Friends | |
| class | ComputeMgr |
| class | WorkDistrib |
|
|
Definition at line 163 of file ComputeMap.h. 00163 { numPidsAllocated=8 };
|
|
|
Definition at line 39 of file ComputeMap.C. 00040 {
00041 delete [] computePtrs;
00042 }
|
|
|
Definition at line 32 of file ComputeMap.C. 00033 {
00034 nComputes=0;
00035 computePtrs=0;
00036 }
|
|
|
Definition at line 140 of file ComputeMap.C. References ResizeArray< Elem >::resize(). Referenced by WorkDistrib::mapComputes(). 00141 {
00142 nComputes = 0;
00143 computeData.resize(500);
00144 computeData.resize(0);
00145
00146 return 0;
00147 }
|
|
|
Definition at line 45 of file ComputeMap.C. References Compute::cid, and DebugM. Referenced by ComputeMgr::updateLocalComputes5(). 00046 {
00047 int computeCount = nComputes;
00048 for (int i=0; i<nComputes; i++) {
00049 if (computePtrs[i]) {
00050 computeCount++;
00051 if (! (computePtrs[i]->cid == i)) {
00052 DebugM(4, "ComputeID("<<computePtrs[i]->cid<<") != ComputeID("
00053 << i <<")\n");
00054 }
00055 }
00056 }
00057 DebugM(4, "Compute Count = " << computeCount << "\n");
00058 }
|
|
||||||||||||
|
Definition at line 176 of file ComputeMap.C. References ComputeID, ResizeArray< Elem >::resize(), and ResizeArray< Elem >::size(). Referenced by ComputeMgr::splitComputes(). 00177 {
00178 const int cid = computeData.size();
00179 computeData.resize(cid+1);
00180
00181 computeData[cid] = computeData[src];
00182 computeData[cid].partition = partition;
00183 computeData[cid].node = -1;
00184
00185 return cid;
00186 }
|
|
|
Definition at line 151 of file ComputeMap.h. Referenced by LdbCoordinator::initialize(), and ComputeMgr::updateLocalComputes(). 00151 { return computePtrs[cid]; };
|
|
|
Definition at line 86 of file ComputeMap.C. References NAMD_bug(), and ResizeArray< Elem >::size(). Referenced by ComputeMgr::splitComputes(). 00086 {
00087 if ( ! computePtrs ) NAMD_bug("ComputeMap::extendPtrs() 1");
00088 int oldN = nComputes;
00089 nComputes = computeData.size();
00090 if ( nComputes > oldN ) {
00091 Compute **oldPtrs = computePtrs;
00092 computePtrs = new Compute*[nComputes];
00093 memcpy(computePtrs, oldPtrs, oldN*sizeof(Compute*));
00094 memset(computePtrs+oldN, 0, (nComputes-oldN)*sizeof(Compute*));
00095 delete [] oldPtrs;
00096 }
00097 }
|
|
|
Definition at line 79 of file ComputeMap.C. Referenced by WorkDistrib::saveComputeMap(), and WorkDistrib::sendComputeMap(). 00079 {
00080 if ( ! computePtrs ) {
00081 computePtrs = new Compute*[nComputes];
00082 memset(computePtrs, 0, nComputes*sizeof(Compute*));
00083 }
00084 }
|
|
|
Definition at line 23 of file ComputeMap.C. Referenced by Node::Node(). 00023 {
00024 if (instance == 0) {
00025 instance = new ComputeMap; // this is never deleted
00026 }
00027 return instance;
00028 }
|
|
|
Definition at line 270 of file ComputeMap.C. References node(). Referenced by WorkDistrib::mapComputes(). 00271 {
00272 FILE *fp = fopen(fname, "r");
00273 CmiAssert(fp != NULL);
00274 int n;
00275 fscanf(fp, "%d\n", &n);
00276 CmiAssert(n == nComputes);
00277 for(int i=0; i < nComputes; i++)
00278 {
00279 fscanf(fp, "%d\n", &computeData[i].node);
00280 }
00281 fclose(fp);
00282 }
|
|
|
Definition at line 101 of file ComputeMap.h. References NodeID. Referenced by WorkDistrib::saveComputeMapChanges(), ComputeMgr::splitComputes(), ComputeMgr::updateLocalComputes(), and ComputeMgr::updateLocalComputes3(). 00101 {
00102 return (computeData[cid].moveToNode);
00103 }
|
|
|
Definition at line 126 of file ComputeMap.h. Referenced by WorkDistrib::saveComputeMapChanges(), ComputeMgr::splitComputes(), and ComputeMgr::updateLocalComputes(). 00126 {
00127 return (computeData[cid].newNumPartitions);
00128 }
|
|
||||||||||||||||
|
|
|
|
Definition at line 91 of file ComputeMap.h. Referenced by ProxyMgr::createProxies(), LdbCoordinator::initialize(), loadComputeMap(), Node::outputPatchComputeMaps(), printComputeMap(), saveComputeMap(), ComputeMgr::splitComputes(), and ComputeMgr::updateLocalComputes(). 00091 {
00092 return computeData[cid].node;
00093 }
|
|
|
Definition at line 86 of file ComputeMap.h. Referenced by ProxyMgr::createProxies(), dumpbench(), LdbCoordinator::initialize(), Node::outputPatchComputeMaps(), WorkDistrib::recvComputeMapChanges(), registerUserEventsForAllComputeObjs(), WorkDistrib::saveComputeMapChanges(), WorkDistrib::sendComputeMap(), ComputeMgr::splitComputes(), Node::startup(), NamdCentLB::Strategy(), ComputeMgr::updateLocalComputes(), and ComputeMgr::updateLocalComputes3(). 00086 {
00087 return nComputes;
00088 }
|
|
|
Definition at line 132 of file ComputeMap.C. Referenced by ComputeMgr::splitComputes(), and NamdCentLB::Strategy(). 00133 {
00134 if (nComputes)
00135 return computeData[cid].numPartitions;
00136 else return computeErrorType;
00137 }
|
|
|
Definition at line 100 of file ComputeMap.C. Referenced by ProxyMgr::createProxies(), LdbCoordinator::initialize(), printComputeMap(), and ComputeMgr::updateLocalComputes(). 00101 {
00102 return computeData[cid].numPids;
00103 }
|
|
|
|
Definition at line 60 of file ComputeMap.C. References ResizeArray< Elem >::begin(), and DebugM. Referenced by WorkDistrib::sendComputeMap(). 00061 {
00062 DebugM(4,"Packing ComputeMap\n");
00063 memcpy(buffer, computeData.begin(), nComputes * sizeof(ComputeData));
00064 }
|
|
|
Definition at line 125 of file ComputeMap.C. Referenced by dumpbench(). 00126 {
00127 if (nComputes)
00128 return computeData[cid].partition;
00129 else return computeErrorType;
00130 }
|
|
||||||||||||
|
Definition at line 106 of file ComputeMap.C. Referenced by ProxyMgr::createProxies(), dumpbench(), LdbCoordinator::initialize(), Node::outputPatchComputeMaps(), printComputeMap(), registerUserEventsForAllComputeObjs(), and ComputeMgr::updateLocalComputes(). 00107 {
00108 return computeData[cid].pids[i].pid;
00109 }
|
|
|
Definition at line 197 of file ComputeMap.C. References DebugM, j, node(), numPids(), pid(), and type(). 00198 {
00199 DebugM(2,"---------------------------------------");
00200 DebugM(2,"---------------------------------------\n");
00201
00202 DebugM(2,"nComputes = " << nComputes << '\n');
00203 DebugM(2,"nAllocated = " << nComputes << '\n');
00204 for(int i=0; i < nComputes; i++)
00205 {
00206 DebugM(2,"Compute " << i << '\n');
00207 DebugM(2," node = " << computeData[i].node << '\n');
00208 DebugM(2," numPids = " << computeData[i].numPids << '\n');
00209 for(int j=0; j < computeData[i].numPids; j++)
00210 {
00211 DebugM(2,computeData[i].pids[j].pid);
00212 if (!((j+1) % 6))
00213 DebugM(2,'\n');
00214 }
00215 DebugM(2,"\n---------------------------------------");
00216 DebugM(2,"---------------------------------------\n");
00217
00218 }
00219
00220 char *fname;
00221 #ifdef MEM_OPT_VERSION
00222 fname = "computeMap.opt";
00223 #else
00224 fname = "computeMap.orig";
00225 #endif
00226
00227 FILE *ofp = fopen(fname, "w");
00228 fprintf(ofp,"---------------------------------------");
00229 fprintf(ofp,"---------------------------------------\n");
00230
00231 fprintf(ofp,"nComputes = %d\n", nComputes);
00232 fprintf(ofp,"nAllocated = %d\n", nComputes);
00233 for(int i=0; i < nComputes; i++)
00234 {
00235 fprintf(ofp,"Compute %d\n", i);
00236 fprintf(ofp," node = %d\n",computeData[i].node);
00237 fprintf(ofp," numPids = %d\n",computeData[i].numPids);
00238 fprintf(ofp," type = %d\n",computeData[i].type);
00239 for(int j=0; j < computeData[i].numPids; j++)
00240 {
00241 fprintf(ofp,"%d ",computeData[i].pids[j].pid);
00242 if (!((j+1) % 6))
00243 fprintf(ofp,"\n");
00244 }
00245 fprintf(ofp,"\n---------------------------------------");
00246 fprintf(ofp,"---------------------------------------\n");
00247
00248 }
00249
00250 fclose(ofp);
00251
00252 }
|
|
||||||||||||
|
Definition at line 80 of file ComputeMap.h. Referenced by ComputeMgr::updateLocalComputes(). 00080 {
00081 computePtrs[cid] = c;
00082 }
|
|
|
Definition at line 254 of file ComputeMap.C. References node(). Referenced by WorkDistrib::mapComputes(), WorkDistrib::saveComputeMap(), WorkDistrib::sendComputeMap(), and ComputeMgr::updateLocalComputes4(). 00255 {
00256 static int count = 0;
00257 char f[128];
00258 sprintf(f, "%s.%d", fname, count++);
00259 FILE *fp = fopen(f, "w");
00260 CmiAssert(fp != NULL);
00261 fprintf(fp, "%d\n", nComputes);
00262 for(int i=0; i < nComputes; i++)
00263 {
00264 fprintf(fp, "%d\n", computeData[i].node);
00265 }
00266 fclose(fp);
00267 CkPrintf("ComputeMap has been stored in %s.\n", f);
00268 }
|
|
||||||||||||
|
Definition at line 105 of file ComputeMap.h. Referenced by WorkDistrib::recvComputeMapChanges(), ComputeMgr::splitComputes(), NamdCentLB::Strategy(), ComputeMgr::updateLocalComputes3(), and NamdHybridLB::UpdateLocalLBInfo(). 00105 {
00106 computeData[cid].moveToNode = node;
00107 }
|
|
||||||||||||
|
Definition at line 129 of file ComputeMap.h. Referenced by WorkDistrib::recvComputeMapChanges(), ComputeMgr::splitComputes(), NamdCentLB::Strategy(), and ComputeMgr::updateLocalComputes3(). 00129 {
00130 computeData[cid].newNumPartitions = numPartitions;
00131 }
|
|
||||||||||||
|
Definition at line 95 of file ComputeMap.h. Referenced by ComputeMgr::updateLocalComputes3(). 00095 {
00096 computeData[cid].node = node;
00097 }
|
|
||||||||||||
|
Definition at line 123 of file ComputeMap.h. Referenced by ComputeMgr::splitComputes(). 00123 {
00124 computeData[cid].numPartitions = numPartitions;
00125 }
|
|
||||||||||||||||||||||||
|
Definition at line 150 of file ComputeMap.C. References ComputeID, NAMD_bug(), and ResizeArray< Elem >::resize(). 00153 {
00154 if (maxPids > numPidsAllocated) {
00155 NAMD_bug("ComputeMap::storeCompute called with maxPids > numPidsAllocated");
00156 }
00157
00158 int cid;
00159
00160 cid = nComputes;
00161 nComputes++;
00162 computeData.resize(nComputes);
00163
00164 computeData[cid].node=inode;
00165
00166 computeData[cid].type = type;
00167 computeData[cid].partition = partition;
00168 computeData[cid].numPartitions = numPartitions;
00169
00170 computeData[cid].numPids = 0;
00171
00172 return cid;
00173 }
|
|
||||||||||||
|
Definition at line 111 of file ComputeMap.C. Referenced by dumpbench(), and registerUserEventsForAllComputeObjs(). 00112 {
00113 return computeData[cid].pids[i].trans;
00114 }
|
|
|
Definition at line 117 of file ComputeMap.C. References ComputeType. Referenced by Compute::Compute(), ComputeMgr::createComputes(), ProxyMgr::createProxies(), dumpbench(), LdbCoordinator::initialize(), Node::outputPatchComputeMaps(), printComputeMap(), and registerUserEventsForAllComputeObjs(). 00118 {
00119 if (nComputes)
00120 return computeData[cid].type;
00121 else return computeErrorType;
00122 }
|
|
||||||||||||
|
Definition at line 66 of file ComputeMap.C. References ResizeArray< Elem >::begin(), DebugM, NAMD_bug(), and ResizeArray< Elem >::resize(). Referenced by WorkDistrib::saveComputeMap(). 00067 {
00068 DebugM(4,"Unpacking ComputeMap\n");
00069
00070 if ( nComputes && n != nComputes ) {
00071 NAMD_bug("number of computes in new ComputeMap has changed!\n");
00072 }
00073
00074 nComputes = n;
00075 computeData.resize(nComputes);
00076 memcpy(computeData.begin(), ptr, nComputes * sizeof(ComputeData));
00077 }
|
|
|
Definition at line 153 of file ComputeMap.h. |
|
|
Definition at line 182 of file ComputeMap.h. |
1.3.9.1