Definition at line 197 of file ParameterSearcher.h. References Impala::Util::PropertySet::Add(), Impala::Util::Mpi::JobManager::CreateGroup(), Impala::Util::PropertySet::GetDescription(), Impala::Util::PropertySet::GetInt(), Impala::Util::Mpi::JobManager::GetJob(), Impala::Util::PropertySet::GetString(), Impala::Util::RangeIterator::GetTotalIterations(), mIterator, and mProperties. Referenced by SearchParallel(). 00198 { 00199 ILOG_DEBUG_NODE("I am the server"); 00200 // create job groups 00201 Util::Mpi::JobManager jobManager; 00202 int f; 00203 for(f=0 ; f<mProperties.GetInt("folds") ; ++f) 00204 { 00205 int r; 00206 for(r=0 ; r<mProperties.GetInt("repetitions") ; ++r) 00207 { 00208 std::string id("r0f0"); 00209 id[1] = '0'+r; 00210 id[3] = '0'+f; 00211 Util::PropertySet ps; 00212 ps.Add("repetition", r); 00213 ps.Add("fold", f); 00214 // maybe we shouldn't create a group with a description, but 00215 // rather with the properties themselves 00216 jobManager.CreateGroup(ps.GetDescription(), id, 00217 mIterator.GetTotalIterations()); 00218 } 00219 } 00220 00221 // handle request from clients until all work is done 00222 bool done=false; 00223 int runningJobs=0; 00224 while(true) 00225 { 00226 //receive request for work 00227 int source; 00228 std::string message = Link::Mpi::ReceiveString(source); 00229 ILOG_DEBUG_NODE("server got mssg: " << message); 00230 Util::PropertySet job(message); 00231 if(job.GetString("JobManager::job-id") != "-1") 00232 --runningJobs; 00233 //pick a job from a group 00234 jobManager.GetJob(&job); 00235 //send job 00236 if(job.GetString("JobManager::job-id") != "-1") 00237 ++runningJobs; 00238 std::ostringstream oss; 00239 job.Print(oss); 00240 ILOG_DEBUG_NODE("SERVER: sending job assignment " << 00241 job.GetString("JobManager::job-id") << "," << 00242 job.GetString("JobManager::group-id") << " to " << source); 00243 Link::Mpi::SendString(oss.str(), source); 00244 if(runningJobs == 0) 00245 break; 00246 } 00247 }
Here is the call graph for this function:
|