libSplash
Classes | Public Member Functions | List of all members
splash::ParallelDataCollector Class Reference

#include <ParallelDataCollector.hpp>

Inheritance diagram for splash::ParallelDataCollector:
Inheritance graph
[legend]
Collaboration diagram for splash::ParallelDataCollector:
Collaboration graph
[legend]

Public Member Functions

 ParallelDataCollector (MPI_Comm comm, MPI_Info info, const Dimensions topology, uint32_t maxFileHandles)
 
virtual ~ParallelDataCollector ()
 
void open (const char *filename, FileCreationAttr &attr) throw (DCException)
 
void close ()
 
int32_t getMaxID ()
 
void getMPISize (Dimensions &mpiSize)
 
void getEntryIDs (int32_t *ids, size_t *count) throw (DCException)
 
void getEntriesForID (int32_t id, DCEntry *entries, size_t *count) throw (DCException)
 
void write (int32_t id, const CollectionType &type, uint32_t rank, const Selection select, const char *name, const void *buf) throw (DCException)
 
void write (int32_t id, const Dimensions globalSize, const Dimensions globalOffset, const CollectionType &type, uint32_t rank, const Selection select, const char *name, const void *buf)
 
void reserve (int32_t id, const Dimensions globalSize, uint32_t rank, const CollectionType &type, const char *name) throw (DCException)
 
void reserve (int32_t id, const Dimensions size, Dimensions *globalSize, Dimensions *globalOffset, uint32_t rank, const CollectionType &type, const char *name) throw (DCException)
 
void append (int32_t id, const Dimensions size, uint32_t rank, const Dimensions globalOffset, const char *name, const void *buf)
 
void remove (int32_t id) throw (DCException)
 
void remove (int32_t id, const char *name) throw (DCException)
 
void createReference (int32_t srcID, const char *srcName, int32_t dstID, const char *dstName) throw (DCException)
 
AttributeInfo readGlobalAttributeInfo (int32_t id, const char *name, Dimensions *mpiPosition=NULL) throw (DCException)
 
void readGlobalAttribute (int32_t id, const char *name, void *buf) throw (DCException)
 
void writeGlobalAttribute (int32_t id, const CollectionType &type, const char *name, const void *buf) throw (DCException)
 
void writeGlobalAttribute (int32_t id, const CollectionType &type, const char *name, uint32_t ndims, const Dimensions dims, const void *buf) throw (DCException)
 
AttributeInfo readAttributeInfo (int32_t id, const char *dataName, const char *attrName, Dimensions *mpiPosition=NULL) throw (DCException)
 
void readAttribute (int32_t id, const char *dataName, const char *attrName, void *buf, Dimensions *mpiPosition=NULL) throw (DCException)
 
void writeAttribute (int32_t id, const CollectionType &type, const char *dataName, const char *attrName, const void *buf) throw (DCException)
 
void writeAttribute (int32_t id, const CollectionType &type, const char *dataName, const char *attrName, uint32_t ndims, const Dimensions dims, const void *buf) throw (DCException)
 
void read (int32_t id, const char *name, Dimensions &sizeRead, void *buf) throw (DCException)
 
void read (int32_t id, const char *name, const Dimensions dstBuffer, const Dimensions dstOffset, Dimensions &sizeRead, void *buf) throw (DCException)
 
CollectionTypereadMeta (int32_t id, const char *name, const Dimensions dstBuffer, const Dimensions dstOffset, Dimensions &sizeRead) throw (DCException)
 
void read (int32_t id, const Dimensions localSize, const Dimensions globalOffset, const char *name, Dimensions &sizeRead, void *buf) throw (DCException)
 
void read (int32_t id, const Dimensions localSize, const Dimensions globalOffset, const char *name, const Dimensions dstBuffer, const Dimensions dstOffset, Dimensions &sizeRead, void *buf) throw (DCException)
 
void finalize (void)
 
- Public Member Functions inherited from splash::DataCollector
virtual ~DataCollector ()
 

Additional Inherited Members

