gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
Gambit::Printers::VertexBufferBase Class Referenceabstract

VertexBuffer abstract interface base class. More...

#include <VertexBufferBase.hpp>

Inheritance diagram for Gambit::Printers::VertexBufferBase:
Collaboration diagram for Gambit::Printers::VertexBufferBase:

Public Member Functions

 VertexBufferBase ()
 
 VertexBufferBase (const std::string &l, const int vID, const uint i, const bool sync, const bool sil, const bool r, const bool mode, const char a)
 
virtual ~VertexBufferBase ()
 
int get_vertexID () const
 
uint get_index () const
 
std::string get_label () const
 
void MPImode_only (std::string local_info)
 MPI mode error Put in functions which should not run if MPImode=false. More...
 
virtual unsigned long dset_head_pos ()=0
 
virtual void sync_report ()=0
 
virtual void flush ()=0
 
virtual void RA_flush (const std::map< PPIDpair, ulong > &PPID_to_dsetindex)=0
 
virtual void finalise ()=0
 
virtual std::size_t postponed_RA_queue_length ()=0
 
virtual uint get_RA_queue_length ()=0
 
virtual void reset (bool force=false)=0
 
virtual void skip_append ()=0
 
virtual void N_skip_append (ulong N)=0
 Skip several/many positions NOTE! This is meant for initialising new buffers to the correct position. More...
 
virtual ulong get_dataset_length ()=0
 
bool donepoint ()
 
void set_donepoint (bool flag)
 
void move_head_to_next_slot ()
 
void fast_forward (long target_pos)
 
void reset_head ()
 
void error_if_done ()
 
virtual void synchronise_output_to_position (const unsigned long i)=0
 
char access_mode () const
 Buffer status getters. More...
 
bool sync_buffer_is_full () const
 
bool sync_buffer_is_empty () const
 
bool is_synchronised () const
 
bool is_silenced () const
 
bool resume_mode () const
 
bool MPI_mode () const
 
unsigned int get_head_position () const
 

Protected Attributes

bool sync_buffer_full = false
 flag to indicate if the sync buffer is full (and ready for sending/dumping) More...
 
bool sync_buffer_empty = true
 

Private Attributes

bool donethispoint = false
 
std::string label
 
int vertexID
 
uint index
 
unsigned int head_position = 0
 
bool synchronised
 flag to trigger synchronised buffer writing More...
 
bool silenced
 flag to disable any writing (turns this into a null buffer) More...
 
bool resume
 flag to indicate that GAMBIT is attempting to resume a run, so we need to hook into existing output streams rather than create new ones More...
 
bool MPImode
 flag to indicate whether full buffers should be written to disk, or whether they should be send to the master node via MPI. More...
 
char access
 flag to indicate the buffer access mode (i.e. read/write) More...
 

Detailed Description

VertexBuffer abstract interface base class.

Definition at line 33 of file VertexBufferBase.hpp.

Constructor & Destructor Documentation

◆ VertexBufferBase() [1/2]

Gambit::Printers::VertexBufferBase::VertexBufferBase ( )
inline

Definition at line 71 of file VertexBufferBase.hpp.

72  : label("None (Bug!)")
73  , vertexID(0)
74  , index(0)
75  , synchronised(true)
76  , silenced(false)
77  , resume(false)
78  , MPImode(false)
79  {
80  #ifdef HDF5_DEBUG
81  std::cout<<"Default constructing buffer name='"<<label<<"', synchronised="<<synchronised<<std::endl;
82  #endif
83  }
bool resume
flag to indicate that GAMBIT is attempting to resume a run, so we need to hook into existing output s...
bool silenced
flag to disable any writing (turns this into a null buffer)
bool synchronised
flag to trigger synchronised buffer writing
bool MPImode
flag to indicate whether full buffers should be written to disk, or whether they should be send to th...

◆ VertexBufferBase() [2/2]

Gambit::Printers::VertexBufferBase::VertexBufferBase ( const std::string &  l,
const int  vID,
const uint  i,
const bool  sync,
const bool  sil,
const bool  r,
const bool  mode,
const char  a 
)
inline

Definition at line 85 of file VertexBufferBase.hpp.

