SENSEI
A frame work for generic in situ analytics
sensei::ConfigurableInTransitDataAdaptor Class Reference

The ConfigurableInTransitDataAdaptor implements the InTransitDataAdaptor interface, provides a factory for creating a concrete instance of the InTransitDataAdpator from an XML configuration, and delegates in coming calls through the InTransitDataAdapotor/DataAdaptor API to the instance. More...

#include <ConfigurableInTransitDataAdaptor.h>

Inheritance diagram for sensei::ConfigurableInTransitDataAdaptor:
[legend]
Collaboration diagram for sensei::ConfigurableInTransitDataAdaptor:
[legend]

Public Member Functions

 senseiTypeMacro (ConfigurableInTransitDataAdaptor, InTransitDataAdaptor)
 
int Initialize (const std::string &fileName)
 
int SetConnectionInfo (const std::string &info) override
 Pass in a string containing transport specific connection information. More...
 
const std::string & GetConnectionInfo () const override
 Return the current connection info. More...
 
int Initialize (pugi::xml_node &node) override
 Initialize the adaptor from an XML node. More...
 
int GetSenderMeshMetadata (unsigned int id, MeshMetadataPtr &metadata) override
 Get metadta object describing the data that is available in the simulation. More...
 
int GetReceiverMeshMetadata (unsigned int id, MeshMetadataPtr &metadata) override
 Returns the current receiver mesh metadata. More...
 
int SetReceiverMeshMetadata (unsigned int id, MeshMetadataPtr &metadata) override
 This API that enables one to specify how the data is partitioned on the analysis/local side. More...
 
void SetPartitioner (const sensei::PartitionerPtr &partitioner) override
 Set/get the partitioner. More...
 
sensei::PartitionerPtr GetPartitioner () override
 Return the current partitioner. More...
 
int OpenStream () override
 Opens a stream and connects to the simulation. More...
 
int CloseStream () override
 Closes a stream and disconnects from the simulation. More...
 
int AdvanceStream () override
 Signals the that we are finished with this time step. More...
 
int StreamGood () override
 Returns true while there is more data to process. More...
 
int Finalize () override
 Called before the application is brought down. It is safe to use MPI here. More...
 
int GetNumberOfMeshes (unsigned int &numMeshes) override
 Gets the number of meshes a simulation can provide. More...
 
int GetMeshMetadata (unsigned int id, MeshMetadataPtr &metadata) override
 Get metadata of the i'th mesh. More...
 
int GetMesh (const std::string &meshName, bool structureOnly, svtkDataObject *&mesh) override
 Fetches the requested data object from the simulation. More...
 
int AddGhostNodesArray (svtkDataObject *mesh, const std::string &meshName) override
 Adds ghost nodes on the specified mesh. More...
 
int AddGhostCellsArray (svtkDataObject *mesh, const std::string &meshName) override
 Adds ghost cells on the specified mesh. More...
 
int AddArray (svtkDataObject *mesh, const std::string &meshName, int association, const std::string &arrayName) override
 Fetches the named array from the simulation and adds it to the passed mesh. More...
 
int AddArrays (svtkDataObject *mesh, const std::string &meshName, int association, const std::vector< std::string > &arrayName) override
 Fetches multiple arrays from the simulation and adds them to the mesh. More...
 
int ReleaseData () override
 Release data allocated for the current timestep. More...
 
double GetDataTime () override
 Get the current simulated time. More...
 
void SetDataTime (double time) override
 Set the current simulated time. More...
 
long GetDataTimeStep () override
 Get the current time step. More...
 
void SetDataTimeStep (long index) override
 Set the current simulated time step. More...
 
- Public Member Functions inherited from sensei::InTransitDataAdaptor
 senseiTypeMacro (InTransitDataAdaptor, sensei::DataAdaptor)
 
- Public Member Functions inherited from sensei::DataAdaptor
 senseiBaseTypeMacro (DataAdaptor, svtkObjectBase)
 
void PrintSelf (ostream &os, svtkIndent indent) override
 Prints the current state of the adaptor. More...
 
virtual int SetCommunicator (MPI_Comm comm)
 Set the communicator used by the adaptor. More...
 
MPI_Comm GetCommunicator ()
 Get the communicator used by the adaptor. More...
 

Static Public Member Functions

static ConfigurableInTransitDataAdaptorNew ()
 

