MCPcopy Create free account
hub / github.com/Gecode/gecode / pbspar

Function pbspar

gecode/search/pbs.hpp:154–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153 template<class T, template<class> class E>
154 Engine*
155 pbspar(T* master, const Search::Statistics& stat, Options& opt) {
156 Stop* stop = opt.stop;
157 Region r;
158
159 // Limit the number of slaves to the number of threads
160 unsigned int n_slaves = std::min(static_cast<unsigned int>(opt.threads),
161 opt.assets);
162 // Redistribute additional threads to slaves
163 opt.threads = floor(opt.threads / static_cast<double>(n_slaves));
164
165 WrapTraceRecorder::engine(opt.tracer,
166 SearchTracer::EngineType::PBS, n_slaves);
167
168 Engine** slaves = r.alloc<Engine*>(n_slaves);
169 Stop** stops = r.alloc<Stop*>(n_slaves);
170
171 for (unsigned int i=0U; i<n_slaves; i++) {
172 opt.stop = stops[i] = Par::pbsstop(stop);
173 Space* slave = (i == n_slaves-1) ?
174 master : master->clone();
175 (void) slave->slave(static_cast<unsigned int>(i));
176 slaves[i] = build<T,E>(slave,opt);
177 }
178
179 return Par::pbsengine(slaves,stops,n_slaves,stat,E<T>::best);
180 }
181
182 template<class T, template<class> class E>
183 Engine*

Callers

nothing calls this directly

Calls 6

pbsstopFunction · 0.85
pbsengineFunction · 0.85
minFunction · 0.50
cloneMethod · 0.45
slaveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected