Skip to content

Commit

Permalink
This fixes cmake for permutation in HyKKT (#209)
Browse files Browse the repository at this point in the history
* added new permutation kernels

* edited cmake

* added Hello world tests

* added Hello world tests

* resolved conflict

* hykkt hello world working, working on linking for permutation

* resolved conflict

* Ignore files in resolve/hybrid dir.

* Remove cpu subdirectory in hykkt dir.

* hykkt lib builds.

* Fix issues in CMake related to HyKKT build.

* resolved conflict

* HyKKT permutation test works.

* modifications for CUDA

* removed extraneous tests

* reformatted according to contributing guidelines

* fixed straggling old names

* stash

* fixed capitalization for selectionSort2

* fixed capitalization for selectionSort2

* doesn't add hykkt if not using suitesparse

* doesn't add hykkt if not using suitesparse

* added namespaces and capitalized enums

* fixed naming

* function alignment

* namespace fixes, const where possible

* Fix issue with linking workspace to HyKKT. (#211)

* Coding style suggestions (#213)

* Coding style suggestions.

* added param in/out

* Style suggestions for permutation tests.

* Some more doxygen formatting.

---------

Co-authored-by: shakedregev <shakedvregev@gmail.com>

* added requested changes

* addressed Doxygen comment issues

---------

Co-authored-by: Slaven Peles <peless@ornl.gov>
  • Loading branch information
shakedregev and pelesh authored Jan 15, 2025
1 parent 571d13b commit 393fa92
Show file tree
Hide file tree
Showing 12 changed files with 978 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ spack-configure-*
docs/dox.warnings
docs/@dox_output_dir@axom.tag
docs/html

10 changes: 5 additions & 5 deletions cmake/FindSuiteSparse.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ find_library(SUITESPARSE_LIBRARY
${SUITESPARSE_DIR} $ENV{SUITESPARSE_DIR} ${SUITESPARSE_ROOT_DIR}
ENV LD_LIBRARY_PATH ENV DYLD_LIBRARY_PATH
PATH_SUFFIXES
lib64 lib)
lib/x86_64-linux-gnu lib64 lib)

if(SUITESPARSE_LIBRARY)
set(SUITESPARSE_LIBRARY CACHE FILEPATH "Path to Suitesparse library")
set(SUITESPARSE_LIBRARY CACHE FILEPATH "File 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)
Expand All @@ -44,7 +44,7 @@ find_path(SUITESPARSE_INCLUDE_DIR
PATHS
${SUITESPARSE_DIR} $ENV{SUITESPARSE_DIR} ${SUITESPARSE_ROOT_DIR} ${SUITESPARSE_LIBRARY_DIR}/..
PATH_SUFFIXES
include)
include include/suitesparse)

if(SUITESPARSE_LIBRARY)
message(STATUS "Found Suitesparse include: ${SUITESPARSE_INCLUDE_DIR}")
Expand Down Expand Up @@ -75,6 +75,6 @@ else()
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.")
message(STATUS "Suitesparse include dir not found! Please provide correct path.")
endif()
endif()
endif()
10 changes: 10 additions & 0 deletions resolve/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ set(ReSolve_LUSOL_SRC
LinSolverDirectLUSOL.cpp
)


# C++ code that links to CUDA SDK libraries
set(ReSolve_CUDASDK_SRC
LinSolverDirectCuSolverGLU.cpp
Expand Down Expand Up @@ -113,6 +114,7 @@ if(RESOLVE_USE_LUSOL)
list(APPEND ReSolve_Targets_List lusol_lib)
endif()


# If no GPU support is enabled, link to dummy device backend
if(NOT RESOLVE_USE_GPU)
add_subdirectory(cpu)
Expand All @@ -137,6 +139,14 @@ if(RESOLVE_USE_HIP)
list(APPEND ReSolve_HEADER_INSTALL ${ReSolve_ROCM_HEADER_INSTALL})
endif()

# Add HyKKT solver
if(RESOLVE_USE_KLU)
add_subdirectory(hykkt)
endif()
#list(APPEND ReSolve_Targets_List resolve_hykkt)



# Set installable targets
install(TARGETS ${ReSolve_Targets_List} EXPORT ReSolveTargets)

Expand Down
57 changes: 57 additions & 0 deletions resolve/hykkt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#[[
@brief Build ReSolve matrix module
@author Slaven Peles <peless@ornl.gov>
]]

# C++ code
set(HyKKT_SRC
Permutation.cpp
cpuPermutationKernels.cpp
)

# C++ code that depends on CUDA SDK libraries
set(HyKKT_CUDASDK_SRC
)

# and on HIP
set(HyKKT_ROCM_SRC
)

# Header files to be installed
set(HyKKT_HEADER_INSTALL
Permutation.hpp
cpuPermutationKernels.hpp
)

# Build shared library ReSolve::matrix
add_library(resolve_hykkt SHARED ${HyKKT_SRC})
target_link_libraries(resolve_hykkt PUBLIC resolve_logger resolve_vector ${suitesparse_amd})
target_include_directories(resolve_hykkt PUBLIC ${SUITESPARSE_INCLUDE_DIR})

# Link to CUDA ReSolve backend if CUDA is support enabled
if (RESOLVE_USE_CUDA)
target_sources(resolve_hykkt PRIVATE ${HyKKT_CUDASDK_SRC})
target_link_libraries(resolve_hykkt PUBLIC resolve_backend_cuda)
endif()

if (RESOLVE_USE_HIP)
target_sources(resolve_hykkt PRIVATE ${HyKKT_ROCM_SRC})
target_link_libraries(resolve_hykkt PUBLIC resolve_backend_hip)
endif()

# Link to dummy device backend if GPU support is not enabled
if (NOT RESOLVE_USE_GPU)
target_link_libraries(resolve_hykkt PUBLIC resolve_backend_cpu)
endif()

target_link_libraries(resolve_hykkt PUBLIC resolve_workspace)

target_include_directories(resolve_hykkt INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

install(FILES ${HyKKT_HEADER_INSTALL} DESTINATION include/resolve/hykkt)
Loading

0 comments on commit 393fa92

Please sign in to comment.