IOSS 2.0
Loading...
Searching...
No Matches
Ioss::SerializeIO Class Reference

Class SerializeIO is a sentry class which performs serialization for mesh database I/O. More...

#include <Ioss_SerializeIO.h>

Collaboration diagram for Ioss::SerializeIO:
[legend]

Public Member Functions

 SerializeIO (const DatabaseIO *database_io)
 
 SerializeIO (const SerializeIO &from)=delete
 
SerializeIOoperator= (const SerializeIO &from)=delete
 
 ~SerializeIO ()
 

Static Public Member Functions

static IOSS_NODISCARD int getOwner ()
 
static IOSS_NODISCARD int getRank ()
 
static IOSS_NODISCARD int getSize ()
 
static IOSS_NODISCARD int getGroupRank ()
 
static IOSS_NODISCARD int getGroupSize ()
 
static void setGroupFactor (int factor)
 
static IOSS_NODISCARD bool isEnabled ()
 
static IOSS_NODISCARD bool inBarrier ()
 
static IOSS_NODISCARD bool inMyGroup ()
 

Private Attributes

const DatabaseIOm_databaseIO
 Database I/O pointer.
 
bool m_activeFallThru {true}
 No barriers since my group is running.
 

Static Private Attributes

static int s_groupFactor = 0
 Grouping factor.
 
static int s_size = -1
 Number of processors.
 
static int s_rank = -1
 My processor rank.
 
static int s_groupSize = -1
 Number of groups.
 
static int s_groupRank = -1
 My group rank.
 
static int s_owner = -1
 Group currently running.
 

Detailed Description

Class SerializeIO is a sentry class which performs serialization for mesh database I/O.

This sentry guards serialization of parallel I/O routines. At construction, it blocks the processes via an MPI barrier, releasing them to execute in groups specified by s_groupSize. At destruction, it continues to block via MPI barriers until all the processor have been released by the constructor.

In the case where the constructor is called, and the sentry is already active and owned by the processes group, the constructor and destructor simply fall through since the serialization is already in place at a higher level.

Note
All ranks must call the SerializeIO constructor synchronously.
It is recommended to use RAII and keep the area protected by the SerializeIO as small as possible.

The flow is that the ranks are split into groups of the specified size. Assume 3 ranks of group size 1.

  • First time through,
    • rank 0 falls through and
    • ranks 1, 2 sit at the barrier
    • rank 0 hits the destructor and then all 3 ranks are in the barrier so they all go to next step
    • (rank 1,2 in constructor, rank 0 in destructor)
  • s_owner is now equal to m_groupRank on rank 1, so it falls out of the do while;
    • rank 2 still in the constructor do while Barrier
    • rank 0 in the destructor do while Barrier
    • rank 1 does its work and calls destructor;
    • all ranks in Barrier, so they go to next step.
  • s_owner now equal to m_groupRank on rank 2, so if falls out of the do while;
    • ranks 0,1 in destructor do while at the Barrier
    • rank 2 does it work and calls destructor
    • all ranks are now in the destructor Barrier, so they go to next step
    • all ranks clear the Destructor and go to next step.

Constructor & Destructor Documentation

◆ SerializeIO() [1/2]

Ioss::SerializeIO::SerializeIO ( const DatabaseIO * database_io)
explicit

Creates a new SerializeIO instance.

Parameters
database_ioa DatabaseIO variable ...

◆ SerializeIO() [2/2]

Ioss::SerializeIO::SerializeIO ( const SerializeIO & from)
delete

◆ ~SerializeIO()

Ioss::SerializeIO::~SerializeIO ( )

Member Function Documentation

◆ getGroupRank()

static IOSS_NODISCARD int Ioss::SerializeIO::getGroupRank ( )
inlinestatic

◆ getGroupSize()

static IOSS_NODISCARD int Ioss::SerializeIO::getGroupSize ( )
inlinestatic

◆ getOwner()

static IOSS_NODISCARD int Ioss::SerializeIO::getOwner ( )
inlinestatic

◆ getRank()

static IOSS_NODISCARD int Ioss::SerializeIO::getRank ( )
inlinestatic

◆ getSize()

static IOSS_NODISCARD int Ioss::SerializeIO::getSize ( )
inlinestatic

◆ inBarrier()

static IOSS_NODISCARD bool Ioss::SerializeIO::inBarrier ( )
inlinestatic

◆ inMyGroup()

static IOSS_NODISCARD bool Ioss::SerializeIO::inMyGroup ( )
inlinestatic

◆ isEnabled()

static IOSS_NODISCARD bool Ioss::SerializeIO::isEnabled ( )
inlinestatic

◆ operator=()

SerializeIO & Ioss::SerializeIO::operator= ( const SerializeIO & from)
delete

◆ setGroupFactor()

void Ioss::SerializeIO::setGroupFactor ( int factor)
static

Member Data Documentation

◆ m_activeFallThru

bool Ioss::SerializeIO::m_activeFallThru {true}
private

No barriers since my group is running.

◆ m_databaseIO

const DatabaseIO* Ioss::SerializeIO::m_databaseIO
private

Database I/O pointer.

◆ s_groupFactor

int Ioss::SerializeIO::s_groupFactor = 0
staticprivate

Grouping factor.

◆ s_groupRank

int Ioss::SerializeIO::s_groupRank = -1
staticprivate

My group rank.

◆ s_groupSize

int Ioss::SerializeIO::s_groupSize = -1
staticprivate

Number of groups.

◆ s_owner

int Ioss::SerializeIO::s_owner = -1
staticprivate

Group currently running.

◆ s_rank

int Ioss::SerializeIO::s_rank = -1
staticprivate

My processor rank.

◆ s_size

int Ioss::SerializeIO::s_size = -1
staticprivate

Number of processors.


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