src/run_approx_rgbr.cpp
// In VCFR what we are multithreading is the inner loop of street initial.  It's a bit ugly.
// We need to pass in pred_canons, we need to weight by board_variants.  Is there a better way
// to divide work?  Maybe not.
In VCFR what we are multithreading is the inner loop of street initial.  It's a bit ugly.
We need to pass in pred_canons, we need to weight by board_variants.  Is there a better way
to divide work.  Maybe not.
In VCFR what we are multithreading is the inner loop of street initial . It ' s a bit ugly . We need to pass in pred_canons we need to weight by board_variants . Is there a better way to divide work . Maybe not .
shared_ptr<double []> PreResponder::Split(Node *p0_node, Node *p1_node,
					  const ReachProbs &reach_probs, int pbd,
					  const string &action_sequence,
					  int *total_num_samples) {
  unique_ptr<unique_ptr<PreResponder> []> children(
					   new unique_ptr<PreResponder>[num_threads_]);
  for (int t = 0; t < num_threads_; ++t) {
    children[t].reset(new PreResponder(card_abstraction_, betting_abstraction_, cfr_config_,
				       buckets_, street_, resolve_, subgame_card_abstraction_,
				       subgame_betting_abstraction_, subgame_cfr_config_,
				       subgame_buckets_, num_resolve_its_, responder_p_,
				       sumprobs_, use_subgames_, trunk_hand_tree_, board_samples_,
				       has_continuation_, num_threads_, t, p0_node, p1_node, pbd,
				       action_sequence, &reach_probs));
  }
  for (int t = 1; t < num_threads_; ++t) {
    children[t]->Run();
  }
  children[0]->DoTask();
  for (int t = 1; t < num_threads_; ++t) {
    children[t]->Join();
  }
  int nst = p0_node->Street();
  int pst = nst - 1;
  int pred_num_hole_card_pairs = Game::NumHoleCardPairs(pst);
  shared_ptr<double []> vals(new double[pred_num_hole_card_pairs]);
  for (int i = 0; i < pred_num_hole_card_pairs; ++i) vals[i] = 0;
  for (int t = 0; t < num_threads_; ++t) {
    shared_ptr<double []> c_vals = children[t]->RetVals();
    for (int i = 0; i < pred_num_hole_card_pairs; ++i) {
      vals[i] += c_vals[i];
    }
    *total_num_samples += children[t]->TotalNumSamples();
    num_resolves_ += children[t]->NumResolves();
    resolving_secs_ += children[t]->ResolvingSecs();
  }
  return vals;
}
shared_ptr < double [ ] > PreResponder :: Split ( Node * p0_node , Node * p1_node , const ReachProbs & reach_probs , int pbd , const string & action_sequence , int * total_num_samples ) { unique_ptr < unique_ptr < PreResponder > [ ] > children ( new unique_ptr < PreResponder > [ num_threads_ ] ) ; for ( int t = 0 ; t < num_threads_ ; ++ t ) { children [ t ] . reset ( new PreResponder ( card_abstraction_ , betting_abstraction_ , cfr_config_ , buckets_ , street_ , resolve_ , subgame_card_abstraction_ , subgame_betting_abstraction_ , subgame_cfr_config_ , subgame_buckets_ , num_resolve_its_ , responder_p_ , sumprobs_ , use_subgames_ , trunk_hand_tree_ , board_samples_ , has_continuation_ , num_threads_ , t , p0_node , p1_node , pbd , action_sequence , & reach_probs ) ) ; } for ( int t = 1 ; t < num_threads_ ; ++ t ) { children [ t ] -> Run ( ) ; } children [ 0 ] -> DoTask ( ) ; for ( int t = 1 ; t < num_threads_ ; ++ t ) { children [ t ] -> Join ( ) ; } int nst = p0_node -> Street ( ) ; int pst = nst - 1 ; int pred_num_hole_card_pairs = Game :: NumHoleCardPairs ( pst ) ; shared_ptr < double [ ] > vals ( new double [ pred_num_hole_card_pairs ] ) ; for ( int i = 0 ; i < pred_num_hole_card_pairs ; ++ i ) vals [ i ] = 0 ; for ( int t = 0 ; t < num_threads_ ; ++ t ) { shared_ptr < double [ ] > c_vals = children [ t ] -> RetVals ( ) ; for ( int i = 0 ; i < pred_num_hole_card_pairs ; ++ i ) { vals [ i ] += c_vals [ i ] ; } * total_num_samples += children [ t ] -> TotalNumSamples ( ) ; num_resolves_ += children [ t ] -> NumResolves ( ) ; resolving_secs_ += children [ t ] -> ResolvingSecs ( ) ; } return vals ; }
In VCFR what we are multithreading is the inner loop of street initial.
In VCFR what we are multithreading is the inner loop of street initial .
// Pass in thread index, num threads? // Do first thread in main thread