86  : label(l)
87  , vertexID(vID)
88  , index(i)
89  , synchronised(sync)
90  , silenced(sil)
91  , resume(r)
92  , MPImode(mode)
93  , access(a)
94  {
95  #ifdef HDF5_DEBUG
96  std::cout<<"Constructing buffer name='"<<label<<"', synchronised="<<synchronised<<std::endl;
97  #endif
98  }
bool resume
flag to indicate that GAMBIT is attempting to resume a run, so we need to hook into existing output s...
bool silenced
flag to disable any writing (turns this into a null buffer)
bool synchronised
flag to trigger synchronised buffer writing
START_MODEL dNur_CMB r
char access
flag to indicate the buffer access mode (i.e. read/write)
bool MPImode
flag to indicate whether full buffers should be written to disk, or whether they should be send to th...

◆ ~VertexBufferBase()

virtual Gambit::Printers::VertexBufferBase::~VertexBufferBase ( )
inlinevirtual

Definition at line 100 of file VertexBufferBase.hpp.

101  {
102  #ifdef HDF5_DEBUG
103  std::cout<<"Destructing buffer name='"<<label<<"'"<<std::endl;
104  #endif
105  }

Member Function Documentation

◆ access_mode()

char Gambit::Printers::VertexBufferBase::access_mode ( ) const
inline

Buffer status getters.

Definition at line 113 of file VertexBufferBase.hpp.

References access.

Referenced by Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >::VertexBufferNumeric1D_HDF5().

113 { return access; }
char access
flag to indicate the buffer access mode (i.e. read/write)
Here is the caller graph for this function:

◆ donepoint()

bool Gambit::Printers::VertexBufferBase::donepoint ( )
inline

◆ dset_head_pos()

virtual unsigned long Gambit::Printers::VertexBufferBase::dset_head_pos ( )
pure virtual

◆ error_if_done()

void Gambit::Printers::VertexBufferBase::error_if_done ( )
inline

Definition at line 232 of file VertexBufferBase.hpp.

References LOCAL_INFO, Gambit::Printers::printer_error(), and synchronise_output_to_position().

233  {
234  if(donethispoint)
235  {
236  std::ostringstream errmsg;
237  errmsg << "Error! VertexBuffer set to 'done'! Append may have been attempted without moving the buffer write head forward (.";
238  printer_error().raise(LOCAL_INFO, errmsg.str());
239  }
240  }
EXPORT_SYMBOLS error & printer_error()
Printer errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
Here is the call graph for this function:

◆ fast_forward()

void Gambit::Printers::VertexBufferBase::fast_forward ( long  target_pos)
inline

Definition at line 212 of file VertexBufferBase.hpp.

References dset_head_pos(), flush(), get_label(), LOCAL_INFO, Gambit::Printers::printer_error(), skip_append(), and sync_buffer_is_full().

213  {
214  long needed_steps = target_pos - dset_head_pos();
215  if(needed_steps<0)
216  {
217  std::ostringstream errmsg;
218  errmsg << "Error while attempted to fast_forward VertexBuffer '"<<get_label()<<"'! Number of iterations required to teach target position ("<<target_pos<<") from current position ("<<dset_head_pos()<<") is negative, i.e. we would need to move backwards. This function does not allow reverse movement of the buffer write head.";
219  printer_error().raise(LOCAL_INFO, errmsg.str());
220  }
221  for(long i=0; i<needed_steps; i++)
222  {
223  skip_append();
224  if(sync_buffer_is_full()) flush();
225  }
226  }
EXPORT_SYMBOLS error & printer_error()
Printer errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
virtual unsigned long dset_head_pos()=0
Here is the call graph for this function:

◆ finalise()

virtual void Gambit::Printers::VertexBufferBase::finalise ( )
pure virtual

Implemented in Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >.

Referenced by MPImode_only().

Here is the caller graph for this function:

◆ flush()

virtual void Gambit::Printers::VertexBufferBase::flush ( )
pure virtual

◆ get_dataset_length()

virtual ulong Gambit::Printers::VertexBufferBase::get_dataset_length ( )
pure virtual

Implemented in Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >.

Referenced by MPImode_only().

Here is the caller graph for this function:

◆ get_head_position()

◆ get_index()

uint Gambit::Printers::VertexBufferBase::get_index ( ) const
inline

