| 92 | |
| 93 | template<class T, template<class> class E> |
| 94 | Engine* |
| 95 | pbsseq(T* master, const Search::Statistics& stat, Options& opt) { |
| 96 | Stop* stop = opt.stop; |
| 97 | Region r; |
| 98 | |
| 99 | // In case there are more threads than assets requested |
| 100 | opt.threads = std::max(floor(opt.threads / |
| 101 | static_cast<double>(opt.assets)),1.0); |
| 102 | |
| 103 | unsigned int n_slaves = opt.assets; |
| 104 | Engine** slaves = r.alloc<Engine*>(n_slaves); |
| 105 | Stop** stops = r.alloc<Stop*>(n_slaves); |
| 106 | |
| 107 | WrapTraceRecorder::engine(opt.tracer, |
| 108 | SearchTracer::EngineType::PBS, n_slaves); |
| 109 | |
| 110 | for (unsigned int i=0U; i<n_slaves; i++) { |
| 111 | opt.stop = stops[i] = Seq::pbsstop(stop); |
| 112 | Space* slave = (i == n_slaves-1) ? |
| 113 | master : master->clone(); |
| 114 | (void) slave->slave(i); |
| 115 | slaves[i] = build<T,E>(slave,opt); |
| 116 | } |
| 117 | |
| 118 | return Seq::pbsengine(slaves,stops,n_slaves,stat,opt,E<T>::best); |
| 119 | } |
| 120 | |
| 121 | template<class T, template<class> class E> |
| 122 | Engine* |