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