Protected Member Functions

 ConfigurableInTransitDataAdaptor (const ConfigurableInTransitDataAdaptor &)=delete
 
void operator= (const ConfigurableInTransitDataAdaptor &)=delete
 
- Protected Member Functions inherited from sensei::InTransitDataAdaptor
 InTransitDataAdaptor (const InTransitDataAdaptor &)=delete
 
void operator= (const InTransitDataAdaptor &)=delete
 
- Protected Member Functions inherited from sensei::DataAdaptor
 DataAdaptor (const DataAdaptor &)=delete
 
void operator= (const DataAdaptor &)=delete
 

Protected Attributes

InternalsType * Internals
 
- Protected Attributes inherited from sensei::InTransitDataAdaptor
InternalsType * Internals
 
- Protected Attributes inherited from sensei::DataAdaptor
InternalsType * Internals
 
MPI_Comm Comm
 

Detailed Description

The ConfigurableInTransitDataAdaptor implements the InTransitDataAdaptor interface, provides a factory for creating a concrete instance of the InTransitDataAdpator from an XML configuration, and delegates in coming calls through the InTransitDataAdapotor/DataAdaptor API to the instance.

The purpose of this class is to provide run-time configurability of the concrete InTransitDataAdaptors.

Configurartion shold be placed in an element of type transport, the type attribute names the concrete class to create and initialize. Each concrete class will have a number of attributes used for configuration.

The supported transport types are:

adios_1, adios_2, hdf5, libis

Illustrative example of the XML:

<sensei>
<transport type="adios_1" file_name="test.bp" read_method="FLEXPATH">
<paritioner type="block"/>
</transport>
<sensei>

Member Function Documentation

◆ AddArray()

int sensei::ConfigurableInTransitDataAdaptor::AddArray ( svtkDataObject *  mesh,
const std::string &  meshName,
int  association,
const std::string &  arrayName 
)
overridevirtual

Fetches the named array from the simulation and adds it to the passed mesh.

Implementers should pass the data by zero copy when possible. See svtkAOSDataArrayTemplate and svtkSOADataArrayTemplate for details of passing data zero copy.

Parameters
[in]meshthe VTK object returned from GetMesh
[in]meshNamethe name of the mesh on which the array is stored
[in]associationfield association; one of svtkDataObject::FieldAssociations or svtkDataObject::AttributeTypes.
[in]arrayNamename of the array
Returns
zero if successful, non zero if an error occurred

Implements sensei::DataAdaptor.

◆ AddArrays()

int sensei::ConfigurableInTransitDataAdaptor::AddArrays ( svtkDataObject *  mesh,
const std::string &  meshName,
int  association,
const std::vector< std::string > &  arrayNames 
)
overridevirtual

Fetches multiple arrays from the simulation and adds them to the mesh.

Implementers typically do not have to override this method.

Parameters
[in]meshthe VTK object returned from GetMesh
[in]meshNamethe name of the mesh on which the array is stored
[in]associationfield association; one of svtkDataObject::FieldAssociations or svtkDataObject::AttributeTypes.
[in]arrayNamesvector of array names to add
Returns
zero if successful, non zero if an error occurred

Reimplemented from sensei::DataAdaptor.

◆ AddGhostCellsArray()

int sensei::ConfigurableInTransitDataAdaptor::AddGhostCellsArray ( svtkDataObject *  mesh,
const std::string &  meshName 
)
overridevirtual

Adds ghost cells on the specified mesh.

Implementers should set the array name to "svtkGhostType".

Parameters
[in]meshthe svtkDataObject returned from GetMesh
[in]meshNamethe name of the mesh to access (see GetMeshMetadata)
Returns
zero if successful, non zero if an error occurred

Reimplemented from sensei::DataAdaptor.

◆ AddGhostNodesArray()

int sensei::ConfigurableInTransitDataAdaptor::AddGhostNodesArray ( svtkDataObject *  mesh,
const std::string &  meshName 
)
overridevirtual

Adds ghost nodes on the specified mesh.

Implementers shouls set the name of the array to "svtkGhostType".

Parameters
[in]meshthe VTK object returned from GetMesh
[in]meshNamethe name of the mesh to access (see GetMeshMetadata)
Returns
zero if successful, non zero if an error occurred

Reimplemented from sensei::DataAdaptor.