- Public Types inherited from splash::DataCollector
enum  FileAccType { FAT_CREATE, FAT_READ, FAT_READ_MERGED, FAT_WRITE }
 
typedef struct splash::DataCollector::_FileCreationAttr FileCreationAttr
 
typedef struct splash::DataCollector::_DCEntry DCEntry
 
- Static Public Member Functions inherited from splash::DataCollector
static void initFileCreationAttr (FileCreationAttr &attr)
 

Detailed Description

Realizes an IParallelDataCollector which creates a single HDF5 file per iteration for all MPI processes and accesses the file using collective MPI I/O.

Definition at line 49 of file ParallelDataCollector.hpp.

Constructor & Destructor Documentation

◆ ParallelDataCollector()

splash::ParallelDataCollector::ParallelDataCollector ( MPI_Comm  comm,
MPI_Info  info,
const Dimensions  topology,
uint32_t  maxFileHandles 
)

Constructor

Parameters
commThe communicator. All processes in this communicator must participate in accessing data.
infoThe MPI_Info object.
topologyNumber of MPI processes in each dimension.
maxFileHandlesMaximum number of concurrently opened file handles (0=infinite).

Definition at line 156 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ ~ParallelDataCollector()

splash::ParallelDataCollector::~ParallelDataCollector ( )
virtual

Destructor

Definition at line 196 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ append()

void splash::ParallelDataCollector::append ( int32_t  id,
const Dimensions  size,
uint32_t  rank,
const Dimensions  globalOffset,
const char *  name,
const void *  buf 
)
virtual

Appends (1-3) dimensional data to a dataset created with IParallelDataCollector::reserve.

Parameters
idID for iteration.
sizeSize of the data to be appended.
rankNumber of dimensions (1-3),
globalOffsetOffset in destination dataset to append at.
nameName for the dataset to append to.
bufBuffer to append.

Implements splash::IParallelDataCollector.

Definition at line 716 of file ParallelDataCollector.cpp.

Here is the caller graph for this function:

◆ close()

void splash::ParallelDataCollector::close ( )
virtual

Closes open files and releases internal buffers.

Must be called by user when finished writing/reading data.

Implements splash::DataCollector.

Definition at line 241 of file ParallelDataCollector.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createReference()

void splash::ParallelDataCollector::createReference ( int32_t  srcID,
const char *  srcName,
int32_t  dstID,
const char *  dstName 
)
throw (DCException
)
virtual

Creates an object reference to an existing dataset in the same HDF5 file.

Parameters
srcIDID of the iteration holding the source dataset.
srcNameName of the existing source dataset.
dstIDID of the simulation iteration holding the created reference dataset. If this group does not exist, it is created.
dstNameName of the created reference.

Implements splash::DataCollector.

Definition at line 793 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ finalize()

void splash::ParallelDataCollector::finalize ( void  )
virtual

Finalizes by freeing all MPI resources. Must be called before MPI_Finalize.

Implements splash::IParallelDataCollector.

Definition at line 203 of file ParallelDataCollector.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntriesForID()

void splash::ParallelDataCollector::getEntriesForID ( int32_t  id,
DCEntry entries,
size_t *  count 
)
throw (DCException
)
virtual

Returns all datasets for an ID. The caller must ensure that there is enough space in entries to hold count elements.

Parameters
idID for iteration.
entriesPointer to an array with at least count elements, can be NULL.
countReturns the number of elements in entries, can be NULL.

Implements splash::DataCollector.

Definition at line 293 of file ParallelDataCollector.cpp.

Here is the caller graph for this function:

◆ getEntryIDs()

void splash::ParallelDataCollector::getEntryIDs ( int32_t *  ids,
size_t *  count 
)
throw (DCException
)
virtual

Returns all IDs in an opened file. The caller must ensure that there is enough space in ids to hold count elements.

Parameters
idsPointer to an array with at least count entries, can be NULL.
countReturns the number of entries in ids, can be NULL.

Implements splash::DataCollector.

Definition at line 272 of file ParallelDataCollector.cpp.

