Skip to content

Commit

Permalink
required standard reduced from C++20 to C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
ElektrikAkar committed Dec 10, 2023
1 parent 56272b9 commit db30392
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- CC: gcc-13
CXX: g++-13
compiler: gcc-13 g++-13
- CC: clang-12 # -> error: call to consteval function 'std::chrono::hh_mm_ss::_S_fractional_width' is not a constant expression
- CC: clang-12
CXX: clang++-12
compiler: clang-12 libomp-12-dev
- CC: clang-13
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ This changelog contains a non-exhaustive list of new features and notable bug-fi
## API changes
* N/A

## Dependency updates:
* Required C++ standard is reduced from C++20 to C++17 as it was causing `call to consteval function 'std::chrono::hh_mm_ss::_S_fractional_width' is not a constant expression` error for clang versions older than clang-15.
* std::execution-based parallelisation changed with OpenMP.


<br/><br/>
# DTWC v0.0.3
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ add_library(project_warnings INTERFACE)

# Link this 'library' to set the c++ standard / compile-time options requested
add_library(project_options INTERFACE)
target_compile_features(project_options INTERFACE cxx_std_20)
target_compile_features(project_options INTERFACE cxx_std_17)

enable_testing()

Expand Down
2 changes: 1 addition & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function(dtwc_setup_dependencies)
SYSTEM
EXCLUDE_FROM_ALL
OPTIONS
"ZLIB OFF" "FAST_BUILD ON" "BUILD_TESTING OFF" "BUILD_EXAMPLES OFF" "CMAKE_CXX_STANDARD 20")
"ZLIB OFF" "FAST_BUILD ON" "BUILD_TESTING OFF" "BUILD_EXAMPLES OFF")
endif()

endfunction()
2 changes: 1 addition & 1 deletion cmake/StandardProjectSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# when compiling with PCH enabled
set(CMAKE_CXX_EXTENSIONS OFF)
# Only set the cxx_standard if it is not set by someone else
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_VERBOSE_MAKEFILE ON)


Expand Down
2 changes: 1 addition & 1 deletion dtwc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ if(OpenMP_CXX_FOUND)
target_link_libraries(dtwc++ PUBLIC OpenMP::OpenMP_CXX)
endif()

set_property(TARGET dtwc++ PROPERTY CXX_STANDARD 20)
set_property(TARGET dtwc++ PROPERTY CXX_STANDARD 17)
2 changes: 1 addition & 1 deletion dtwc/Data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct Data
assert(p_vec_new.size() == p_names_new.size());
p_vec = std::move(p_vec_new);
p_names = std::move(p_names_new);
Nb = std::ssize(p_vec);
Nb = static_cast<int>(p_vec.size());
}
};

Expand Down
2 changes: 1 addition & 1 deletion dtwc/DataLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class DataLoader
else
std::tie(d.p_vec, d.p_names) = load_batch_file<data_t>(data_path, Ndata, verbose > 0, start_row, start_col, delimiter);

d.Nb = std::ssize(d.p_vec);
d.Nb = static_cast<int>(d.p_vec.size());
return d;
}
};
Expand Down
3 changes: 2 additions & 1 deletion dtwc/mip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

namespace dtwc {

void extract_solution(Problem &prob, auto &solution)
template <typename T>
void extract_solution(Problem &prob, const T &solution)
{
prob.clear_clusters();
const auto Nb = prob.data.size();
Expand Down
6 changes: 4 additions & 2 deletions dtwc/types/element_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ struct CompElementValuesAndIndices

struct RowMajor
{
bool operator()(const auto &c1, const auto &c2) const
template <typename T>
bool operator()(const T &c1, const T &c2) const
{
return (c1.col < c2.col) || (c1.col == c2.col && c1.row < c2.row);
}
};

struct ColumnMajor
{
bool operator()(const auto &c1, const auto &c2) const
template <typename T>
bool operator()(const T &c1, const T &c2) const
{
return (c1.row < c2.row) || (c1.row == c2.row && c1.col < c2.col);
}
Expand Down
2 changes: 1 addition & 1 deletion dtwc/warping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace dtwc {
template <typename data_t>
data_t dtwFull(const std::vector<data_t> &x, const std::vector<data_t> &y)
{
thread_local VecMatrix<data_t> C(std::ssize(x), std::ssize(y)); //
thread_local VecMatrix<data_t> C(x.size(), y.size()); //
constexpr data_t maxValue = std::numeric_limits<data_t>::max();

if (&x == &y) return 0; // If they are the same data then distance is 0.
Expand Down

0 comments on commit db30392

Please sign in to comment.