Definition at line 109 of file VertexBufferBase.hpp.

References index.

◆ get_label()

◆ get_RA_queue_length()

virtual uint Gambit::Printers::VertexBufferBase::get_RA_queue_length ( )
pure virtual

Implemented in Gambit::Printers::VertexBufferNumeric1D< T, LENGTH >, and Gambit::Printers::VertexBufferNumeric1D< T, CHUNKLENGTH >.

Referenced by MPImode_only().

Here is the caller graph for this function:

◆ get_vertexID()

int Gambit::Printers::VertexBufferBase::get_vertexID ( ) const
inline

Definition at line 108 of file VertexBufferBase.hpp.

References vertexID.

◆ is_silenced()

bool Gambit::Printers::VertexBufferBase::is_silenced ( ) const
inline

◆ is_synchronised()

◆ move_head_to_next_slot()

void Gambit::Printers::VertexBufferBase::move_head_to_next_slot ( )
inline

Definition at line 204 of file VertexBufferBase.hpp.

205  {
206  head_position++;
207  //std::cout<<"Advanced head of buffer "<<get_label()<<" to pos. "<<head_position<<std::endl;
208  }

◆ MPI_mode()

◆ MPImode_only()

void Gambit::Printers::VertexBufferBase::MPImode_only ( std::string  local_info)
inline

MPI mode error Put in functions which should not run if MPImode=false.

Definition at line 125 of file VertexBufferBase.hpp.

References dset_head_pos(), finalise(), flush(), get_dataset_length(), get_label(), get_RA_queue_length(), combine_hdf5::N, N_skip_append(), postponed_RA_queue_length(), Gambit::Printers::printer_error(), RA_flush(), reset(), skip_append(), and sync_report().

126  {
127  if(not MPImode)
128  {
129  std::ostringstream errmsg;
130  errmsg << "Error! Attempted to use forbidden function in buffer "<<this->get_label()<<". This function is flagged as usable only if MPImode=true, however currently it is the case that MPImode=false.";
131  printer_error().raise(local_info, errmsg.str());
132  }
133  }
EXPORT_SYMBOLS error & printer_error()
Printer errors.
bool MPImode
flag to indicate whether full buffers should be written to disk, or whether they should be send to th...
Here is the call graph for this function:

◆ N_skip_append()

virtual void Gambit::Printers::VertexBufferBase::N_skip_append ( ulong  N)
pure virtual

Skip several/many positions NOTE! This is meant for initialising new buffers to the correct position.

If buffer overflows it may get cleared without data being written, so don't use this in other contexts.

Implemented in Gambit::Printers::VertexBufferNumeric1D< T, LENGTH >, and Gambit::Printers::VertexBufferNumeric1D< T, CHUNKLENGTH >.

Referenced by MPImode_only().

Here is the caller graph for this function:

◆ postponed_RA_queue_length()

virtual std::size_t Gambit::Printers::VertexBufferBase::postponed_RA_queue_length ( )
pure virtual

Implemented in Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >.

Referenced by MPImode_only().

Here is the caller graph for this function:

◆ RA_flush()

virtual void Gambit::Printers::VertexBufferBase::RA_flush ( const std::map< PPIDpair, ulong > &  PPID_to_dsetindex)
pure virtual

Implemented in Gambit::Printers::VertexBufferNumeric1D< T, LENGTH >, and Gambit::Printers::VertexBufferNumeric1D< T, CHUNKLENGTH >.

Referenced by MPImode_only().

Here is the caller graph for this function:

◆ reset()

virtual void Gambit::Printers::VertexBufferBase::reset ( bool  force = false)
pure virtual

Implemented in Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >.

Referenced by MPImode_only().

Here is the caller graph for this function:

◆ reset_head()

void Gambit::Printers::VertexBufferBase::reset_head ( )
inline

Definition at line 229 of file VertexBufferBase.hpp.

◆ resume_mode()

bool Gambit::Printers::VertexBufferBase::resume_mode ( ) const
inline

Definition at line 118 of file VertexBufferBase.hpp.

References resume.

118 { return resume; }
bool resume
flag to indicate that GAMBIT is attempting to resume a run, so we need to hook into existing output s...

◆ set_donepoint()

void Gambit::Printers::VertexBufferBase::set_donepoint ( bool  flag)
inline

