Skip to content

Commit

Permalink
missing logLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
arng40 committed Jan 20, 2025
1 parent 2c88cc0 commit a3f0c85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/coreComponents/fileIO/Outputs/TimeHistoryOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ TimeHistoryOutput::TimeHistoryOutput( string const & name,

addLogLevel< logInfo::DataCollectorInitialization >();
addLogLevel< logInfo::OutputEvents >();
addLogLevel< logInfo::HDF5Writing >();
}

void TimeHistoryOutput::initCollectorParallel( DomainPartition const & domain, HistoryCollection & collector )
Expand Down
22 changes: 14 additions & 8 deletions src/coreComponents/fileIO/timeHistory/HDFHistoryIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "HDFHistoryIO.hpp"

#include "HDFFile.hpp"
#include "fileIO/LogLevelsInfo.hpp"

#include "common/MpiWrapper.hpp"

Expand Down Expand Up @@ -212,9 +213,11 @@ void HDFHistoryIO::init( bool existsOkay )
// create a dataset in the file if needed, don't erase file
if( subcomm != MPI_COMM_NULL )
{
GEOS_LOG_RANK_IF( this->getLogLevel() >= 3, GEOS_FMT( "TimeHistory: opening file {}.", m_filename ) );
GEOS_LOG_RANK_IF( this->getLogLevel() >= logInfo::HDF5Writing::getMinLogLevel(),
GEOS_FMT( "TimeHistory: opening file {}.", m_filename ) );
HDFFile target( m_filename, false, true, subcomm );
GEOS_LOG_RANK_IF( this->getLogLevel() >= 3, GEOS_FMT( "TimeHistory: opened file {}.", m_filename ) );
GEOS_LOG_RANK_IF( this->getLogLevel() >= logInfo::HDF5Writing::getMinLogLevel(),
GEOS_FMT( "TimeHistory: opened file {}.", m_filename ) );
bool inTarget = target.hasDataset( m_name );
if( !inTarget )
{
Expand All @@ -238,7 +241,7 @@ void HDFHistoryIO::init( bool existsOkay )
maxFileDims[1] = H5S_UNLIMITED;
hid_t space = H5Screate_simple( m_rank+1, &historyFileDims[0], &maxFileDims[0] );
hid_t dataset = H5Dcreate( target, m_name.c_str(), m_hdfType, space, H5P_DEFAULT, dcplId, H5P_DEFAULT );
GEOS_LOG_RANK_IF( this->getLogLevel() >= 3,
GEOS_LOG_RANK_IF( this->getLogLevel() >= logInfo::HDF5Writing::getMinLogLevel(),
GEOS_FMT( "TimeHistory: {}, created hdf5 dataset {}.", m_filename, m_name ) );
H5Dclose( dataset );
H5Sclose( space );
Expand All @@ -252,7 +255,8 @@ void HDFHistoryIO::init( bool existsOkay )
{
GEOS_ERROR( "Dataset (" + m_name + ") already exists in output file: " + m_filename );
}
GEOS_LOG_RANK_IF( this->getLogLevel() >= 3, GEOS_FMT( "TimeHistory: closed file {}.", m_filename ) );
GEOS_LOG_RANK_IF( this->getLogLevel() >= logInfo::HDF5Writing::getMinLogLevel(),
GEOS_FMT( "TimeHistory: closed file {}.", m_filename ) );
}
}

Expand Down Expand Up @@ -286,9 +290,11 @@ void HDFHistoryIO::write()

if( m_subcomm != MPI_COMM_NULL )
{
GEOS_LOG_RANK_IF( this->getLogLevel() >= 3, GEOS_FMT( "TimeHistory: opening file {}.", m_filename ) );
GEOS_LOG_RANK_IF( this->getLogLevel() >= logInfo::HDF5Writing::getMinLogLevel(),
GEOS_FMT( "TimeHistory: opening file {}.", m_filename ) );
HDFFile target( m_filename, false, true, m_subcomm );
GEOS_LOG_RANK_IF( this->getLogLevel() >= 3, GEOS_FMT( "TimeHistory: opened file {}.", m_filename ) );
GEOS_LOG_RANK_IF( this->getLogLevel() >= logInfo::HDF5Writing::getMinLogLevel(),
GEOS_FMT( "TimeHistory: opened file {}.", m_filename ) );

if( !target.hasDataset( m_name ) )
{
Expand Down Expand Up @@ -318,7 +324,7 @@ void HDFHistoryIO::write()
hid_t dxplId = H5Pcreate( H5P_DATASET_XFER );
H5Pset_dxpl_mpio( dxplId, H5FD_MPIO_COLLECTIVE );
H5Dwrite( dataset, m_hdfType, memspace, fileHyperslab, dxplId, dataBuffer );
GEOS_LOG_RANK_IF( this->getLogLevel() >= 3,
GEOS_LOG_RANK_IF( this->getLogLevel() >= logInfo::HDF5Writing::getMinLogLevel(),
GEOS_FMT( "TimeHistory: wrote row {} of dataset '{}'.", m_writeHead, m_name ) );
H5Pclose( dxplId );

Expand All @@ -337,7 +343,7 @@ void HDFHistoryIO::write()
H5Sclose( memspace );
H5Sclose( filespace );
H5Dclose( dataset );
GEOS_LOG_RANK_IF( this->getLogLevel() >= 3,
GEOS_LOG_RANK_IF( this->getLogLevel() >= logInfo::HDF5Writing::getMinLogLevel(),
GEOS_FMT( "TimeHistory: closing file {}.", m_filename ) );
}
m_writeHead++;
Expand Down

0 comments on commit a3f0c85

Please sign in to comment.