From ad7d942fcf867050758da4daa4b130050418d7d2 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Mon, 26 Mar 2018 11:09:54 -0400 Subject: [PATCH 1/2] Remove several unused variables --- examples/experimental/multistep/reader_stepping.cpp | 7 +++---- examples/hello/sstReader/helloSstReader.cpp | 4 +--- source/adios2/engine/dataman/DataManWriter.tcc | 1 - source/adios2/engine/hdf5/HDF5ReaderP.cpp | 6 ++---- source/adios2/operator/compress/CompressSZ.cpp | 2 +- source/adios2/toolkit/format/bp3/BP3Deserializer.tcc | 2 -- testing/adios2/engine/bp/TestBPWriteRead.cpp | 2 +- testing/adios2/engine/bp/TestBPWriteReadstdio.cpp | 2 +- testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp | 12 ++++++------ testing/adios2/transform/TestBZip2Wrapper.cpp | 1 + 10 files changed, 16 insertions(+), 23 deletions(-) diff --git a/examples/experimental/multistep/reader_stepping.cpp b/examples/experimental/multistep/reader_stepping.cpp index b4f8c9feba..8bddb221aa 100644 --- a/examples/experimental/multistep/reader_stepping.cpp +++ b/examples/experimental/multistep/reader_stepping.cpp @@ -17,18 +17,17 @@ #endif int main(int argc, char *argv[]) { - int rank = 0, nproc = 1; + int rank = 0; #ifdef ADIOS2_HAVE_MPI MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &nproc); #endif const bool adiosDebug = true; #ifdef ADIOS2_HAVE_MPI - adios2::ADIOS adios(MPI_COMM_WORLD, adios2::DebugON); + adios2::ADIOS adios(MPI_COMM_WORLD, adiosDebug); #else - adios2::ADIOS adios(adios2::DebugON); + adios2::ADIOS adios(adiosDebug); #endif // Info variables from the file diff --git a/examples/hello/sstReader/helloSstReader.cpp b/examples/hello/sstReader/helloSstReader.cpp index 786818a975..7d2e88d290 100644 --- a/examples/hello/sstReader/helloSstReader.cpp +++ b/examples/hello/sstReader/helloSstReader.cpp @@ -38,15 +38,13 @@ void UserCallBack(const void *data, std::string doid, std::string var, int main(int argc, char *argv[]) { // Application variable - int rank, size; + int rank; #ifdef ADIOS2_HAVE_MPI MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); - MPI_Comm_size(MPI_COMM_WORLD, &size); #else rank = 0; - size = 1; #endif int timeout = 5; diff --git a/source/adios2/engine/dataman/DataManWriter.tcc b/source/adios2/engine/dataman/DataManWriter.tcc index 7c029e8be1..5e93dc5a32 100644 --- a/source/adios2/engine/dataman/DataManWriter.tcc +++ b/source/adios2/engine/dataman/DataManWriter.tcc @@ -109,7 +109,6 @@ void DataManWriter::PutSyncCommonBP(Variable &variable, const T *values) // Close buffer here? m_BP3Serializer.CloseStream(m_IO); auto &buffer = m_BP3Serializer.m_Data.m_Buffer; - auto &position = m_BP3Serializer.m_Data.m_Position; m_DataMan->WriteWAN(buffer); diff --git a/source/adios2/engine/hdf5/HDF5ReaderP.cpp b/source/adios2/engine/hdf5/HDF5ReaderP.cpp index 3f07ae0c3f..1ea6be8a04 100644 --- a/source/adios2/engine/hdf5/HDF5ReaderP.cpp +++ b/source/adios2/engine/hdf5/HDF5ReaderP.cpp @@ -52,16 +52,14 @@ void HDF5ReaderP::Init() m_H5File.Init(m_Name, m_MPIComm, false); - int ts = m_H5File.GetNumAdiosSteps(); /* - // + int ts = m_H5File.GetNumAdiosSteps(); + if (ts == 0) { throw std::runtime_error("This h5 file is NOT written by ADIOS2"); } */ - /* - */ if (!m_InStreamMode) { m_H5File.ReadAllVariables(m_IO); diff --git a/source/adios2/operator/compress/CompressSZ.cpp b/source/adios2/operator/compress/CompressSZ.cpp index 065ba70486..924dcd6601 100644 --- a/source/adios2/operator/compress/CompressSZ.cpp +++ b/source/adios2/operator/compress/CompressSZ.cpp @@ -71,7 +71,7 @@ size_t CompressSZ::Compress(const void *dataIn, const Dims &dimensions, int use_configfile = 0; int use_zchecker = 0; std::string sz_configfile = "sz.config"; - std::string zc_configfile = "zc.config"; + // std::string zc_configfile = "zc.config"; std::cout << "debugMode:" << this->m_DebugMode << std::endl; diff --git a/source/adios2/toolkit/format/bp3/BP3Deserializer.tcc b/source/adios2/toolkit/format/bp3/BP3Deserializer.tcc index dafbdabb22..c7585bd236 100644 --- a/source/adios2/toolkit/format/bp3/BP3Deserializer.tcc +++ b/source/adios2/toolkit/format/bp3/BP3Deserializer.tcc @@ -239,8 +239,6 @@ void BP3Deserializer::DefineAttributeInIO(const ElementIndexHeader &header, const std::vector &buffer, size_t position) const { - const size_t initialPosition = position; - const Characteristics characteristics = ReadElementIndexCharacteristics( buffer, position, static_cast(header.DataType)); diff --git a/testing/adios2/engine/bp/TestBPWriteRead.cpp b/testing/adios2/engine/bp/TestBPWriteRead.cpp index a628ce506e..41f58d2190 100644 --- a/testing/adios2/engine/bp/TestBPWriteRead.cpp +++ b/testing/adios2/engine/bp/TestBPWriteRead.cpp @@ -330,7 +330,7 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8) // ADIOS2 write, ADIOS2 read TEST_F(BPWriteReadTest, DISABLED_ADIOS2BPWriteADIOS2BPRead1D8) { - std::string fname = "ADIOS2BPWriteADIOS2BPRead1D8.bp"; + // std::string fname = "ADIOS2BPWriteADIOS2BPRead1D8.bp"; ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented"; } diff --git a/testing/adios2/engine/bp/TestBPWriteReadstdio.cpp b/testing/adios2/engine/bp/TestBPWriteReadstdio.cpp index 44a3e30415..8aa518f566 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadstdio.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadstdio.cpp @@ -309,7 +309,7 @@ TEST_F(BPWriteReadTest, ADIOS2BPWriteADIOS1Read1D8stdio) // ADIOS2 write, ADIOS2 read TEST_F(BPWriteReadTest, DISABLED_ADIOS2BPWriteADIOS2BPRead1D8stdio) { - std::string fname = "ADIOS2BPWriteADIOS2BPRead1D8stdio.bp"; + // std::string fname = "ADIOS2BPWriteADIOS2BPRead1D8stdio.bp"; ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented"; } diff --git a/testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp b/testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp index bd3d92a68a..7a5ed2ff11 100644 --- a/testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp +++ b/testing/adios2/engine/hdf5/TestHDF5WriteRead.cpp @@ -450,7 +450,7 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read1D8) // ADIOS2 write, ADIOS2 read TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read1D8) { - std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read1D8.h5"; + // std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read1D8.h5"; ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented"; } @@ -458,7 +458,7 @@ TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read1D8) // Native HDF5 write, ADIOS2 read TEST_F(HDF5WriteReadTest, DISABLED_HDF5WriteADIOS2HDF5Read1D8) { - std::string fname = "HDF5WriteADIOS2HDF5Read1D8.h5"; + // std::string fname = "HDF5WriteADIOS2HDF5Read1D8.h5"; ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented"; } @@ -725,7 +725,7 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D2x4) // ADIOS2 write, ADIOS2 read TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read2D2x4) { - std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read2D2x4Test.h5"; + // std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read2D2x4Test.h5"; ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented"; } @@ -733,7 +733,7 @@ TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read2D2x4) // Native HDF5 write, ADIOS2 read TEST_F(HDF5WriteReadTest, DISABLED_HDF5WriteADIOS2HDF5Read2D2x4) { - std::string fname = "HDF5WriteADIOS2HDF5Read2D2x4Test.h5"; + // std::string fname = "HDF5WriteADIOS2HDF5Read2D2x4Test.h5"; ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented"; } @@ -999,7 +999,7 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D4x2) // ADIOS2 write, ADIOS2 read TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read2D4x2) { - std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read2D4x2Test.h5"; + // std::string fname = "ADIOS2HDF5WriteADIOS2HDF5Read2D4x2Test.h5"; ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented"; } @@ -1007,7 +1007,7 @@ TEST_F(HDF5WriteReadTest, DISABLED_ADIOS2HDF5WriteADIOS2HDF5Read2D4x2) // Native HDF5 write, ADIOS2 read TEST_F(HDF5WriteReadTest, DISABLED_HDF5WriteADIOS2HDF5Read2D4x2) { - std::string fname = "HDF5WriteADIOS2HDF5Read2D4x2Test.h5"; + // std::string fname = "HDF5WriteADIOS2HDF5Read2D4x2Test.h5"; ASSERT_TRUE(false) << "ADIOS2 read API is not yet implemented"; } diff --git a/testing/adios2/transform/TestBZip2Wrapper.cpp b/testing/adios2/transform/TestBZip2Wrapper.cpp index 01fcc42be2..b1a1fc6b4b 100644 --- a/testing/adios2/transform/TestBZip2Wrapper.cpp +++ b/testing/adios2/transform/TestBZip2Wrapper.cpp @@ -57,6 +57,7 @@ TEST_F(ADIOSBZip2Wrapper, UInt100) size_t decompressedSize = adiosBZip2.Decompress( compressedBuffer.data(), compressedSize, decompressedBuffer.data(), decompressedBuffer.size() * sizeof(unsigned int)); + ASSERT_EQ(decompressedSize, Nx); // testing data recovery for (size_t i = 0; i < Nx; ++i) From 1925d057e776b675c796bd56bb291bb7c5ba7a13 Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Tue, 27 Mar 2018 11:48:10 -0400 Subject: [PATCH 2/2] Added a check for BZip2 decompression size --- testing/adios2/transform/TestBZip2Wrapper.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/testing/adios2/transform/TestBZip2Wrapper.cpp b/testing/adios2/transform/TestBZip2Wrapper.cpp index b1a1fc6b4b..f466bd9c95 100644 --- a/testing/adios2/transform/TestBZip2Wrapper.cpp +++ b/testing/adios2/transform/TestBZip2Wrapper.cpp @@ -20,18 +20,18 @@ class ADIOSBZip2Wrapper : public ::testing::Test TEST_F(ADIOSBZip2Wrapper, UInt100) { /** Application variable uints from 0 to 1000 */ - std::vector myUInts(100); + std::vector myUInts(100); std::iota(myUInts.begin(), myUInts.end(), 0.f); const std::size_t Nx = myUInts.size(); - const std::size_t inputBytes = Nx * sizeof(unsigned int); + const std::size_t inputBytes = Nx * sizeof(uint32_t); // Define ADIOS variable - auto &var_UInt = io.DefineVariable("myUInts", {}, {}, {Nx}, - adios2::ConstantDims); + auto &var_UInt = io.DefineVariable("myUInts", {}, {}, {Nx}, + adios2::ConstantDims); // Verify the return type is as expected ::testing::StaticAssertTypeEq &>(); + adios2::Variable &>(); // Define bzip2 transform adios2::Operator &adiosBZip2 = @@ -53,11 +53,11 @@ TEST_F(ADIOSBZip2Wrapper, UInt100) compressedBuffer.resize(compressedSize); // Allocate original data size - std::vector decompressedBuffer(Nx); + std::vector decompressedBuffer(Nx); size_t decompressedSize = adiosBZip2.Decompress( compressedBuffer.data(), compressedSize, decompressedBuffer.data(), - decompressedBuffer.size() * sizeof(unsigned int)); - ASSERT_EQ(decompressedSize, Nx); + decompressedBuffer.size() * sizeof(uint32_t)); + ASSERT_EQ(decompressedSize, inputBytes); // testing data recovery for (size_t i = 0; i < Nx; ++i)