◆ AdvanceStream()

int sensei::ConfigurableInTransitDataAdaptor::AdvanceStream ( )
overridevirtual

Signals the that we are finished with this time step.

Implements sensei::InTransitDataAdaptor.

◆ CloseStream()

int sensei::ConfigurableInTransitDataAdaptor::CloseStream ( )
overridevirtual

Closes a stream and disconnects from the simulation.

Implements sensei::InTransitDataAdaptor.

◆ Finalize()

int sensei::ConfigurableInTransitDataAdaptor::Finalize ( )
overridevirtual

Called before the application is brought down. It is safe to use MPI here.

Implements sensei::InTransitDataAdaptor.

◆ GetConnectionInfo()

const std::string& sensei::ConfigurableInTransitDataAdaptor::GetConnectionInfo ( ) const
overridevirtual

Return the current connection info.

Reimplemented from sensei::InTransitDataAdaptor.

◆ GetDataTime()

double sensei::ConfigurableInTransitDataAdaptor::GetDataTime ( )
overridevirtual

Get the current simulated time.

Reimplemented from sensei::DataAdaptor.

◆ GetDataTimeStep()

long sensei::ConfigurableInTransitDataAdaptor::GetDataTimeStep ( )
overridevirtual

Get the current time step.

Reimplemented from sensei::DataAdaptor.

◆ GetMesh()

int sensei::ConfigurableInTransitDataAdaptor::GetMesh ( const std::string &  meshName,
bool  structureOnly,
svtkDataObject *&  mesh 
)
overridevirtual

Fetches the requested data object from the simulation.

This method will return a svtkDataObject containing the simulation state. Implementers should prefer svtkMultiBlockData over svtkDataSet types. However, both approaches are supported. Callers should typically pass structureOnly to false. Caller may set stuctureOnly to true when data arrays without mesh geometry and connectivity are sufficient for processing. If structureOnly is set to true, then implementers should not populate the mesh geometry and connectivity information. This can result in large savings in data transfer.

Note
Callers are to take ownership of the newly allocated mesh and must Delete the returned mesh when finished to prevent a memory leak.
Parameters
[in]meshNamethe name of the mesh to access (see GetMeshMetadata)
[in]structureOnlyWhen set to true the returned mesh may not have any geometry or topology information.
[out]mesha reference to a pointer where a new VTK object is stored
Returns
zero if successful, non zero if an error occurred

Implements sensei::DataAdaptor.

◆ GetMeshMetadata()

int sensei::ConfigurableInTransitDataAdaptor::GetMeshMetadata ( unsigned int  id,
MeshMetadataPtr &  metadata 
)
overridevirtual

Get metadata of the i'th mesh.

The caller passes the integer id of the mesh for which the metadata is desired, and a pointer to a MeshMetadata instance where the metadata is stored.

Parameters
[in]idindex of the mesh to access
[out]metadataa pointer to instance where metadata is stored
Returns
zero if successful, non zero if an error occurred

Implements sensei::DataAdaptor.

◆ GetNumberOfMeshes()

int sensei::ConfigurableInTransitDataAdaptor::GetNumberOfMeshes ( unsigned int &  numMeshes)
overridevirtual

Gets the number of meshes a simulation can provide.

The caller passes a reference to an integer variable in the first argument upon return this variable contains the number of meshes the simulation can provide. If successfull the method returns 0, a non-zero return indicates an error occurred.

Parameters
[out]numMeshesan integer variable where number of meshes is stored
Returns
zero if successful, non zero if an error occurred

Implements sensei::DataAdaptor.

◆ GetPartitioner()

sensei::PartitionerPtr sensei::ConfigurableInTransitDataAdaptor::GetPartitioner ( )
overridevirtual

Return the current partitioner.

Reimplemented from sensei::InTransitDataAdaptor.

◆ GetReceiverMeshMetadata()

int sensei::ConfigurableInTransitDataAdaptor::GetReceiverMeshMetadata ( unsigned int  id,
MeshMetadataPtr &  metadata 
)
overridevirtual

Returns the current receiver mesh metadata.

Reimplemented from sensei::InTransitDataAdaptor.

◆ GetSenderMeshMetadata()

int sensei::ConfigurableInTransitDataAdaptor::GetSenderMeshMetadata ( unsigned int  id,
MeshMetadataPtr &  metadata 
)
overridevirtual

