Skip to content

Commit

Permalink
minor changes, preparing for v0.8.2 release (#244)
Browse files Browse the repository at this point in the history
Co-authored-by: Samuel Li <sam@cisl-m121a>
  • Loading branch information
shaomeng and Samuel Li authored Aug 29, 2024
1 parent e9c9e17 commit 16fa207
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Run clang-format style check for C/C++ programs.
uses: jidicula/clang-format-action@v4.8.0
uses: jidicula/clang-format-action@v4.13.0
with:
clang-format-version: '14'
clang-format-version: '18'
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}
fallback-style: 'Chromium' # optional
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cmake_minimum_required(VERSION 3.14)

project(SPERR VERSION 0.8.1 LANGUAGES CXX DESCRIPTION "Lossy Scientific Compression with SPERR")
project(SPERR VERSION 0.8.2 LANGUAGES CXX DESCRIPTION "Lossy Scientific Compression with SPERR")

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD "20" CACHE STRING "Choose the C++ Standard to use." FORCE)
Expand Down
2 changes: 1 addition & 1 deletion include/SPECK3D_INT.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class SPECK3D_INT : public SPECK_INT<T> {
virtual void m_process_S(size_t idx1, size_t idx2, size_t& counter, bool) = 0;
virtual void m_process_P(size_t i, size_t m, size_t& c, bool) = 0; // Called by `m_code_S()`.
virtual void m_process_P_lite(size_t idx) = 0; // Called by `m_sorting_pass()` directly.
virtual void m_additional_initialization(){}; // empty by default
virtual void m_additional_initialization() {}; // empty by default

void m_code_S(size_t idx1, size_t idx2);
auto m_partition_S_XYZ(Set3D, uint16_t) const -> std::tuple<std::array<Set3D, 8>, uint16_t>;
Expand Down
5 changes: 3 additions & 2 deletions include/SPERR3D_Stream_Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ class SPERR3D_Stream_Tools {
// Given the header of a bitstream and a desired percentage to truncate, return an
// updated header and a list of {offset, len} to access.
// Note: this function assumes that the header is complete.
auto m_progressive_helper(const void* header_buf, size_t buf_len, unsigned pct) const
-> std::tuple<vec8_type, std::vector<size_t>>;
auto m_progressive_helper(const void* header_buf,
size_t buf_len,
unsigned pct) const -> std::tuple<vec8_type, std::vector<size_t>>;
};

} // End of namespace sperr
Expand Down
5 changes: 3 additions & 2 deletions include/sperr_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ auto read_whole_file(std::string filename) -> vec_type<T>;
// Read sections of a file (extract sections from a memory buffer), and append those sections
// to the end of `dst`. The read from file version avoids reading not-requested sections.
// The sections are defined by pairs of offsets and lengths, both in number of bytes.
auto read_sections(std::string filename, const std::vector<size_t>& sections, vec8_type& dst)
-> RTNType;
auto read_sections(std::string filename,
const std::vector<size_t>& sections,
vec8_type& dst) -> RTNType;
auto extract_sections(const void* buf,
size_t buf_len,
const std::vector<size_t>& sections,
Expand Down
5 changes: 3 additions & 2 deletions src/Conditioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ auto sperr::Conditioner::condition(vecd_type& buf, dims_type dims) -> condi_type
return header;
}

