DARMA » Introduction » Context

Node-aware context

The context component vt::ctx::Context, accessed via vt::theContext(), provides context-aware querying of the current node (analogous to MPI's MPI_Comm_rank), number of nodes (analogous to MPI's MPI_Comm_size), and kernel threading/ULT information if worker threads are enabled. The context also provides the MPI communicator that an instance of vt is currently using.

Used to obtain the current node and other context where a handler executes. Context is a core VT component that provides the ability to pass initialization arguments (through the vt::Runtime) and obtain info about the node on which a handler is executing or the number of nodes. It provides functionality analogous to MPI_Comm_size and MPI_Comm_rank.

Gets the current node (analogous to MPI's rank) currently being used.

To get the current node, one may query this method:

vt::NodeType this_node = vt::theContext()->getNode();

Get the number of nodes (analogous to MPI's num ranks) being used.

To get the number of nodes or ranks that an instance of vt is using, one may query this method:

vt::NodeType num_nodes = vt::theContext()->getNumNodes();