Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel cyclic reduction #2330

Merged
merged 45 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c6b0eae
Initial inclusion of PCR solver
JosephThomasParker May 12, 2021
a503dc5
Tidy source and header
JosephThomasParker May 12, 2021
25d0cd9
Update buffers to Arrays
JosephThomasParker May 13, 2021
1dc9972
Change auto to Array
JosephThomasParker May 13, 2021
d6d202a
Change MPI_Request buffers to Arrays
JosephThomasParker May 13, 2021
70007e4
Merge remote-tracking branch 'origin/cmake-coverage-sanitizers' into …
JosephThomasParker May 13, 2021
bb32b8b
Working version with same structure a cyclic laplace
JosephThomasParker May 14, 2021
05796e3
Add solution verify routine to PCR
JosephThomasParker May 15, 2021
324db57
Add solution verify routine to cyclic laplace
JosephThomasParker May 15, 2021
115707a
Working for zero bcs
JosephThomasParker May 19, 2021
eafd6ae
Swap API for eliminate_boundary_rows interface
JosephThomasParker May 19, 2021
3bac821
Add r modification in eliminate bdy rows
JosephThomasParker May 19, 2021
4244689
Make pcr solver interface take a b c in expected order
JosephThomasParker May 19, 2021
7df08d0
Give a b c correct meaning inside pcr_solve function
JosephThomasParker May 19, 2021
85c202c
Give correct meaning to a b c in eliminate_boundary_rows
JosephThomasParker May 19, 2021
6f5dceb
Add correct r operation to eliminate boundary rows
JosephThomasParker May 19, 2021
a267d8d
Make input to eliminate_boundary_rows const as appropriate
JosephThomasParker May 19, 2021
cdf8d27
Remove unnecessary b copy
JosephThomasParker May 19, 2021
01df955
Tidy and remove diagnostic writes
JosephThomasParker May 19, 2021
c3f22c0
Tidy and remove unused variables
JosephThomasParker May 19, 2021
f635c1f
Remove diagnostic writes
JosephThomasParker May 19, 2021
895989f
Merge branch 'next' into pcr_cyclic_copy+asan
JosephThomasParker May 19, 2021
f3fc1a7
Add information on PCR library
JosephThomasParker May 19, 2021
4a1003a
Remove NXPE==1 requirement
JosephThomasParker May 19, 2021
144b991
Use GlobalNxNoBoundaries variable
JosephThomasParker May 19, 2021
f59ec6f
Tidy int declaration
JosephThomasParker May 19, 2021
d59ff25
Use std::max instead of iff
JosephThomasParker May 19, 2021
337c57b
Use std::max instead of iff
JosephThomasParker May 19, 2021
de45ee8
Run clang tidy
JosephThomasParker May 19, 2021
794d9e9
Tidy comment
JosephThomasParker May 19, 2021
a26e415
Use GlobalNxNoBoundaries
JosephThomasParker May 19, 2021
4450965
Inline the setup function
JosephThomasParker May 19, 2021
9a6f144
Allow NYPE != 1
JosephThomasParker May 20, 2021
400d0e9
clang format
JosephThomasParker May 20, 2021
f622b97
Add PCR case to the test-laplace integrated test
JosephThomasParker May 20, 2021
30b93e4
Remove const int input
JosephThomasParker May 20, 2021
888ea14
Keep const in cxx
JosephThomasParker May 20, 2021
f5a4ce4
Fix use of reserved identifier for header guard
ZedThree May 21, 2021
d9b5f57
Fix some clang-tidy warnings
ZedThree May 21, 2021
0edf17d
Reduce scope of some local variables and immediately initialise them
ZedThree May 21, 2021
2e066d7
Make some LaplacePCR methods const
ZedThree May 21, 2021
e737ff5
Use override on overridden virtual functions
ZedThree May 21, 2021
3d5d949
Fix clang-tidy warning about uninitialised members
ZedThree May 21, 2021
f9c648e
Remove some unused private members
ZedThree May 21, 2021
f24aa25
Delete some commented out code
ZedThree May 21, 2021
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ set(BOUT_SOURCES
./src/invert/laplace/impls/multigrid/multigrid_solver.cxx
./src/invert/laplace/impls/naulin/naulin_laplace.cxx
./src/invert/laplace/impls/naulin/naulin_laplace.hxx
./src/invert/laplace/impls/pcr/pcr.cxx
./src/invert/laplace/impls/pcr/pcr.hxx
./src/invert/laplace/impls/pdd/pdd.cxx
./src/invert/laplace/impls/pdd/pdd.hxx
./src/invert/laplace/impls/petsc/petsc_laplace.cxx
Expand Down Expand Up @@ -343,6 +345,10 @@ target_include_directories(bout++ PUBLIC
target_compile_features(bout++ PUBLIC cxx_std_14)
set_target_properties(bout++ PROPERTIES CXX_EXTENSIONS OFF)

# Various sanitizers, including coverage and address sanitizer
include(cmake/Sanitizers.cmake)
enable_sanitizers(bout++)

##################################################
# Components of the version number
# Pre-release identifier (BOUT_VERSION_TAG) set above
Expand Down
109 changes: 109 additions & 0 deletions cmake/Sanitizers.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Adapted from
# https://github.com/lefticus/cpp_starter_project/blob/master/cmake/Sanitizers.cmake
# Public domain

function(enable_sanitizers target_name)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
option(ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" FALSE)
message(STATUS "Enable coverage: ${ENABLE_COVERAGE}")

if(ENABLE_COVERAGE)
target_compile_options(${target_name} PUBLIC --coverage -O0 -g)
target_link_libraries(${target_name} PUBLIC --coverage)

find_program(fastcov_FOUND fastcov)
message(STATUS "Looking for fastcov: ${fastcov_FOUND}")
find_program(genhtml_FOUND genhtml)
message(STATUS "Looking for genhtml: ${fastcov_FOUND}")

if (fastcov_FOUND AND genhtml_FOUND)
set(COVERAGE_NAME coverage CACHE STRING "Name of coverage output file")
set(COVERAGE_FILE "${COVERAGE_NAME}.info")
set(COVERAGE_MSG "Open file://${PROJECT_SOURCE_DIR}/${COVERAGE_NAME}/index.html in your browser to view coverage HTML output")

add_custom_target(code-coverage-capture
COMMAND
fastcov --include "${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}/include"
--exclude "${CMAKE_CURRENT_SOURCE_DIR}/externalpackages"
--lcov --process-gcno
--output "${COVERAGE_FILE}"
COMMAND
genhtml --output-directory "${COVERAGE_NAME}" --demangle-cpp --legend --show-details "${COVERAGE_FILE}"
COMMAND
"${CMAKE_COMMAND}" -E echo ${COVERAGE_MSG}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Capturing coverage information"
BYPRODUCTS
"${COVERAGE_FILE}"
"${COVERAGE_NAME}/index.html"
)

add_custom_target(code-coverage-clean
COMMAND
fastcov --zerocounters
COMMENT "Cleaning coverage information"
)
else()
message(STATUS "Coverage enabled, but coverage-capture not available. Please install fastcov and lcov")
endif()

endif()

set(SANITIZERS "")

option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" FALSE)
if(ENABLE_SANITIZER_ADDRESS)
list(APPEND SANITIZERS "address")
endif()

option(ENABLE_SANITIZER_LEAK "Enable leak sanitizer" FALSE)
if(ENABLE_SANITIZER_LEAK)
list(APPEND SANITIZERS "leak")
endif()

option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer" FALSE)
if(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR)
list(APPEND SANITIZERS "undefined")
endif()

option(ENABLE_SANITIZER_THREAD "Enable thread sanitizer" FALSE)
if(ENABLE_SANITIZER_THREAD)
if("address" IN_LIST SANITIZERS OR "leak" IN_LIST SANITIZERS)
message(WARNING "Thread sanitizer does not work with Address and Leak sanitizer enabled")
else()
list(APPEND SANITIZERS "thread")
endif()
endif()

option(ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" FALSE)
if(ENABLE_SANITIZER_MEMORY AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
if("address" IN_LIST SANITIZERS
OR "thread" IN_LIST SANITIZERS
OR "leak" IN_LIST SANITIZERS)
message(WARNING "Memory sanitizer does not work with Address, Thread and Leak sanitizer enabled")
else()
list(APPEND SANITIZERS "memory")
endif()
endif()

list(
JOIN
SANITIZERS
","
LIST_OF_SANITIZERS)

endif()

if(LIST_OF_SANITIZERS)
if(NOT
"${LIST_OF_SANITIZERS}"
STREQUAL
"")
message(STATUS "Sanitizers enabled: ${LIST_OF_SANITIZERS}")
target_compile_options(${target_name} PUBLIC -fsanitize=${LIST_OF_SANITIZERS} -fno-omit-frame-pointer)
target_link_options(${target_name} PUBLIC -fsanitize=${LIST_OF_SANITIZERS})
endif()
endif()

endfunction()
1 change: 1 addition & 0 deletions include/invert_laplace.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ constexpr auto LAPLACE_CYCLIC = "cyclic";
constexpr auto LAPLACE_MULTIGRID = "multigrid";
constexpr auto LAPLACE_NAULIN = "naulin";
constexpr auto LAPLACE_IPT = "ipt";
constexpr auto LAPLACE_PCR = "pcr";

// Inversion flags for each boundary
/// Zero-gradient for DC (constant in Z) component. Default is zero value
Expand Down
2 changes: 1 addition & 1 deletion src/invert/laplace/impls/makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

BOUT_TOP = ../../../..

DIRS = serial_tri serial_band pdd spt petsc cyclic multigrid naulin petsc3damg iterative_parallel_tri
DIRS = serial_tri serial_band pdd spt petsc cyclic multigrid naulin petsc3damg iterative_parallel_tri pcr

include $(BOUT_TOP)/make.config
8 changes: 8 additions & 0 deletions src/invert/laplace/impls/pcr/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

BOUT_TOP = ../../../../..

SOURCEC = pcr.cxx
SOURCEH = pcr.hxx
TARGET = lib

include $(BOUT_TOP)/make.config
Loading