src/vcfr_thread.cpp
// Divide work at a street-initial node between multiple threads.  Spawns
// the threads, joins them, aggregates the resulting CVs.
// Ugly that we pass prev_canons in.
Divide work at a street-initial node between multiple threads.  Spawns
the threads, joins them, aggregates the resulting CVs.
Ugly that we pass prev_canons in.
Divide work at a street - initial node between multiple threads . Spawns the threads joins them aggregates the resulting CVs . Ugly that we pass prev_canons in .
void VCFR::Split(Node *p0_node, Node *p1_node, int pgbd, const VCFRState &state, int *prev_canons,
		 double *vals) {
  int nst = p0_node->Street();
  int pst = nst - 1;
  int prev_num_hole_card_pairs = Game::NumHoleCardPairs(pst);
  for (int i = 0; i < prev_num_hole_card_pairs; ++i) vals[i] = 0;
  unique_ptr<unique_ptr<VCFRThread> []> threads(new unique_ptr<VCFRThread>[num_threads_]);
  for (int t = 0; t < num_threads_; ++t) {
    threads[t].reset(new VCFRThread(this, t, num_threads_, p0_node, p1_node, pgbd, state,
				    prev_canons));
  }
  for (int t = 1; t < num_threads_; ++t) {
    threads[t]->Run();
  }
  threads[0]->Go();
  for (int t = 1; t < num_threads_; ++t) {
    threads[t]->Join();
  }
  for (int t = 0; t < num_threads_; ++t) {
    shared_ptr<double []> t_vals = threads[t]->RetVals();
    for (int i = 0; i < prev_num_hole_card_pairs; ++i) {
      vals[i] += t_vals[i];
    }
  }
}
void VCFR :: Split ( Node * p0_node , Node * p1_node , int pgbd , const VCFRState & state , int * prev_canons , double * vals ) { int nst = p0_node -> Street ( ) ; int pst = nst - 1 ; int prev_num_hole_card_pairs = Game :: NumHoleCardPairs ( pst ) ; for ( int i = 0 ; i < prev_num_hole_card_pairs ; ++ i ) vals [ i ] = 0 ; unique_ptr < unique_ptr < VCFRThread > [ ] > threads ( new unique_ptr < VCFRThread > [ num_threads_ ] ) ; for ( int t = 0 ; t < num_threads_ ; ++ t ) { threads [ t ] . reset ( new VCFRThread ( this , t , num_threads_ , p0_node , p1_node , pgbd , state , prev_canons ) ) ; } for ( int t = 1 ; t < num_threads_ ; ++ t ) { threads [ t ] -> Run ( ) ; } threads [ 0 ] -> Go ( ) ; for ( int t = 1 ; t < num_threads_ ; ++ t ) { threads [ t ] -> Join ( ) ; } for ( int t = 0 ; t < num_threads_ ; ++ t ) { shared_ptr < double [ ] > t_vals = threads [ t ] -> RetVals ( ) ; for ( int i = 0 ; i < prev_num_hole_card_pairs ; ++ i ) { vals [ i ] += t_vals [ i ] ; } } }
Divide work at a street-initial node between multiple threads.
Divide work at a street - initial node between multiple threads .
// Do first thread in main thread