auto sperr::Conditioner::inverse_condition(vecd_type& buf, dims_type dims, condi_type header)
-> RTNType
auto sperr::Conditioner::inverse_condition(vecd_type& buf,
dims_type dims,
condi_type header) -> RTNType
{
// unpack meta bit fields
auto meta = sperr::unpack_8_booleans(header[0]);
Expand Down
2 changes: 1 addition & 1 deletion src/SPECK_INT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ void sperr::SPECK_INT<T>::m_refinement_pass_decode()
goto INITIALIZE_NEWLY_FOUND_POINTS_LABEL; // <-- Point 4
}
}
} // Finish the case where `m_threshold >= 2`.
} // Finish the case where `m_threshold >= 2`.
else { // Start the case where `m_threshold == 1`.
for (size_t i = 0; i < bits_x64; i += 64) {
auto value = m_LSP_mask.rlong(i);
Expand Down
10 changes: 6 additions & 4 deletions src/SPERR3D_OMP_C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ auto sperr::SPERR3D_OMP_C::m_gather_chunk(const T* vol,
// Will be subject to Named Return Value Optimization.
return chunk_buf;
}
template auto sperr::SPERR3D_OMP_C::m_gather_chunk(const float*, dims_type, std::array<size_t, 6>)
-> vecd_type;
template auto sperr::SPERR3D_OMP_C::m_gather_chunk(const double*, dims_type, std::array<size_t, 6>)
-> vecd_type;
template auto sperr::SPERR3D_OMP_C::m_gather_chunk(const float*,
dims_type,
std::array<size_t, 6>) -> vecd_type;
template auto sperr::SPERR3D_OMP_C::m_gather_chunk(const double*,
dims_type,
std::array<size_t, 6>) -> vecd_type;
4 changes: 2 additions & 2 deletions src/SPERR3D_Stream_Tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ auto sperr::SPERR3D_Stream_Tools::get_stream_header(const void* p) const -> SPER
return header;
}

auto sperr::SPERR3D_Stream_Tools::progressive_read(const std::string& filename, unsigned pct) const
-> vec8_type
auto sperr::SPERR3D_Stream_Tools::progressive_read(const std::string& filename,
unsigned pct) const -> vec8_type
{
// Read the header of this bitstream.
auto vec20 = sperr::read_n_bytes(filename, 20);
Expand Down
15 changes: 9 additions & 6 deletions src/sperr_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ auto sperr::write_n_bytes(std::string filename, size_t n_bytes, const void* buff
return RTNType::Good;
}

auto sperr::read_sections(std::string filename, const std::vector<size_t>& sections, vec8_type& dst)
-> RTNType
auto sperr::read_sections(std::string filename,
const std::vector<size_t>& sections,
vec8_type& dst) -> RTNType
{
// Calculate the farthest file location to be read.
size_t far = 0;
Expand Down Expand Up @@ -494,8 +495,10 @@ auto sperr::calc_stats(const T* arr1, const T* arr2, size_t arr_len, size_t omp_
return {rmse, linfty, psnr, arr1min, arr1max};
}
template auto sperr::calc_stats(const float*, const float*, size_t, size_t) -> std::array<float, 5>;
template auto sperr::calc_stats(const double*, const double*, size_t, size_t)
-> std::array<double, 5>;
template auto sperr::calc_stats(const double*,
const double*,
size_t,
size_t) -> std::array<double, 5>;

template <typename T>
auto sperr::kahan_summation(const T* arr, size_t len) -> T
Expand All @@ -514,8 +517,8 @@ auto sperr::kahan_summation(const T* arr, size_t len) -> T
template auto sperr::kahan_summation(const float*, size_t) -> float;
template auto sperr::kahan_summation(const double*, size_t) -> double;

auto sperr::chunk_volume(dims_type vol_dim, dims_type chunk_dim)
-> std::vector<std::array<size_t, 6>>
auto sperr::chunk_volume(dims_type vol_dim,
dims_type chunk_dim) -> std::vector<std::array<size_t, 6>>
{
// Step 1: figure out how many segments are there along each axis.
auto n_segs = std::array<size_t, 3>();
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions utilities/sperr2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ int main(int argc, char* argv[])
std::cout << "SPERR needs an output destination when decoding!" << std::endl;
return __LINE__;
}
// Print a warning message if there's no output specified
if (cflag && bitstream.empty())
std::cout << "Warning: no output file provided. Consider using --bitstream option."
<< std::endl;
if (dflag && decomp_f64.empty() && decomp_f32.empty() && decomp_lowres_f64.empty() &&
decomp_lowres_f32.empty())
std::cout << "Warning: no output file provided." << std::endl;

//
// Really starting the real work!
Expand Down
12 changes: 10 additions & 2 deletions utilities/sperr3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

// This functions takes in a filename, and a full resolution. It then creates a list of
// filenames, each has the coarsened resolution appended.
auto create_filenames(std::string name, sperr::dims_type vdims, sperr::dims_type cdims)
-> std::vector<std::string>
auto create_filenames(std::string name,
sperr::dims_type vdims,
sperr::dims_type cdims) -> std::vector<std::string>
{
auto filenames = std::vector<std::string>();
auto resolutions = sperr::coarsened_resolutions(vdims, cdims);
Expand Down Expand Up @@ -254,6 +255,13 @@ int main(int argc, char* argv[])
return __LINE__ % 256;
}
}
// Print a warning message if there's no output specified
if (cflag && bitstream.empty())
std::cout << "Warning: no output file provided. Consider using --bitstream option."
<< std::endl;
if (dflag && decomp_f64.empty() && decomp_f32.empty() && decomp_lowres_f64.empty() &&
decomp_lowres_f32.empty())
std::cout << "Warning: no output file provided." << std::endl;

//
// Really starting the real work!
Expand Down

0 comments on commit 16fa207

Please sign in to comment.