Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ option(RESOLVE_USE_PROFILING "Set profiling tracers in the code" OFF)
option(RESOLVE_USE_GPU "Use GPU device for computations" OFF)
mark_as_advanced(FORCE RESOLVE_USE_GPU)

option(RESOLVE_USE_ASAN "Use LLVM address sanitizer" OFF)
option(RESOLVE_USE_ASAN "Enable the address sanitizer" OFF)
option(RESOLVE_USE_UBSAN "Enable the undefined behavior sanitizer" OFF)
option(RESOLVE_USE_DOXYGEN "Use Doxygen to generate Re::Solve documentation" OFF)
set(RESOLVE_CTEST_OUTPUT_DIR ${PROJECT_BINARY_DIR} CACHE PATH "Directory where CTest outputs are saved")

Expand Down Expand Up @@ -113,11 +114,20 @@ else()
message(STATUS "Not using HIP")
endif(RESOLVE_USE_HIP)

if (RESOLVE_USE_ASAN)
if(RESOLVE_USE_ASAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_Fortran_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
endif()

if(RESOLVE_USE_UBSAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
set(CMAKE_Fortran_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
endif()

# The binary dir is already a global include directory
configure_file(
${CMAKE_SOURCE_DIR}/resolve/resolve_defs.hpp.in
Expand Down
2 changes: 2 additions & 0 deletions resolve/GramSchmidt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ namespace ReSolve
vec_w_ = nullptr;
delete vec_v_;
vec_v_ = nullptr;
delete vec_x_;
vec_x_ = nullptr;

setup_complete_ = false;
return 0;
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/vector/VectorHandlerTests.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once

#include <algorithm>
#include <iomanip>
#include <iterator>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
Expand Down Expand Up @@ -250,12 +252,12 @@ namespace ReSolve

vec.setToConst(3.0, memspace_);

real_type* diag_data = new real_type[N];
auto diag_data = std::unique_ptr<real_type[]>(new real_type[N]);
for (index_type i = 0; i < N; ++i)
{
diag_data[i] = (real_type) (i + 1);
}
diag.copyDataFrom(diag_data, memory::HOST, memspace_);
diag.copyDataFrom(diag_data.get(), memory::HOST, memspace_);

handler_.scale(&diag, &vec, memspace_);

Expand Down
Loading