Definition at line 201 of file VertexBufferBase.hpp.

◆ skip_append()

virtual void Gambit::Printers::VertexBufferBase::skip_append ( )
pure virtual

◆ sync_buffer_is_empty()

bool Gambit::Printers::VertexBufferBase::sync_buffer_is_empty ( ) const
inline

Definition at line 115 of file VertexBufferBase.hpp.

References sync_buffer_empty.

Referenced by Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >::write_to_disk().

Here is the caller graph for this function:

◆ sync_buffer_is_full()

bool Gambit::Printers::VertexBufferBase::sync_buffer_is_full ( ) const
inline

Definition at line 114 of file VertexBufferBase.hpp.

References sync_buffer_full.

Referenced by fast_forward(), and Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >::synchronise_output_to_position().

114 { return sync_buffer_full; }
bool sync_buffer_full
flag to indicate if the sync buffer is full (and ready for sending/dumping)
Here is the caller graph for this function:

◆ sync_report()

virtual void Gambit::Printers::VertexBufferBase::sync_report ( )
pure virtual

Implemented in Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >.

Referenced by MPImode_only().

Here is the caller graph for this function:

◆ synchronise_output_to_position()

virtual void Gambit::Printers::VertexBufferBase::synchronise_output_to_position ( const unsigned long  i)
pure virtual

Referenced by error_if_done().

Here is the caller graph for this function:

Member Data Documentation

◆ access

char Gambit::Printers::VertexBufferBase::access
private

flag to indicate the buffer access mode (i.e. read/write)

Definition at line 63 of file VertexBufferBase.hpp.

Referenced by access_mode().

◆ donethispoint

bool Gambit::Printers::VertexBufferBase::donethispoint = false
private

Definition at line 37 of file VertexBufferBase.hpp.

Referenced by donepoint().

◆ head_position

unsigned int Gambit::Printers::VertexBufferBase::head_position = 0
private

Definition at line 45 of file VertexBufferBase.hpp.

Referenced by get_head_position().

◆ index

uint Gambit::Printers::VertexBufferBase::index
private

Definition at line 42 of file VertexBufferBase.hpp.

Referenced by get_index().

◆ label

std::string Gambit::Printers::VertexBufferBase::label
private

Definition at line 40 of file VertexBufferBase.hpp.

Referenced by get_label().

◆ MPImode

bool Gambit::Printers::VertexBufferBase::MPImode
private

flag to indicate whether full buffers should be written to disk, or whether they should be send to the master node via MPI.

Different printers can use different modes.

Definition at line 60 of file VertexBufferBase.hpp.

Referenced by MPI_mode().

◆ resume

bool Gambit::Printers::VertexBufferBase::resume
private

flag to indicate that GAMBIT is attempting to resume a run, so we need to hook into existing output streams rather than create new ones

Definition at line 55 of file VertexBufferBase.hpp.

Referenced by resume_mode(), and Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >::VertexBufferNumeric1D_HDF5().

◆ silenced

bool Gambit::Printers::VertexBufferBase::silenced
private

flag to disable any writing (turns this into a null buffer)

Definition at line 51 of file VertexBufferBase.hpp.

Referenced by is_silenced().

◆ sync_buffer_empty

bool Gambit::Printers::VertexBufferBase::sync_buffer_empty = true
protected

Definition at line 68 of file VertexBufferBase.hpp.

Referenced by sync_buffer_is_empty().

◆ sync_buffer_full

bool Gambit::Printers::VertexBufferBase::sync_buffer_full = false
protected

flag to indicate if the sync buffer is full (and ready for sending/dumping)

Definition at line 67 of file VertexBufferBase.hpp.

Referenced by sync_buffer_is_full(), and Gambit::Printers::VertexBufferNumeric1D_HDF5< T, CHUNKLENGTH >::sync_report().

◆ synchronised

bool Gambit::Printers::VertexBufferBase::synchronised
private

flag to trigger synchronised buffer writing

Definition at line 48 of file VertexBufferBase.hpp.

Referenced by is_synchronised().

◆ vertexID

int Gambit::Printers::VertexBufferBase::vertexID
private

Definition at line 41 of file VertexBufferBase.hpp.

Referenced by get_vertexID().


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