◆ getMaxID()

int32_t splash::ParallelDataCollector::getMaxID ( )
virtual
Returns
Returns highest iteration ID.

Implements splash::DataCollector.

Definition at line 256 of file ParallelDataCollector.cpp.

Here is the caller graph for this function:

◆ getMPISize()

void splash::ParallelDataCollector::getMPISize ( Dimensions mpiSize)
virtual

Returns the MPI topology used for creating files.

Parameters
mpiSizeContains MPI topology.

Implements splash::DataCollector.

Definition at line 267 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ open()

void splash::ParallelDataCollector::open ( const char *  filename,
FileCreationAttr attr 
)
throw (DCException
)
virtual

Opens one or multiple files.

Parameters
filenameName of the file(s) to open (the common part without index identifiers).
attrStruct passing several parameters on how to access files.

Implements splash::DataCollector.

Definition at line 213 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ read() [1/4]

void splash::ParallelDataCollector::read ( int32_t  id,
const char *  name,
Dimensions sizeRead,
void *  buf 
)
throw (DCException
)
virtual

Reads data from HDF5 file. If data is to be read (instead of only its size in the file), the destination buffer (buf) must be allocated already.

Parameters
idID for iteration.
nameName for the dataset.
sizeReadReturns the size of the data in the file.
bufBuffer to read from file, can be NULL.

Implements splash::DataCollector.

Definition at line 565 of file ParallelDataCollector.cpp.

Here is the caller graph for this function:

◆ read() [2/4]

void splash::ParallelDataCollector::read ( int32_t  id,
const char *  name,
const Dimensions  dstBuffer,
const Dimensions  dstOffset,
Dimensions sizeRead,
void *  buf 
)
throw (DCException
)
virtual

Reads data from HDF5 file. If data is to be read (instead of only its size in the file), the destination buffer (buf) must be allocated already.

Parameters
idID for iteration.
nameName for the dataset.
dstBufferSize of the buffer buf to read to.
dstOffsetOffset in destination buffer to read to.
sizeReadReturns the size of the data in the file.
bufBuffer to read from file, can be NULL.

Implements splash::DataCollector.

Definition at line 574 of file ParallelDataCollector.cpp.

◆ read() [3/4]

void splash::ParallelDataCollector::read ( int32_t  id,
const Dimensions  localSize,
const Dimensions  globalOffset,
const char *  name,
Dimensions sizeRead,
void *  buf 
)
throw (DCException
)

Reads data from HDF5 file. If data is to be read (instead of only its size in the file), the destination buffer (buf) must be allocated already.

Parameters
idID for iteration.
localSizeSize of data to be read, starting at globalOffset.
globalOffsetGlobal offset in source data to start reading from.
nameName for the dataset.
sizeReadReturns the size of the data in the file.
bufBuffer to read from file, can be NULL.

Definition at line 590 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ read() [4/4]

void splash::ParallelDataCollector::read ( int32_t  id,
const Dimensions  localSize,
const Dimensions  globalOffset,
const char *  name,
const Dimensions  dstBuffer,
const Dimensions  dstOffset,
Dimensions sizeRead,
void *  buf 
)
throw (DCException
)

Reads data from HDF5 file. If data is to be read (instead of only its size in the file), the destination buffer (buf) must be allocated already.

Parameters
idID for iteration.
localSizeSize of data to be read, starting at globalOffset.
globalOffsetGlobal offset in source data to start reading from.
nameName for the dataset.
dstBufferSize of destination buffer.
dstOffsetOffset in destination buffer to read to.
sizeReadReturns the size of the data in the file.
bufBuffer to read from file, can be NULL.

Definition at line 601 of file ParallelDataCollector.cpp.

◆ readAttribute()

void splash::ParallelDataCollector::readAttribute ( int32_t  id,
const char *  dataName,
const char *  attrName,
void *  buf,
Dimensions mpiPosition = NULL 
)
throw (DCException
)
virtual

Reads an attribute from a single dataset.

