TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
TRUST_2_PDI Class Reference

classe TRUST_2_PDI Encapsulation of PDI methods (library used for IO operations). See the website pdi.dev for more info More...

#include <TRUST_2_PDI.h>

Public Member Functions

void read (const std::string &name, void *data)
void write (const std::string &name, const void *data)
void TRUST_start_sharing (const std::string &name, const void *data)
void trigger (const std::string &event)
void stop_sharing_last_variable ()
void stop_sharing ()
void share_type (const Nom &name, const Nom &type)
 Generic method to share the type of a TRUST object.
void get_type (const Nom &name, Nom &type)
 Generic method to read the type of a TRUST object in the HDF5 file.
void share_TRUSTTab_dimensions (const DoubleTab &tab, const Nom &name, int write)
 Generic method to share the dimensions of a TRUST DoubleTab with PDI.
void prepareRestart (OWN_PTR(Comm_Group)&nodeGroup, int &last_iteration, double &tinit, int resume_last_time)
 Generic method to prepare the restart of a computation.

Static Public Member Functions

static void init (std::string IO_config)
static void finalize ()
static void share_node_parallelism ()
static void share_parallelism (const Comm_Group &grp, int group_rank)
static void set_PDI_checkpoint (int c)
static void set_PDI_restart (int r)
static int is_PDI_initialized ()
static int is_PDI_checkpoint ()
static int is_PDI_restart ()

Detailed Description

classe TRUST_2_PDI Encapsulation of PDI methods (library used for IO operations). See the website pdi.dev for more info

PDI needs to be initialized with a YAML file, containing all the data that we want to exchange with the outside world (see the class Ecrire_YAML for details). Note that every data that will be handled via PDI first needs to be declared in the YAML file that has been used to initialize it!

Here is how PDI works: 1) TRUST makes it known to PDI that some of our data is accessible (ie we start sharing a pointer to the data, no copy here!) 2) PDI notifies the selected plugin that the data is ready 3) The plugin works with the data and behaves just as we described it in the YAML file 4) Once the work is done, TRUST can reclaim the data (which means PDI will no longer be able to reach it) and pursue the simulation

These steps can be completed at once in a single operation or asynchronously (ie we share the data, we busy ourselves with some other stuff, then we trigger the IO operations and reclaim the data).

An example on how to use it: """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" int var = 5; TRUST_2_PDI::init(yaml_filename); TRUST_2_PDI pdi_interface; pdi_interface.start_sharing("pb_var", &var); // the YAML file must contain a data named pb_var pdi_interface.trigger("event"); // there has to be an event in the YAML that tells us what to do with the data pdi_interface.stop_sharing_last_variable(); // data is no more available // the last 3 instructions can be squeezed in one with the methods TRUST_2_PDI::read()/TRUST_2_PDI::write() TRUST_2_PDI::finalize(); """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Definition at line 58 of file TRUST_2_PDI.h.

Member Function Documentation

◆ finalize()

void TRUST_2_PDI::finalize ( )
inlinestatic

Definition at line 83 of file TRUST_2_PDI.h.

◆ get_type()

void TRUST_2_PDI::get_type ( const Nom & name,
Nom & type )

Generic method to read the type of a TRUST object in the HDF5 file.

Parameters
(Nomname) the name of the object
(Nomtype) type of the object

Definition at line 78 of file TRUST_2_PDI.cpp.

◆ init()

void TRUST_2_PDI::init ( std::string IO_config)
inlinestatic

Definition at line 63 of file TRUST_2_PDI.h.

◆ is_PDI_checkpoint()

int TRUST_2_PDI::is_PDI_checkpoint ( )
inlinestatic

Definition at line 131 of file TRUST_2_PDI.h.

◆ is_PDI_initialized()

int TRUST_2_PDI::is_PDI_initialized ( )
inlinestatic

Definition at line 130 of file TRUST_2_PDI.h.

◆ is_PDI_restart()

int TRUST_2_PDI::is_PDI_restart ( )
inlinestatic

Definition at line 132 of file TRUST_2_PDI.h.

◆ prepareRestart()

void TRUST_2_PDI::prepareRestart ( OWN_PTR(Comm_Group)& nodeGroup,
int & last_iteration,
double & tinit,
int resume_last_time )

Generic method to prepare the restart of a computation.

Parameters
(OWN_PTR(Comm_Group)&nodeGroup) communicator that will be used to read data from the checkpoint files
(int&last_iteration) the index of the backup iteration we want to recover from
(double&tinit) the time from which we want to resume the calculation
(intresume_last_time) flag to specify if we want to resume from the last time or we want to recover from a specific time

Definition at line 110 of file TRUST_2_PDI.cpp.

◆ read()

void TRUST_2_PDI::read ( const std::string & name,
void * data )
inline

Definition at line 135 of file TRUST_2_PDI.h.

◆ set_PDI_checkpoint()

void TRUST_2_PDI::set_PDI_checkpoint ( int c)
inlinestatic

Definition at line 127 of file TRUST_2_PDI.h.

◆ set_PDI_restart()

void TRUST_2_PDI::set_PDI_restart ( int r)
inlinestatic

Definition at line 128 of file TRUST_2_PDI.h.

◆ share_node_parallelism()

void TRUST_2_PDI::share_node_parallelism ( )
inlinestatic

Definition at line 98 of file TRUST_2_PDI.h.

◆ share_parallelism()

void TRUST_2_PDI::share_parallelism ( const Comm_Group & grp,
int group_rank )
inlinestatic

Definition at line 118 of file TRUST_2_PDI.h.

◆ share_TRUSTTab_dimensions()

void TRUST_2_PDI::share_TRUSTTab_dimensions ( const DoubleTab & tab,
const Nom & name,
int write )

Generic method to share the dimensions of a TRUST DoubleTab with PDI.

Parameters
(constDoubleTab& tab) the array we want to share with PDI
(Nomname) the name of the array
(intwrite) flag to specify if we want to write the dimensions or read into it

Definition at line 30 of file TRUST_2_PDI.cpp.

◆ share_type()

void TRUST_2_PDI::share_type ( const Nom & name,
const Nom & type )

Generic method to share the type of a TRUST object.

Parameters
(Nomname) the name of the object
(Nomtype) type of the object

Definition at line 59 of file TRUST_2_PDI.cpp.

◆ stop_sharing()

void TRUST_2_PDI::stop_sharing ( )
inline

Definition at line 180 of file TRUST_2_PDI.h.

◆ stop_sharing_last_variable()

void TRUST_2_PDI::stop_sharing_last_variable ( )
inline

Definition at line 171 of file TRUST_2_PDI.h.

◆ trigger()

void TRUST_2_PDI::trigger ( const std::string & event)
inline

Definition at line 162 of file TRUST_2_PDI.h.

◆ TRUST_start_sharing()

void TRUST_2_PDI::TRUST_start_sharing ( const std::string & name,
const void * data )
inline

Definition at line 153 of file TRUST_2_PDI.h.

◆ write()

void TRUST_2_PDI::write ( const std::string & name,
const void * data )
inline

Definition at line 143 of file TRUST_2_PDI.h.


The documentation for this class was generated from the following files:
  • /home/docs/checkouts/readthedocs.org/user_builds/cea-trust-platform/checkouts/master/src/Kernel/Framework/TRUST_2_PDI.h
  • /home/docs/checkouts/readthedocs.org/user_builds/cea-trust-platform/checkouts/master/src/Kernel/Framework/TRUST_2_PDI.cpp