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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode/
.DS_Store
build/*
_build
install/*
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
endif()

option(RESOLVE_TEST_WITH_BSUB "Use `jsrun` instead of `mpirun` commands when running tests" OFF)
option(RESOLVE_USE_KLU "Use KLU, AMD and COLAMD libraries from SuiteSparse" ON)
option(RESOLVE_USE_KLU "Use KLU, AMD and COLAMD libraries from SuiteSparse" OFF)
option(RESOLVE_USE_LUSOL "Build the LUSOL library" OFF)
option(RESOLVE_USE_CUDA "Use CUDA language and SDK" OFF)
option(RESOLVE_USE_HIP "Use HIP language and ROCm library" OFF)
Expand All @@ -32,7 +32,7 @@ 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_DOXYGEN "Use Doxygen to generate Re::Solve documentation" ON)
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")

# update this if more fortran code is added. this should be good enough for now though
Expand Down Expand Up @@ -73,10 +73,10 @@ endif()


if (RESOLVE_USE_KLU)
include(FindKLU)
if(NOT KLU_LIBRARY)
include(FindSuiteSparse)
if(NOT SUITESPARSE_LIBRARY)
message(STATUS "Cannot find KLU, disabling SuiteSparse module ...")
set(RESOLVE_USE_KLU OFF CACHE BOOL "Build without SuiteSparse AMD module." FORCE)
set(RESOLVE_USE_KLU OFF CACHE BOOL "Build without SuiteSparse module." FORCE)
endif()
else()
message(STATUS "Not using SuiteSparse KLU")
Expand Down
54 changes: 0 additions & 54 deletions cmake/FindKLU.cmake

This file was deleted.

80 changes: 80 additions & 0 deletions cmake/FindSuiteSparse.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#[[

Finds Sutiesparse include directory and libraries and exports target `Suitesparse`

User may set:
- SUITESPARSE_ROOT_DIR

Author(s):
- Cameron Rutherford <[email protected]>

]]
set(SUITESPARSE_MODULES
amd
colamd
klu
suitesparseconfig)

find_library(SUITESPARSE_LIBRARY
NAMES
${SUITESPARSE_MODULES}
PATHS
${SUITESPARSE_DIR} $ENV{SUITESPARSE_DIR} ${SUITESPARSE_ROOT_DIR}
ENV LD_LIBRARY_PATH ENV DYLD_LIBRARY_PATH
PATH_SUFFIXES
lib64 lib)

if(SUITESPARSE_LIBRARY)
set(SUITESPARSE_LIBRARY CACHE FILEPATH "Path to Suitesparse library")
get_filename_component(SUITESPARSE_LIBRARY_DIR ${SUITESPARSE_LIBRARY} DIRECTORY CACHE "Suitesparse library directory")
message(STATUS "Found Suitesparse libraries in: " ${SUITESPARSE_LIBRARY_DIR})
mark_as_advanced(SUITESPARSE_LIBRARY SUITESPARSE_LIBRARY_DIR)
if(NOT SUITESPARSE_DIR)
get_filename_component(SUITESPARSE_DIR ${SUITESPARSE_LIBRARY_DIR} DIRECTORY CACHE)
endif()
endif()

# Find SUITESPARSE header path and ensure all needed files are there
find_path(SUITESPARSE_INCLUDE_DIR
NAMES
amd.h
colamd.h
klu.h
SuiteSparse_config.h
PATHS
${SUITESPARSE_DIR} $ENV{SUITESPARSE_DIR} ${SUITESPARSE_ROOT_DIR} ${SUITESPARSE_LIBRARY_DIR}/..
PATH_SUFFIXES
include)

if(SUITESPARSE_LIBRARY)
message(STATUS "Found Suitesparse include: ${SUITESPARSE_INCLUDE_DIR}")
mark_as_advanced(SUITESPARSE_INCLUDE_DIR)
unset(SUITESPARSE_LIBRARY)
add_library(SUITESPARSE INTERFACE IMPORTED)
target_include_directories(SUITESPARSE INTERFACE ${SUITESPARSE_INCLUDE_DIR})
foreach(mod ${SUITESPARSE_MODULES})
find_library(suitesparse_${mod}
NAMES ${mod}
HINTS ${SUITESPARSE_LIBRARY_DIR})
if(suitesparse_${mod})
message(STATUS "Found suitesparse internal library " ${mod})
target_link_libraries(SUITESPARSE INTERFACE ${suitesparse_${mod}})
mark_as_advanced(suitesparse_${mod})
else()
message(SEND_ERROR "Suitesparse internal library " ${mod} " not found")
endif()
endforeach(mod)
else()
if(NOT SUITESPARSE_ROOT_DIR)
message(STATUS "Suitesparse dir not found! Please provide correct filepath.")
set(SUITESPARSE_DIR ${SUITESPARSE_DIR} CACHE PATH "Path to Suitesparse installation root.")
unset(SUITESPARSE_LIBRARY CACHE)
unset(SUITESPARSE_INCLUDE_DIR CACHE)
unset(SUITESPARSE_LIBRARY_DIR CACHE)
elseif(NOT SUITESPARSE_LIBRARY)
message(STATUS "Suitesparse library not found! Please provide correct filepath.")
endif()
if(SUITESPARSE_ROOT_DIR AND NOT SUITESPARSE_INCLUDE_DIR)
message(STATUS "Suitesparse include dir not found! Please provide correct filepath.")
endif()
endif()
3 changes: 2 additions & 1 deletion resolve/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ add_subdirectory(random)
add_library(resolve_tpl INTERFACE)

if(RESOLVE_USE_KLU)
target_link_libraries(resolve_tpl INTERFACE KLU)
target_link_libraries(resolve_tpl INTERFACE ${suitesparse_klu})
target_include_directories(resolve_tpl INTERFACE ${SUITESPARSE_INCLUDE_DIR})
list(APPEND ReSolve_SRC ${ReSolve_KLU_SRC})
list(APPEND ReSolve_HEADER_INSTALL ${ReSolve_KLU_HEADER_INSTALL})
endif()
Expand Down