Parameters
idID for iteration.
dataNameName of the dataset in group id to read attribute from. If dataName is NULL, the attribute is read from the iteration group.
attrNameName of the attribute.
bufBuffer to read attribute to.
mpiPositionPointer to Dimensions class. Identifies MPI-position-specific file while in FAT_READ_MERGED mode. Use NULL to read from default file index.

Implements splash::DataCollector.

Definition at line 457 of file ParallelDataCollector.cpp.

◆ readAttributeInfo()

AttributeInfo splash::ParallelDataCollector::readAttributeInfo ( int32_t  id,
const char *  dataName,
const char *  attrName,
Dimensions mpiPosition = NULL 
)
throw (DCException
)
virtual

Reads attribute meta data from a single dataset.

Parameters
idID for iteration.
dataNameName of the dataset in group id to read attribute from. If dataName is NULL, the attribute is read from the iteration group.
attrNameName of the attribute.
mpiPositionPointer to Dimensions class. Identifies MPI-position-specific file while in FAT_READ_MERGED mode. Use NULL to read from default file index.
Returns
Pointer to heap allocated DCAttributeInfo instance or NULL if not found. Must be freed by the caller.

Implements splash::DataCollector.

Definition at line 435 of file ParallelDataCollector.cpp.

Here is the caller graph for this function:

◆ readGlobalAttribute()

void splash::ParallelDataCollector::readGlobalAttribute ( int32_t  id,
const char *  name,
void *  buf 
)
throw (DCException
)
virtual

Reads global attribute from HDF5 file.

Parameters
idID for iteration.
nameName of the attribute.
bufDestination buffer for attribute.

Implements splash::IParallelDataCollector.

Definition at line 339 of file ParallelDataCollector.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readGlobalAttributeInfo()

AttributeInfo splash::ParallelDataCollector::readGlobalAttributeInfo ( int32_t  id,
const char *  name,
Dimensions mpiPosition = NULL 
)
throw (DCException
)
virtual

Reads global attribute meta information from HDF5 file.

Parameters
idID for iteration.
nameName for the attribute.
mpiPositionPointer to Dimensions class. Identifies MPI-position-specific custom group. Use NULL to read from default group.
Returns
Pointer to heap allocated DCAttributeInfo instance or NULL if not found. Must be freed by the caller.

Implements splash::DataCollector.

Definition at line 314 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ readMeta()

CollectionType * splash::ParallelDataCollector::readMeta ( int32_t  id,
const char *  name,
const Dimensions  dstBuffer,
const Dimensions  dstOffset,
Dimensions sizeRead 
)
throw (DCException
)
virtual

Reads meta data from HDF5 file.

Parameters
idID of iteration.
nameName of the dataset.
dstBufferSize of the dataset.
dstOffsetOffset in destination dataset.
sizeReadReturns the size of the data in the file.
Returns
The CollectionType of the dataset as a heap allocated object. The object must be freed by the caller at the end of the object's lifetime.

Implements splash::DataCollector.

Definition at line 618 of file ParallelDataCollector.cpp.

◆ remove() [1/2]

void splash::ParallelDataCollector::remove ( int32_t  id)
throw (DCException
)
virtual

Removes a simulation iteration from the HDF5 file.

Recursively removes all datasets and attributes within the iteration.

Parameters
idID to remove.

Implements splash::DataCollector.

Definition at line 753 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ remove() [2/2]

void splash::ParallelDataCollector::remove ( int32_t  id,
const char *  name 
)
throw (DCException
)
virtual

Removes a dataset from a HDF5 file.

Parameters
idID holding the dataset to be removed.
nameName of the dataset to be removed.

Implements splash::DataCollector.

Definition at line 770 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ reserve() [1/2]

void splash::ParallelDataCollector::reserve ( int32_t  id,
const Dimensions  globalSize,
uint32_t  rank,
const CollectionType type,
const char *  name 
)
throw (DCException
)
virtual

Reserves a dataset for parallel access.

Parameters
idID for iteration.
globalSizeSize to reserve for global data.
rankNumber of dimensions (1-3).
typeType information for data.
nameName for the dataset.

