diff --git a/examples/hello/bpWriter/helloBPWriter_nompi.cpp b/examples/hello/bpWriter/helloBPWriter_nompi.cpp index edb09e086fd8a8d9b20c8b3a04ea51070e5135d8..203db91ca951568987bffd85d9715233a594ab27 100644 --- a/examples/hello/bpWriter/helloBPWriter_nompi.cpp +++ b/examples/hello/bpWriter/helloBPWriter_nompi.cpp @@ -13,7 +13,7 @@ #include "ADIOS_CPP.h" -int main(int argc, char *argv[]) +int main(int /*argc*/, char ** /*argv*/) { const bool adiosDebug = true; adios::ADIOS adios(adios::Verbose::WARN, adiosDebug); @@ -55,7 +55,9 @@ int main(int argc, char *argv[]) adios::IOMode::COLLECTIVE); if (bpFileWriter == nullptr) + { throw std::ios_base::failure("ERROR: couldn't create bpWriter at Open\n"); + } bpFileWriter->Write<double>( ioMyDoubles, myDoubles.data()); // Base class Engine own the Write<T> diff --git a/source/engine/bp/BPFileWriter.cpp b/source/engine/bp/BPFileWriter.cpp index 2785781f002d0b499a7bbc328173080f435fb2ff..14f0d149bb0c0e80c266337208bff5c00c99d973 100644 --- a/source/engine/bp/BPFileWriter.cpp +++ b/source/engine/bp/BPFileWriter.cpp @@ -21,8 +21,8 @@ namespace adios BPFileWriter::BPFileWriter(ADIOS &adios, const std::string name, const std::string accessMode, MPI_Comm mpiComm, - const Method &method, const IOMode iomode, - const float timeout_sec, const bool debugMode, + const Method &method, const IOMode /*iomode*/, + const float /*timeout_sec*/, const bool debugMode, const unsigned int nthreads) : Engine(adios, "BPFileWriter", name, accessMode, mpiComm, method, debugMode, nthreads, " BPFileWriter constructor (or call to ADIOS Open).\n"), @@ -34,7 +34,7 @@ BPFileWriter::BPFileWriter(ADIOS &adios, const std::string name, Init(); } -BPFileWriter::~BPFileWriter() {} +BPFileWriter::~BPFileWriter() = default; void BPFileWriter::Init() { @@ -133,7 +133,10 @@ void BPFileWriter::Write(Variable<std::complex<long double>> &variable, WriteVariableCommon(variable, values); } -void BPFileWriter::Write(VariableCompound &variable, const void *values) {} +void BPFileWriter::Write(VariableCompound & /*variable*/, + const void * /*values*/) +{ +} // String version void BPFileWriter::Write(const std::string variableName, const char *values) @@ -232,12 +235,12 @@ void BPFileWriter::Write(const std::string variableName, m_ADIOS.GetVariable<std::complex<long double>>(variableName), values); } -void BPFileWriter::Write(const std::string variableName, - const void *values) // Compound type +void BPFileWriter::Write(const std::string /*variableName*/, + const void * /*values*/) // Compound type { } -void BPFileWriter::Advance(float timeout_sec) +void BPFileWriter::Advance(float /*timeout_sec*/) { m_BP1Writer.Advance(m_MetadataSet, m_Buffer); } @@ -247,10 +250,11 @@ void BPFileWriter::Close(const int transportIndex) CheckTransportIndex(transportIndex); if (transportIndex == -1) { - for (auto &transport : - m_Transports) // by reference or value or it doesn't matter? + for (auto &transport : m_Transports) + { // by reference or value or it doesn't matter? m_BP1Writer.Close(m_MetadataSet, m_Buffer, *transport, m_IsFirstClose, false); // false: not using aggregation for now + } } else { @@ -292,9 +296,11 @@ void BPFileWriter::InitParameters() if (m_DebugMode == true) { if (growthFactor == 1.f) + { throw std::invalid_argument( "ERROR: buffer_growth argument can't be less of equal than 1, in " + m_EndMessage + "\n"); + } } m_BP1Writer.m_GrowthFactor = growthFactor; @@ -307,9 +313,11 @@ void BPFileWriter::InitParameters() if (m_DebugMode == true) { if (m_GrowthFactor <= 1.f) + { throw std::invalid_argument("ERROR: Method buffer_growth argument " "can't be less of equal than 1, in " + m_EndMessage + "\n"); + } } m_MaxBufferSize = std::stoul(itMaxBufferSize->second) * @@ -323,9 +331,11 @@ void BPFileWriter::InitParameters() if (m_DebugMode == true) { if (verbosity < 0 || verbosity > 5) + { throw std::invalid_argument("ERROR: Method verbose argument must be an " "integer in the range [0,5], in call to " "Open or Engine constructor\n"); + } } m_BP1Writer.m_Verbosity = verbosity; } @@ -336,25 +346,33 @@ void BPFileWriter::InitParameters() auto &profiler = m_MetadataSet.Log; if (itProfile->second == "mus" || itProfile->second == "microseconds") + { profiler.m_Timers.emplace_back("buffering", Support::Resolutions::mus); - + } else if (itProfile->second == "ms" || itProfile->second == "milliseconds") + { profiler.m_Timers.emplace_back("buffering", Support::Resolutions::ms); - + } else if (itProfile->second == "s" || itProfile->second == "seconds") + { profiler.m_Timers.emplace_back("buffering", Support::Resolutions::s); - + } else if (itProfile->second == "min" || itProfile->second == "minutes") + { profiler.m_Timers.emplace_back("buffering", Support::Resolutions::m); - + } else if (itProfile->second == "h" || itProfile->second == "hours") + { profiler.m_Timers.emplace_back("buffering", Support::Resolutions::h); + } else { if (m_DebugMode == true) + { throw std::invalid_argument("ERROR: Method profile_buffering_units " "argument must be mus, ms, s, min or h, in " "call to Open or Engine constructor\n"); + } } profiler.m_IsActive = true; @@ -383,26 +401,33 @@ void BPFileWriter::InitTransports() if (itProfile != parameters.end()) { if (itProfile->second == "mus" || itProfile->second == "microseconds") + { resolution = Support::Resolutions::mus; - + } else if (itProfile->second == "ms" || itProfile->second == "milliseconds") + { resolution = Support::Resolutions::ms; - + } else if (itProfile->second == "s" || itProfile->second == "seconds") + { resolution = Support::Resolutions::s; - + } else if (itProfile->second == "min" || itProfile->second == "minutes") + { resolution = Support::Resolutions::m; - + } else if (itProfile->second == "h" || itProfile->second == "hours") + { resolution = Support::Resolutions::h; - + } else { if (m_DebugMode == true) + { throw std::invalid_argument("ERROR: Transport profile_units argument " "must be mus, ms, s, min or h " + m_EndMessage); + } } doProfiling = true; } @@ -418,7 +443,9 @@ void BPFileWriter::InitTransports() auto file = std::make_shared<transport::FileDescriptor>(m_MPIComm, m_DebugMode); if (doProfiling == true) + { file->InitProfiler(m_AccessMode, resolution); + } m_BP1Writer.OpenRankFiles(m_Name, m_AccessMode, *file); m_Transports.push_back(std::move(file)); @@ -428,7 +455,9 @@ void BPFileWriter::InitTransports() auto file = std::make_shared<transport::FilePointer>(m_MPIComm, m_DebugMode); if (doProfiling == true) + { file->InitProfiler(m_AccessMode, resolution); + } m_BP1Writer.OpenRankFiles(m_Name, m_AccessMode, *file); m_Transports.push_back(std::move(file)); @@ -440,7 +469,9 @@ void BPFileWriter::InitTransports() std::make_shared<transport::FStream>(m_MPIComm, m_DebugMode); if (doProfiling == true) + { file->InitProfiler(m_AccessMode, resolution); + } m_BP1Writer.OpenRankFiles(m_Name, m_AccessMode, *file); m_Transports.push_back(std::move(file)); @@ -451,17 +482,21 @@ void BPFileWriter::InitTransports() else { if (m_DebugMode == true) + { throw std::invalid_argument( "ERROR: file transport library " + itLibrary->second + " not supported, in " + m_Name + m_EndMessage); + } } } else { if (m_DebugMode == true) + { throw std::invalid_argument("ERROR: transport " + itTransport->second + " (you mean File?) not supported, in " + m_Name + m_EndMessage); + } } } } @@ -469,7 +504,9 @@ void BPFileWriter::InitTransports() void BPFileWriter::InitProcessGroup() { if (m_MetadataSet.Log.m_IsActive == true) + { m_MetadataSet.Log.m_Timers[0].SetInitialTime(); + } if (m_AccessMode == "a") { @@ -480,7 +517,9 @@ void BPFileWriter::InitProcessGroup() WriteProcessGroupIndex(); if (m_MetadataSet.Log.m_IsActive == true) + { m_MetadataSet.Log.m_Timers[0].SetTime(); + } } void BPFileWriter::WriteProcessGroupIndex() diff --git a/source/format/BP1.cpp b/source/format/BP1.cpp index c81e7b6fe34fcbb63f5e7e62472051ea99cbd672..e9ec112c5753ab5e7905a016cf17815ad7daa1bc 100644 --- a/source/format/BP1.cpp +++ b/source/format/BP1.cpp @@ -21,10 +21,13 @@ std::string BP1::GetDirectoryName(const std::string name) const noexcept std::string directory; if (name.find(".bp") == name.size() - 3) + { directory = name; + } else + { directory = name + ".bp"; - + } return directory; } @@ -48,15 +51,25 @@ std::vector<std::uint8_t> BP1::GetMethodIDs( auto lf_GetMethodID = [](const std::string method) -> std::uint8_t { int id = METHOD_UNKNOWN; if (method == "NULL") + { id = METHOD_NULL; + } else if (method == "POSIX") + { id = METHOD_POSIX; + } else if (method == "FStream") + { id = METHOD_FSTREAM; + } else if (method == "File") + { id = METHOD_FILE; + } else if (method == "MPI") + { id = METHOD_MPI; + } return id; }; @@ -65,7 +78,9 @@ std::vector<std::uint8_t> BP1::GetMethodIDs( methodIDs.reserve(transports.size()); for (const auto &transport : transports) + { methodIDs.push_back(lf_GetMethodID(transport->m_Type)); + } return methodIDs; } diff --git a/source/format/BP1Aggregator.cpp b/source/format/BP1Aggregator.cpp index c81a72bbffa7ebc2e25a4b3fb9e8873883264202..07ab430a25cd2d10642ba54f9b8d52facbf3c3cc 100644 --- a/source/format/BP1Aggregator.cpp +++ b/source/format/BP1Aggregator.cpp @@ -28,7 +28,7 @@ BP1Aggregator::BP1Aggregator(MPI_Comm mpiComm, const bool debugMode) MPI_Comm_size(m_MPIComm, &m_SizeMPI); } -BP1Aggregator::~BP1Aggregator() {} +BP1Aggregator::~BP1Aggregator() = default; void BP1Aggregator::WriteProfilingLog(const std::string fileName, const std::string &rankLog) @@ -44,8 +44,10 @@ void BP1Aggregator::WriteProfilingLog(const std::string fileName, // first receive sizes for (unsigned int i = 1; i < sizeMPI; ++i) + { MPI_Irecv(&rankLogsSizes[i - 1], 1, MPI_INT, i, 0, m_MPIComm, &requests[i]); + } for (unsigned int i = 1; i < sizeMPI; ++i) { @@ -53,20 +55,26 @@ void BP1Aggregator::WriteProfilingLog(const std::string fileName, if (m_DebugMode == true) { if (rankLogsSizes[i - 1] == -1) + { throw std::runtime_error("ERROR: couldn't get size from rank " + std::to_string(i) + ", in ADIOS aggregator for Profiling.log\n"); + } } rankLogs[i - 1].resize(rankLogsSizes[i - 1]); // allocate with zeros } // receive rankLog from other ranks for (unsigned int i = 1; i < sizeMPI; ++i) + { MPI_Irecv(rankLogs[i - 1].data(), rankLogsSizes[i - 1], MPI_CHAR, i, 1, m_MPIComm, &requests[i]); + } for (unsigned int i = 1; i < sizeMPI; ++i) + { MPI_Wait(&requests[i], &statuses[i]); + } // write file std::string logFile("log = { \n"); diff --git a/source/format/BP1Writer.cpp b/source/format/BP1Writer.cpp index b5aed5404ca9804d498b9f1220bc997f93643a14..cfe0288345c816933a28459560606db070a591e9 100644 --- a/source/format/BP1Writer.cpp +++ b/source/format/BP1Writer.cpp @@ -121,17 +121,23 @@ void BP1Writer::Close(BP1MetadataSet &metadataSet, capsule::STLVector &heap, const bool doAggregation) const noexcept { if (metadataSet.Log.m_IsActive == true) + { metadataSet.Log.m_Timers[0].SetInitialTime(); + } if (isFirstClose == true) { if (metadataSet.DataPGIsOpen == true) + { FlattenData(metadataSet, heap); + } FlattenMetadata(metadataSet, heap); if (metadataSet.Log.m_IsActive == true) + { metadataSet.Log.m_Timers[0].SetInitialTime(); + } if (doAggregation == true) // N-to-M where 1 <= M <= N-1, might need a new // Log metadataSet.Log.m_Timers just for @@ -177,7 +183,9 @@ std::string BP1Writer::GetRankProfilingLog( rankLog += "'lib': " + transports[t]->m_Type + ", "; for (unsigned int i = 0; i < 3; ++i) + { lf_WriterTimer(rankLog, timers[i]); + } rankLog += "}, "; } @@ -391,7 +399,9 @@ void BP1Writer::FlattenMetadata(BP1MetadataSet &metadataSet, heap.m_DataAbsolutePosition += footerSize; if (metadataSet.Log.m_IsActive == true) + { metadataSet.Log.m_TotalBytes.push_back(heap.m_DataAbsolutePosition); + } } } // end namespace format diff --git a/source/functions/adiosFunctions.cpp b/source/functions/adiosFunctions.cpp index 0886e029ad14a4e6fc4dd8b04b296071175d3678..55d4c68f8bb8ecfbc5438df90907ba392e8fa1c1 100644 --- a/source/functions/adiosFunctions.cpp +++ b/source/functions/adiosFunctions.cpp @@ -37,10 +37,12 @@ void DumpFileToString(const std::string fileName, std::string &fileContent) { std::ifstream fileStream(fileName); - if (fileStream.good() == false) // check file + if (fileStream.good() == false) + { // check file throw std::ios_base::failure( "ERROR: file " + fileName + " could not be opened. Check permissions or file existence\n"); + } std::ostringstream fileSS; fileSS << fileStream.rdbuf(); @@ -48,7 +50,9 @@ void DumpFileToString(const std::string fileName, std::string &fileContent) fileContent = fileSS.str(); // convert to string and check if (fileContent.empty()) + { throw std::invalid_argument("ERROR: file " + fileName + " is empty\n"); + } } void GetSubString(const std::string initialTag, const std::string finalTag, @@ -101,25 +105,35 @@ void GetSubString(const std::string initialTag, const std::string finalTag, (singleQuotePosition == content.npos && end < doubleQuotePosition) || (doubleQuotePosition == content.npos && end < singleQuotePosition) || (end < singleQuotePosition && end < doubleQuotePosition)) + { break; + } // find the closing corresponding quote std::string::size_type closingQuotePosition; - if (singleQuotePosition == content.npos) // no ' anywhere + if (singleQuotePosition == content.npos) + { // no ' anywhere lf_SetPositions('\"', doubleQuotePosition, content, currentPosition, closingQuotePosition); - else if (doubleQuotePosition == content.npos) // no " anywhere + } + else if (doubleQuotePosition == content.npos) + { // no " anywhere lf_SetPositions('\'', singleQuotePosition, content, currentPosition, closingQuotePosition); + } else { if (singleQuotePosition < doubleQuotePosition) + { lf_SetPositions('\'', singleQuotePosition, content, currentPosition, closingQuotePosition); - else // find the closing " + } + else + { // find the closing " lf_SetPositions('\"', doubleQuotePosition, content, currentPosition, closingQuotePosition); + } } if (closingQuotePosition == @@ -132,7 +146,9 @@ void GetSubString(const std::string initialTag, const std::string finalTag, currentPosition = closingQuotePosition + 1; if (closingQuotePosition < end) + { continue; + } // if this point is reached it means it's a value inside " " or ' ', move to // the next end @@ -151,8 +167,10 @@ void GetQuotedValue(const char quote, auto nextQuotePosition = currentTag.find(quote); if (nextQuotePosition == currentTag.npos) + { throw std::invalid_argument("ERROR: Invalid attribute in..." + currentTag + "...check XML file\n"); + } value = currentTag.substr(0, nextQuotePosition); currentTag = currentTag.substr(nextQuotePosition + 1); @@ -201,8 +219,10 @@ void GetPairsFromTag( ">"); // check for closing tagName if (fileContent.find(closingTagName) == fileContent.npos) + { throw std::invalid_argument("ERROR: closing tag " + closingTagName + " missing, check XML file\n"); + } GetPairs(tag, pairs); } @@ -411,7 +431,9 @@ std::size_t GetTotalSize(const std::vector<std::size_t> &dimensions) std::size_t product = 1; for (const auto dimension : dimensions) + { product *= dimension; + } return product; } @@ -420,13 +442,17 @@ void CreateDirectory(const std::string fullPath) noexcept { auto lf_Mkdir = [](const std::string directory, struct stat &st) { if (stat(directory.c_str(), &st) == -1) + { mkdir(directory.c_str(), 0777); + } }; auto directoryPosition = fullPath.find("/"); - if (fullPath[0] == '/' || fullPath[0] == '.') // find the second '/' + if (fullPath[0] == '/' || fullPath[0] == '.') + { // find the second '/' directoryPosition = fullPath.find("/", directoryPosition + 1); + } struct stat st = {0}; if (directoryPosition == fullPath.npos) // no subdirectories @@ -464,9 +490,11 @@ void SetTransformsHelper(const std::vector<std::string> &transformNames, if (debugMode == true) { if (colonPosition == transformName.size() - 1) + { throw std::invalid_argument("ERROR: wrong format for transform " + transformName + ", in call to SetTransform\n"); + } } transformMethod = transformName.substr(0, colonPosition); @@ -528,14 +556,18 @@ BuildParametersMap(const std::vector<std::string> ¶meters, if (debugMode == true) { if (equalPosition == parameter.npos) + { throw std::invalid_argument("ERROR: wrong format for parameter " + parameter + ", format must be field=value \n"); + } if (equalPosition == parameter.size() - 1) + { throw std::invalid_argument("ERROR: empty value in parameter " + parameter + ", format must be field=value \n"); + } } field = parameter.substr(0, equalPosition); @@ -553,8 +585,10 @@ BuildParametersMap(const std::vector<std::string> ¶meters, if (debugMode == true) { if (parametersOutput.count(field) == 1) + { throw std::invalid_argument("ERROR: parameter " + field + " already exists, must be unique\n"); + } } parametersOutput[field] = value; @@ -567,7 +601,9 @@ std::vector<int> CSVToVectorInt(const std::string csv) { std::vector<int> numbers; if (csv.empty()) + { return numbers; + } if (csv.find(",") == csv.npos) // check if no commas, one int { @@ -600,7 +636,9 @@ bool CheckBufferAllocation(const std::size_t newSize, const float growthFactor, bool doTransportsFlush = (requiredDataSize > maxBufferSize) ? true : false; if (GrowBuffer(requiredDataSize, growthFactor, buffer) == -1) + { doTransportsFlush = true; + } return doTransportsFlush; } @@ -643,4 +681,4 @@ bool IsLittleEndian() noexcept return *reinterpret_cast<std::uint8_t *>(&hexa) != 0x12; } -} // end namespace +} // namespace adios diff --git a/source/transform/BZip2.cpp b/source/transform/BZip2.cpp index 646b8bc6c75ba201e575cf245c54380eff9e712f..c267af7540249968dd42d9e9bb210b2917661150 100644 --- a/source/transform/BZip2.cpp +++ b/source/transform/BZip2.cpp @@ -17,15 +17,15 @@ namespace transform BZIP2::BZIP2() : Transform("bzip2") {} -BZIP2::~BZIP2() {} +BZIP2::~BZIP2() = default; -void BZIP2::Compress(const std::vector<char> &bufferIn, - std::vector<char> &bufferOut) +void BZIP2::Compress(const std::vector<char> & /*bufferIn*/, + std::vector<char> & /*bufferOut*/) { } -void BZIP2::Decompress(const std::vector<char> &bufferIn, - std::vector<char> &bufferOut) +void BZIP2::Decompress(const std::vector<char> & /*bufferIn*/, + std::vector<char> & /*bufferOut*/) { } diff --git a/source/transport/file/FileDescriptor.cpp b/source/transport/file/FileDescriptor.cpp index d3433d2e50aa1613ef16aa95daf7d4553c51dc49..0d6a87c96826042d79581ec356b9c96d796a85cf 100644 --- a/source/transport/file/FileDescriptor.cpp +++ b/source/transport/file/FileDescriptor.cpp @@ -45,87 +45,115 @@ void FileDescriptor::Open(const std::string name, const std::string accessMode) if (accessMode == "w" || accessMode == "write") { if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[0].SetInitialTime(); + } m_FileDescriptor = open(m_Name.c_str(), O_WRONLY | O_CREAT, 0777); if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[0].SetTime(); + } } else if (accessMode == "a" || accessMode == "append") { if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[0].SetInitialTime(); + } m_FileDescriptor = open(m_Name.c_str(), O_WRONLY | O_APPEND); // we need to change this if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[0].SetTime(); + } } else if (accessMode == "r" || accessMode == "read") { if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[0].SetInitialTime(); + } m_FileDescriptor = open(m_Name.c_str(), O_RDONLY); if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[0].SetTime(); + } } if (m_DebugMode == true) { if (m_FileDescriptor == -1) + { throw std::ios_base::failure("ERROR: couldn't open file " + m_Name + ", from call to Open in FD transport using " "POSIX open. Does file exists?\n"); + } } } void FileDescriptor::Write(const char *buffer, std::size_t size) { if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[1].SetInitialTime(); + } auto writtenSize = write(m_FileDescriptor, buffer, size); if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[1].SetTime(); + } if (m_DebugMode == true) { if (writtenSize == -1) + { throw std::ios_base::failure("ERROR: couldn't write to file " + m_Name + ", in call to POSIX write\n"); + } if (static_cast<std::size_t>(writtenSize) != size) + { throw std::ios_base::failure( "ERROR: written size + " + std::to_string(writtenSize) + " is not equal to intended size " + std::to_string(size) + " in file " + m_Name + ", in call to POSIX write\n"); + } } } void FileDescriptor::Close() { if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[2].SetInitialTime(); + } int status = close(m_FileDescriptor); if (m_Profiler.m_IsActive == true) + { m_Profiler.m_Timers[2].SetTime(); + } if (m_DebugMode == true) { if (status == -1) + { throw std::ios_base::failure("ERROR: couldn't close file " + m_Name + ", in call to POSIX write\n"); + } } m_IsOpen = false; } } // end namespace transport -} // end namespace +} // namespace adios diff --git a/source/transport/file/FilePointer.cpp b/source/transport/file/FilePointer.cpp index 704b93f08d55ad410d25f9a04a501c73d60d49a7..1ba57204e6a6827c7454c688b37b8e2f1d62e2c9 100644 --- a/source/transport/file/FilePointer.cpp +++ b/source/transport/file/FilePointer.cpp @@ -26,8 +26,10 @@ FilePointer::FilePointer(MPI_Comm mpiComm, const bool debugMode) FilePointer::~FilePointer() { - if (m_File != NULL) + if (m_File != nullptr) + { fclose(m_File); + } } void FilePointer::Open(const std::string name, const std::string accessMode) @@ -36,20 +38,26 @@ void FilePointer::Open(const std::string name, const std::string accessMode) m_AccessMode = accessMode; if (accessMode == "w" || accessMode == "write") + { m_File = fopen(name.c_str(), "w"); - + } else if (accessMode == "a" || accessMode == "append") + { m_File = fopen(name.c_str(), "a"); - + } else if (accessMode == "r" || accessMode == "read") + { m_File = fopen(name.c_str(), "r"); + } if (m_DebugMode == true) { - if (m_File == NULL) + if (m_File == nullptr) + { throw std::ios_base::failure("ERROR: couldn't open file " + name + ", " "in call to Open from File* transport\n"); + } } } @@ -60,8 +68,10 @@ void FilePointer::SetBuffer(char *buffer, std::size_t size) if (m_DebugMode == true) { if (status == 1) + { throw std::ios_base::failure("ERROR: could not set buffer in rank " + std::to_string(m_RankMPI) + "\n"); + } } } @@ -72,8 +82,10 @@ void FilePointer::Write(const char *buffer, std::size_t size) if (m_DebugMode == true) { if (ferror(m_File)) + { throw std::ios_base::failure("ERROR: couldn't write to file " + m_Name + ", in call to File* write\n"); + } } } @@ -87,4 +99,4 @@ void FilePointer::Close() } } // end namespace transport -} // end namespace +} // namespace adios