vt::ctx::Context struct

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.

Base classes

template<typename T>
struct vt::runtime::component::Component<Context>
Component class for a generic VT runtime module, CRTP'ed over the component's actual type

Constructors, destructors, conversion operators

Context(bool const interop, MPI_Comm comm)
Construct the context.
~Context()

Public functions

auto getNode() const -> NodeType
Gets the current node (analogous to MPI's rank) currently being used.
auto getNumNodes() const -> NodeType
Get the number of nodes (analogous to MPI's num ranks) being used.
auto getComm() const -> MPI_Comm
Get the MPI communicator being used by VT in a given runtime instance.
auto name() -> std::string override
Get the name of the component.
template<typename SerializerT>
void serialize(SerializerT& s)
auto getTask() const -> runnable::RunnableNew*
Get the current running task.
auto getFromNodeCurrentTask() const -> NodeType
Get the node that caused the current running task to execute; i.e., the node that sent the message to trigger the current runnable.

Protected functions

void setTask(runnable::RunnableNew* in_task)
Set the current running task.

Function documentation

vt::ctx::Context::Context(bool const interop, MPI_Comm comm)

Construct the context.

Parameters
interop in running in interop mode?
comm in the communicator

NodeType vt::ctx::Context::getNode() const

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

Returns the node currently being run on

NodeType vt::ctx::Context::getNumNodes() const

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

Returns the number of nodes currently being run on

MPI_Comm vt::ctx::Context::getComm() const

Get the MPI communicator being used by VT in a given runtime instance.

Returns the MPI_Comm being used by VT for communication

runnable::RunnableNew* vt::ctx::Context::getTask() const

Get the current running task.

Returns the current running task

NodeType vt::ctx::Context::getFromNodeCurrentTask() const

Get the node that caused the current running task to execute; i.e., the node that sent the message to trigger the current runnable.

Returns the node that sent the message that triggered the current task

For the current task that is executing, get the node that sent the message that caused this runnable to execute. Note, for collection handlers this will not be the logical node that sent the message. It will be the node that last forwarded the message during location discovery.

void vt::ctx::Context::setTask(runnable::RunnableNew* in_task) protected

Set the current running task.

Parameters
in_task in the current running task