Implements splash::IParallelDataCollector.

Definition at line 669 of file ParallelDataCollector.cpp.

Here is the caller graph for this function:

◆ reserve() [2/2]

void splash::ParallelDataCollector::reserve ( int32_t  id,
const Dimensions  size,
Dimensions globalSize,
Dimensions globalOffset,
uint32_t  rank,
const CollectionType type,
const char *  name 
)
throw (DCException
)
virtual

Reserves a dataset for parallel access.

Parameters
idID for iteration.
sizeSize to reserve for local data.
globalSizeReturns the global size of the dataset, can be NULL.
globalOffsetReturns the global offset for the calling process, can be NULL.
rankNumber of dimensions (1-3).
typeType information for data.
nameName for the dataset.

Implements splash::IParallelDataCollector.

Definition at line 687 of file ParallelDataCollector.cpp.

◆ write() [1/2]

void splash::ParallelDataCollector::write ( int32_t  id,
const CollectionType type,
uint32_t  rank,
const Selection  select,
const char *  name,
const void *  buf 
)
throw (DCException
)
virtual

Implements DataCollector::write The global size and the write offset for the calling process are determined automatically via MPI among all participating processes. Note: This is not possible when writing 2D data with a 3D MPI topology.

Implements splash::IParallelDataCollector.

Definition at line 632 of file ParallelDataCollector.cpp.

Here is the caller graph for this function:

◆ write() [2/2]

void splash::ParallelDataCollector::write ( int32_t  id,
const Dimensions  globalSize,
const Dimensions  globalOffset,
const CollectionType type,
uint32_t  rank,
const Selection  select,
const char *  name,
const void *  buf 
)
virtual

Writes data to HDF5 file.

Parameters
idID for iteration
globalSizeSize of global collective write buffer.
globalOffsetOffset in globalSize buffer where this process writes to.
typeType information for data.
rankNumber of dimensions (1-3).
selectSelection in src buffer.
nameName for the dataset.
bufLocal buffer for writing.

Implements splash::IParallelDataCollector.

Definition at line 643 of file ParallelDataCollector.cpp.

◆ writeAttribute() [1/2]

void splash::ParallelDataCollector::writeAttribute ( int32_t  id,
const CollectionType type,
const char *  dataName,
const char *  attrName,
const void *  buf 
)
throw (DCException
)
virtual

Writes an attribute to a single dataset.

Parameters
idID for iteration.
typeType information for data.
dataNameName of the dataset in group id to write attribute to. If dataName is NULL, the attribute is written for the iteration group. If the path dataName does not yet exist, missing groups will be created.
attrNameName of the attribute.
bufBuffer to be written as attribute.

Implements splash::DataCollector.

Definition at line 480 of file ParallelDataCollector.cpp.

◆ writeAttribute() [2/2]

void splash::ParallelDataCollector::writeAttribute ( int32_t  id,
const CollectionType type,
const char *  dataName,
const char *  attrName,
uint32_t  ndims,
const Dimensions  dims,
const void *  buf 
)
throw (DCException
)
virtual

Writes an attribute to a single dataset.

Parameters
idID for iteration.
typeType information for data.
dataNameName of the dataset in group id to write attribute to. If dataName is NULL, the attribute is written for the iteration group.
attrNameName of the attribute.
ndimsNumber of dimensions (1-3)
dimsNumber of elements
bufBuffer to be written as attribute.

Implements splash::DataCollector.

Definition at line 492 of file ParallelDataCollector.cpp.

Here is the call graph for this function:

◆ writeGlobalAttribute()

void splash::ParallelDataCollector::writeGlobalAttribute ( int32_t  id,
const CollectionType type,
const char *  name,
const void *  buf 
)
throw (DCException
)
virtual

Writes global attribute to HDF5 file (default group).

Parameters
idID for iteration.
typeType information for data.
nameName of the attribute.
bufSource buffer for attribute.

Implements splash::IParallelDataCollector.

Definition at line 363 of file ParallelDataCollector.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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