Get metadta object describing the data that is available in the simulation.

Implements sensei::InTransitDataAdaptor.

◆ Initialize()

int sensei::ConfigurableInTransitDataAdaptor::Initialize ( pugi::xml_node &  node)
overridevirtual

Initialize the adaptor from an XML node.

The default implementation handles initializing a sensei::ConfigurablePartitioner. If the ConfigurablePartitioner fails to initialize, then a we fall back to a default initialized sensei::BlockPartitioner.

Reimplemented from sensei::InTransitDataAdaptor.

◆ OpenStream()

int sensei::ConfigurableInTransitDataAdaptor::OpenStream ( )
overridevirtual

Opens a stream and connects to the simulation.

Implements sensei::InTransitDataAdaptor.

◆ ReleaseData()

int sensei::ConfigurableInTransitDataAdaptor::ReleaseData ( )
overridevirtual

Release data allocated for the current timestep.

This method allows implementers to free resources that were used in the conversion of the simulation data. However, note that callers of GetMesh must Delete the returned svtkDataObject which typically alleviates the need for the adaptor to hold references to the returned data. In most cases this method should not be overridden.

Note
The instrumentation (or bridge) code must call this method when done processing a time step to ensure that all resources are released. Analysis adaptors should not call this method.
Returns
zero if successful, non zero if an error occurred

Reimplemented from sensei::DataAdaptor.

◆ SetConnectionInfo()

int sensei::ConfigurableInTransitDataAdaptor::SetConnectionInfo ( const std::string &  info)
overridevirtual

Pass in a string containing transport specific connection information.

This is optional, as XML may be used to specify connection as well. When used the details will be specific to the transport, for instance ADIOS uses a file to negotiate the connection, hence for ADIOS connection info will be a path to that file.

Reimplemented from sensei::InTransitDataAdaptor.

◆ SetDataTime()

void sensei::ConfigurableInTransitDataAdaptor::SetDataTime ( double  time)
overridevirtual

Set the current simulated time.

The default implementation stores the passed time. Implemetors typically call this method rather than overriding the method.

Reimplemented from sensei::DataAdaptor.

◆ SetDataTimeStep()

void sensei::ConfigurableInTransitDataAdaptor::SetDataTimeStep ( long  index)
overridevirtual

Set the current simulated time step.

The default implementation stores the passed time step. Implemetors typically call this method rather than overriding the method.

Reimplemented from sensei::DataAdaptor.

◆ SetPartitioner()

void sensei::ConfigurableInTransitDataAdaptor::SetPartitioner ( const sensei::PartitionerPtr &  partitioner)
overridevirtual

Set/get the partitioner.

The partitioner is used when no receiver mesh metadata has been set. The Initialize method will initialize an instance of a ConfigurablePartitioner using user provided XML, if that fails will fall back to a default initialized instance of BlockPartitioner.

Reimplemented from sensei::InTransitDataAdaptor.

◆ SetReceiverMeshMetadata()

int sensei::ConfigurableInTransitDataAdaptor::SetReceiverMeshMetadata ( unsigned int  id,
MeshMetadataPtr &  metadata 
)
overridevirtual

This API that enables one to specify how the data is partitioned on the analysis/local side.

Analyses that need control over how data lands can use this to say where data lands. The metadata object passed here will be returned to the Analysis, and the transport layer will use it to move blocks onto the correct ranks. Care, should be taken as there will be variablility in terms of what various transport layers support. The requirement for SENSEI 3.0 is that blocks are elemental. In other words given M ranks and P blocks on the sender/simulation side, a partitioning with N ranks and P blocks on the receiver/analysis side is supported. A transport may support more sophistocated partitioning, but it's not required. An analysis need not use this API, in that case the default is handled by the transport layer. See comments in InTransitDataAdaptor::Initialize for the universal partioning options as well as comments in the specific transport's implementation.

The default implementation manages the metadata objects, derived classes must handle the details of initiallizing these objects. Get calls will return -1 if no object has been set for a given id.

Reimplemented from sensei::InTransitDataAdaptor.

◆ StreamGood()

int sensei::ConfigurableInTransitDataAdaptor::StreamGood ( )
overridevirtual

Returns true while there is more data to process.

Implements sensei::InTransitDataAdaptor.


The documentation for this class was generated from the following file: