/home/coin/SVN-release/OS-2.4.1/Bcp/src/TM/BCP_tm_nodes_to_storage.cpp File Reference

#include "BCP_os.hpp"
#include "BCP_tm.hpp"
#include "BCP_tm_node.hpp"
#include "BCP_tm_user.hpp"
#include "BCP_tm_functions.hpp"

Include dependency graph for BCP_tm_nodes_to_storage.cpp:

Go to the source code of this file.

Defines

#define NUMNODES_BASED_ON_BUFSIZE

Functions

static bool BCP_tm_scan_children (BCP_tm_prob &p, BCP_tm_node *node, std::vector< BCP_tm_node * > &nodes_to_send, const long bufsize)
static bool BCP_tm_scan_siblings (BCP_tm_prob &p, BCP_tm_node *node, std::vector< BCP_tm_node * > &nodes_to_send, const long bufsize)
bool BCP_tm_is_data_balanced (BCP_tm_prob &p)
 This function is invoked from exactly one place, the beginning of BCP_tm_unpack_node_description().
bool BCP_tm_balance_data (BCP_tm_prob &p)
 This function is invoked after data from an LP is unpacked (and only if p.need_a_TS is true).


Define Documentation

#define NUMNODES_BASED_ON_BUFSIZE

Definition at line 10 of file BCP_tm_nodes_to_storage.cpp.


Function Documentation

static bool BCP_tm_scan_children ( BCP_tm_prob p,
BCP_tm_node node,
std::vector< BCP_tm_node * > &  nodes_to_send,
const long  bufsize 
) [static]

Definition at line 14 of file BCP_tm_nodes_to_storage.cpp.

References BCP_tm_node::_children, BCP_tm_node::_data, BCP_tm_node_data::_desc, BCP_tm_node::_index, BCP_tm_node_data::_user, BCP_tm_prob::msg_buf, BCP_buffer::pack(), BCP_user_pack::pack_user_data(), BCP_tm_prob::packer, BCP_tm_prob::param(), BCP_vec< T >::push_back(), BCP_tm_par::ReportWhenDefaultIsExecuted, s, BCP_buffer::size(), and BCP_vec< T >::size().

Referenced by BCP_tm_scan_siblings().

static bool BCP_tm_scan_siblings ( BCP_tm_prob p,
BCP_tm_node node,
std::vector< BCP_tm_node * > &  nodes_to_send,
const long  bufsize 
) [static]

Definition at line 49 of file BCP_tm_nodes_to_storage.cpp.

References BCP_tm_node::_children, BCP_tm_node::_data, BCP_tm_node_data::_desc, BCP_tm_node::_index, BCP_tm_node::_parent, BCP_tm_node_data::_user, BCP_tm_scan_children(), BCP_tm_prob::msg_buf, BCP_buffer::pack(), BCP_user_pack::pack_user_data(), BCP_tm_prob::packer, BCP_tm_prob::param(), BCP_tm_par::ReportWhenDefaultIsExecuted, s, BCP_vec< T >::size(), and BCP_buffer::size().

Referenced by BCP_tm_balance_data().

bool BCP_tm_is_data_balanced ( BCP_tm_prob p  ) 

This function is invoked from exactly one place, the beginning of BCP_tm_unpack_node_description().

So any time when data is received we call this function to decide if data balancing is needed or not. There may be another call from BCP_tm_do_one_phase() to keep the TM busy if it's idle.

Definition at line 98 of file BCP_tm_nodes_to_storage.cpp.

References BCP_used_heap(), BCP_tm_par::MaxHeapSize, BCP_tm_node::num_local_nodes, BCP_tm_node::num_remote_nodes, and BCP_tm_prob::param().

Referenced by BCP_tm_do_one_phase(), BCP_tm_unpack_branching_info(), and BCP_tm_unpack_node_no_branching_info().

bool BCP_tm_balance_data ( BCP_tm_prob p  ) 

This function is invoked after data from an LP is unpacked (and only if p.need_a_TS is true).

And maybe from BCP_tm_do_one_phase() to keep the TM busy if it's idle. It returns true/false depending on whether further balancing is needed.

First we try to get hold of a TS. This might come from an existing TS or we might try to convert an LP into a TS. If neither succeeds we leave the flag on and return. The flag will ensure that no LP will be allowed to dive until the flag is cleared. Therefore the LP that has sent the data that triggered the call to to this function through the call to BCP_tm_unpack_node_description() will be free when the next LP sends some data. So at that time we will be able to balance. (NOTE: if the TM is idle, we might invoke this routine to do some useful work.)

If we managed to get hold of a TS then we do the balancing

Definition at line 138 of file BCP_tm_nodes_to_storage.cpp.

References BCP_tm_node::_data, BCP_tm_node::_data_location, BCP_tm_node_data::_desc, BCP_tm_node::_locally_stored, BCP_tm_node_data::_user, BCP_Msg_NodeList, BCP_Msg_NodeListReply, BCP_ProcessType_TS, BCP_tm_notify_process_type(), BCP_tm_scan_siblings(), BCP_used_heap(), BCP_tm_prob::candidate_list, BCP_buffer::clear(), k, BCP_tm_prob::lp_procs, BCP_tm_prob::lp_scheduler, BCP_tm_par::MaxHeapSize, BCP_scheduler::maxNodeIds(), BCP_tm_prob::msg_buf, BCP_tm_prob::msg_env, n, BCP_tm_prob::need_a_TS, BCP_tm_node::num_local_nodes, BCP_tm_node::num_remote_nodes, BCP_buffer::pack(), BCP_tm_prob::param(), BCP_message_environment::receive(), BCP_scheduler::request_node_id(), BCP_tm_prob::search_tree, BCP_message_environment::send(), BCP_tree::size(), BCP_tm_prob::ts_procs, BCP_tm_prob::ts_space, and BCP_buffer::unpack().

Referenced by BCP_tm_do_one_phase(), BCP_tm_unpack_node_no_branching_info(), and BCP_tm_unpack_node_with_branching_info().


Generated on Thu Nov 10 03:07:26 2011 by  doxygen 1.4.7