template<class collectionT>
Function selects the items in an STL collection (vector, deque, list) that this node should process. Assumes that the nodes working parallel will try to share the elements in the collection equal amongst themselves. Type collectionT is asusmed to implement erase, size, begin and end (see Util::SubSelectInPlace) Definition at line 22 of file SelectWorkLoadInPlace.h. References ILOG_VAR, and Impala::Util::SubSelectInPlace(). Referenced by Impala::Application::TrainModel(). 00023 { 00024 ILOG_VAR(Util.Mpi.SelectWorkLoad); 00025 int numProcs = Link::Mpi::NrProcs(); 00026 // MvL: I copied the name lastConcept from existing code, but the name is 00027 // misleading: it is the first index *after* the vector. 00028 int lastConcept = collection->size(); 00029 int taskSize = lastConcept / numProcs; 00030 int restSize = lastConcept % numProcs; 00031 int curConcept = 0; 00032 int start; 00033 int number; 00034 for (int i=0 ; i<numProcs ; i++) 00035 { 00036 start = curConcept; 00037 number = taskSize; 00038 if (--restSize >= 0) 00039 number++; 00040 /* this test was in original code, it can never succeed (I think) 00041 because taskSize * numProc + restSize = lastConcept. Apart form that 00042 the body of the origin test was wrong 00043 if (start + number > lastConcept) 00044 number = lastConcept - start; 00045 */ 00046 curConcept += number; 00047 if (i == Link::Mpi::MyId()) 00048 break; 00049 } 00050 if (start >= lastConcept) 00051 { 00052 // MvL: I think this test can never succeed. 00053 ILOG_WARNING_NODE("more nodes than concepts: nothing to do"); 00054 start = 0; 00055 number = 0; 00056 } 00057 Util::SubSelectInPlace(collection, start, number); 00058 }
Here is the call graph for this function:
|