Skip to content

Commit

Permalink
Enable c++17 support in tests and fix saxpy calls
Browse files Browse the repository at this point in the history
  • Loading branch information
vfisikop committed Mar 6, 2024
1 parent b2b5c06 commit 3b8e6d6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/autopoint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ project( VolEsti )
option(DISABLE_NLP_ORACLES "Disable non-linear oracles (used in collocation)" ON)
option(BUILTIN_EIGEN "Use eigen from ../external" OFF)
option(BUILTIN_AUTODIFF "Use eigen from ../external" OFF)
option(USE_MKL "Use MKL library to build eigen" ON)
option(USE_MKL "Use MKL library to build eigen" OFF)

CMAKE_MINIMUM_REQUIRED(VERSION 3.17)

Expand Down Expand Up @@ -141,7 +141,7 @@ endif()
add_definitions(${CMAKE_CXX_FLAGS} "-std=c++17") # enable C++14 standard
add_definitions(${CMAKE_CXX_FLAGS} "-O3") # optimization of the compiler
add_definitions(${CMAKE_CXX_FLAGS} "-pthread") # optimization of the compiler

#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgsl")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lm")
add_definitions(${CMAKE_CXX_FLAGS} "-DMKL_ILP64")
Expand Down
2 changes: 1 addition & 1 deletion include/preprocess/crhmc/crhmc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ void set(MatrixType &a, std::vector<IndexType>const & idx, const Type c){
}
}
template<typename MatrixType, typename IndexType>
void saxpy(MatrixType &a,MatrixType const &b,MatrixType const& c, std::vector<IndexType>const & a_idx, std::vector<IndexType>const & b_idx){
void volesti_saxpy(MatrixType &a,MatrixType const &b,MatrixType const& c, std::vector<IndexType>const & a_idx, std::vector<IndexType>const & b_idx){
for(int i=0;i<b_idx.size();i++){
a(a_idx[i])=b(b_idx[i])+c(i);
}
Expand Down
4 changes: 2 additions & 2 deletions include/preprocess/crhmc/two_sided_barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ template <typename Point> class two_sided_barrier {

VT c = (ub + lb) / 2;
VT bias1=VT::Ones(x2, 1) * unbounded_center_coord;
saxpy(c,lb,bias1,lowerIdx,lowerIdx);
volesti_saxpy(c,lb,bias1,lowerIdx,lowerIdx);
VT bias2=-VT::Ones(x1, 1) * unbounded_center_coord;
saxpy(c,ub,bias2,upperIdx,upperIdx);
volesti_saxpy(c,ub,bias2,upperIdx,upperIdx);
set(c, freeIdx, 0.0);

center = c;
Expand Down
4 changes: 2 additions & 2 deletions include/preprocess/crhmc/weighted_two_sided_barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ template <class Point> class weighted_two_sided_barrier {

VT c = (ub + lb) / 2;
VT bias1=VT::Ones(x2, 1) * unbounded_center_coord;
saxpy(c,lb,bias1,lowerIdx,lowerIdx);
volesti_saxpy(c,lb,bias1,lowerIdx,lowerIdx);
VT bias2=-VT::Ones(x1, 1) * unbounded_center_coord;
saxpy(c,ub,bias2,upperIdx,upperIdx);
volesti_saxpy(c,ub,bias2,upperIdx,upperIdx);
set(c, freeIdx, 0.0);

center = c;
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ add_definitions(${CMAKE_CXX_FLAGS} "-g") # enable debuger
#add_definitions(${CMAKE_CXX_FLAGS} "-Wall")

add_definitions(${CMAKE_CXX_FLAGS} "-O3") # optimization of the compiler
add_definitions(${CMAKE_CXX_FLAGS} "-std=c++17") #enable the c++17 support needed by autodiff
#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgsl")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lm")
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-ldl")
Expand Down

0 comments on commit 3b8e6d6

Please sign in to comment.