16#ifndef TRUST_2_PDI_included
17#define TRUST_2_PDI_included
24#include <Comm_Group_MPI.h>
63 static void init(std::string IO_config)
67 Cerr <<
"TRUST_2_PDI::initialize PDI has already been initialized" << finl;
73 PC_tree_t tconf = PC_parse_path(IO_config.c_str());
74 PDI_init(PC_get(tconf,
".pdi"));
75 PC_tree_destroy(&tconf);
85 assert(PDI_initialized_);
86 assert(shared_data_.size() == 0);
109 const MPI_Comm& masterComm = nodeMaster->get_mpi_comm();
112 share_parallelism_impl(nodeComm, nodeId, &masterComm);
123 share_parallelism_impl(comm, group_rank);
135 void read(
const std::string& name,
void *data)
138 PDI_expose(name.c_str(), data, PDI_INOUT);
143 void write(
const std::string& name,
const void *data)
146 PDI_expose(name.c_str(), data, PDI_OUT);
156 PDI_share(name.c_str(), data, PDI_OUT);
158 shared_data_.push_back(name);
165 PDI_event(event.c_str());
174 PDI_reclaim(shared_data_.back().c_str());
176 shared_data_.pop_back();
184 for(
auto it = shared_data_.rbegin(); it != shared_data_.rend(); it++)
185 PDI_reclaim(it->c_str());
187 shared_data_.clear();
199 static void share_parallelism_impl(
const Comm_Group_MPI* nodeComm,
int nodeId,
const MPI_Comm* masterComm =
nullptr)
202 const MPI_Comm& comm = nodeComm->get_mpi_comm();
203 int nodeSz = nodeComm->
nproc();
204 int nodeRk = nodeComm->
rank();
205 PDI_multi_expose(
"Parallelism",
206 "nodeSize", &nodeSz, PDI_OUT,
207 "nodeRk", &nodeRk, PDI_OUT,
208 "nodeId", &nodeId, PDI_OUT,
209 "node", &comm, PDI_OUT,
212 PDI_expose(
"master", masterComm, PDI_OUT);
218 static std::vector<std::string> shared_data_;
220 static int PDI_checkpoint_;
221 static int PDI_restart_;
222 static int PDI_initialized_;
: Classe Comm_Group_MPI, derivee de la classe abstraite Comm_Group.
: Cette classe decrit un groupe de processeurs sur lesquels
int get_node_id() const
Retrieve ID of my numa node.
int nproc() const
Renvoie le nombre de processeurs dans le groupe *this.
int rank() const
Renvoie le rang du processeur local dans le groupe *this.
class Nom Une chaine de caractere pour nommer les objets de TRUST
static const Comm_Group & get_node_master()
Renvoie le groupe contenant le maitre de mon noeud.
static const Comm_Group & get_node_group()
Renvoie une reference au groupe sur les noeuds.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
classe TRUST_2_PDI Encapsulation of PDI methods (library used for IO operations). See the website pdi...
void share_type(const Nom &name, const Nom &type)
Generic method to share the type of a TRUST object.
void read(const std::string &name, void *data)
static void set_PDI_restart(int r)
void stop_sharing_last_variable()
void write(const std::string &name, const void *data)
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.
void get_type(const Nom &name, Nom &type)
Generic method to read the type of a TRUST object in the HDF5 file.
static void init(std::string IO_config)
static void set_PDI_checkpoint(int c)
static int is_PDI_checkpoint()
static int is_PDI_restart()
static void share_node_parallelism()
void share_TRUSTTab_dimensions(const DoubleTab &tab, const Nom &name, int write)
Generic method to share the dimensions of a TRUST DoubleTab with PDI.
static int is_PDI_initialized()
static void share_parallelism(const Comm_Group &grp, int group_rank)
void TRUST_start_sharing(const std::string &name, const void *data)
void trigger(const std::string &event)