Skip to content

Commit

Permalink
Merge pull request #125 from jlblancoc/suitesparse_7.5.1
Browse files Browse the repository at this point in the history
Update SuiteSparse to 7.5.1 with embedded Metis
  • Loading branch information
jlblancoc authored Jan 22, 2024
2 parents 58152e5 + 4060280 commit 1e07daa
Show file tree
Hide file tree
Showing 11,183 changed files with 5,126,705 additions and 704,830 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Unreleased
- Update SuiteSparse to 7.5.1 with embedded Metis [#125](https://github.com/jlblancoc/suitesparse-metis-for-windows/pull/125)
- fixes Metis based segmentation fault [#123](https://github.com/jlblancoc/suitesparse-metis-for-windows/issues/123)
- remove `SuiteSparse::metis` target as Metis is now a private dependency of `CHOLMOD` module
- remove option `METIS_DIR`
- always compile `SuiteSparse_config` with `-DNTIMER` disabling tic-toc support
- compile `CXSparse` without complex support
- remove SourceWrappers for `CHOLMOD` and `CXSparse` modules

# unreleased
- More generic `OpenBLAS` linkage [#122](https://github.com/jlblancoc/suitesparse-metis-for-windows/pull/122)
Expand Down
42 changes: 2 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ else()
message(STATUS "Using user defined CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
endif()

# Fix GKlib path:
if(NOT WIN32)
set(GKLIB_PATH "${${PROJECT_NAME}_SOURCE_DIR}/SuiteSparse/metis-5.1.0/GKlib" CACHE INTERNAL "Path to GKlib (for METIS)" FORCE)
endif()

# allow creating DLLs in Windows without touching the source code:
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.4.0" AND WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
Expand Down Expand Up @@ -87,40 +82,16 @@ endif(MSVC)

## check if we can build metis
set(BUILD_METIS_DEFAULT ON)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/SuiteSparse/metis-5.1.0/CMakeLists.txt")
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/SuiteSparse/CHOLMOD/SuiteSparse_metis/CMakeLists.txt")
set(BUILD_METIS_DEFAULT OFF)
endif()

set(WITH_CUDA OFF CACHE BOOL "Build with CUDA support")

set(BUILD_METIS ${BUILD_METIS_DEFAULT} CACHE BOOL "Build METIS for partitioning?")
set(METIS_DIR ${${PROJECT_NAME}_SOURCE_DIR}/SuiteSparse/metis-5.1.0 CACHE PATH "Source directory of METIS")

if(BUILD_METIS)
## prepare the installation :
## using metis target here is not possible because this target is added in another branch of the CMake structure
## TRICK: need to dynamically modify the metis CMakeLists.txt file before it going to parsed...
## (very ugly/poor for a metis project get from SCM (git/svn/cvs) but it's works ;) and it doesn't matter if metis was get from .zip)
if(EXISTS "${METIS_DIR}/libmetis/CMakeLists.txt")
file(READ "${METIS_DIR}/libmetis/CMakeLists.txt" contentFile)
string(REGEX MATCH "EXPORT SuiteSparseTargets" alreadyModified ${contentFile}) ## use a string pattern to check if we have to do the modif
if(NOT alreadyModified)
file(APPEND "${METIS_DIR}/libmetis/CMakeLists.txt"
"
set_target_properties(metis PROPERTIES PUBLIC_HEADER \"\${CMAKE_CURRENT_BINARY_DIR}/../include/metis.h\")
install(TARGETS metis ## this line is also the string pattern to check if the modification had already done
EXPORT SuiteSparseTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include
)
"
)
endif()
endif()
add_subdirectory("${METIS_DIR}" "metis") ## important part for building metis from its src files

set(METIS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SuiteSparse/CHOLMOD/SuiteSparse_metis")
# extract METIS version string from metis.h header
set(_METIS_VERSION_HEADER ${METIS_DIR}/include/metis.h)
file(READ ${_METIS_VERSION_HEADER} _METIS_VERSION_CONTENTS)
Expand Down Expand Up @@ -322,15 +293,6 @@ else()
endif()
endif()

if(BUILD_METIS)
set(SuiteSparse_LINKER_METIS_LIBS "metis")
## namespaced library target for config
set(SuiteSparse_EXPORTED_METIS_LIBS "SuiteSparse::metis")
else()
set(SuiteSparse_LINKER_METIS_LIBS "")
set(SuiteSparse_EXPORTED_METIS_LIBS "")
endif()

add_subdirectory(SuiteSparse)

macro(get_SuiteSparse_Version)
Expand Down
12 changes: 7 additions & 5 deletions SuiteSparse/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ SPQR/Demo/gpu_results.txt
SPQR/Demo/qrdemo_gpu
SPQR/Demo/qrdemo_gpu2
SPQR/Demo/qrdemo_gpu3
SPQR/Demo/pfile
SPQR/Demo/tfile
UMFPACK/Demo/numeric.umf
UMFPACK/Demo/symbolic.umf
UMFPACK/Demo/umfpack_di_demo
Expand Down Expand Up @@ -125,6 +127,7 @@ CSparse/Tcov/cov.sort
CSparse/Tcov/cover.out
CSparse/Tcov/covs.out
CSparse/Tcov/cs_*.c
CSparse/Tcov/csparse_version.c
CSparse/Tcov/cstcov_test
CSparse/Tcov/*.out
CSparse/Tcov/cs_demo1
Expand All @@ -136,10 +139,7 @@ CXSparse/Tcov/cov.sort
CXSparse/Tcov/cover.out
CXSparse/Tcov/covs.out
CXSparse/Tcov/cs_*.c
CXSparse/Tcov/cs*_ci.c
CXSparse/Tcov/cs*_cl.c
CXSparse/Tcov/cs*_di.c
CXSparse/Tcov/cs*_dl.c
CXSparse/Tcov/cxsparse_version.c
CXSparse/Tcov/*.out
CXSparse/Tcov/cs_demo1_ci
CXSparse/Tcov/cs_demo1_cl
Expand Down Expand Up @@ -170,7 +170,9 @@ SPQR/Tcov/gpu_results.txt
SPQR/Tcov/gpuqrengine_demo
SPQR/Tcov/qrdemo_gpu
SPQR/Tcov/qrtest
SPQR/Tcov/qrtest32
SPQR/Tcov/qrtest_out.txt
SPQR/Tcov/qrtest_out32.txt
SPQR/Tcov/troll.m
SPQR/Tcov/cov.out

Expand All @@ -180,7 +182,7 @@ UMFPACK/Tcov/cover.out
# ignore these specific files in the Package/MATLAB directories
MATLAB_Tools/spqr_rank/save_samples_demo_spqr_rank.mat
CXSparse/MATLAB/CSparse/cs_cl_*.c
CXSparse/MATLAB/Test/cs_*.c
CXSparse/MATLAB/Test/cs_cl_*.c

RBio/Tcov/RBdemo
RBio/Tcov/RBdemo.c
Expand Down
17 changes: 17 additions & 0 deletions SuiteSparse/AMD/Config/AMD.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# AMD, Copyright (c) 1996-2023, Timothy A. Davis.
# All Rights Reserved.
# SPDX-License-Identifier: BSD-3-Clause

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: AMD
URL: https://github.com/DrTimothyAldenDavis/SuiteSparse
Description: Routines for permuting sparse matrices prior to factorization in SuiteSparse
Version: @AMD_VERSION_MAJOR@.@AMD_VERSION_MINOR@.@AMD_VERSION_SUB@
Requires.private: SuiteSparse_config
Libs: -L${libdir} -l@SUITESPARSE_LIB_BASE_NAME@
Libs.private: @AMD_STATIC_LIBS@
Cflags: -I${includedir}
152 changes: 152 additions & 0 deletions SuiteSparse/AMD/Config/AMDConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#-------------------------------------------------------------------------------
# SuiteSparse/AMD/cmake_modules/AMDConfig.cmake
#-------------------------------------------------------------------------------

# The following copyright and license applies to just this file only, not to
# the library itself:
# AMDConfig.cmake, Copyright (c) 2023, Timothy A. Davis. All Rights Reserved.
# SPDX-License-Identifier: BSD-3-clause

#-------------------------------------------------------------------------------

# Finds the AMD include file and compiled library.
# The following targets are defined:
# SuiteSparse::AMD - for the shared library (if available)
# SuiteSparse::AMD_static - for the static library (if available)

# For backward compatibility the following variables are set:

# AMD_INCLUDE_DIR - where to find amd.h
# AMD_LIBRARY - dynamic AMD library
# AMD_STATIC - static AMD library
# AMD_LIBRARIES - libraries when using AMD
# AMD_FOUND - true if AMD found

# Set ``CMAKE_MODULE_PATH`` to the parent folder where this module file is
# installed.

#-------------------------------------------------------------------------------

@PACKAGE_INIT@

set ( AMD_DATE "@AMD_DATE@" )
set ( AMD_VERSION_MAJOR @AMD_VERSION_MAJOR@ )
set ( AMD_VERSION_MINOR @AMD_VERSION_MINOR@ )
set ( AMD_VERSION_PATCH @AMD_VERSION_SUB@ )
set ( AMD_VERSION "@AMD_VERSION_MAJOR@.@AMD_VERSION_MINOR@.@AMD_VERSION_SUB@" )

# Check for dependent targets
include ( CMakeFindDependencyMacro )

# Look for SuiteSparse_config target
if ( @SUITESPARSE_IN_BUILD_TREE@ )
if ( NOT TARGET SuiteSparse::SuiteSparseConfig )
# First check in a common build tree
find_dependency ( SuiteSparse_config @SUITESPARSE_CONFIG_VERSION_MAJOR@.@SUITESPARSE_CONFIG_VERSION_MINOR@
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
# Then, check in the currently active CMAKE_MODULE_PATH
if ( NOT SuiteSparse_config_FOUND )
find_dependency ( SuiteSparse_config @SUITESPARSE_CONFIG_VERSION_MAJOR@.@SUITESPARSE_CONFIG_VERSION_MINOR@ )
endif ( )
endif ( )
else ( )
if ( NOT TARGET SuiteSparse::SuiteSparseConfig )
find_dependency ( SuiteSparse_config @SUITESPARSE_CONFIG_VERSION_MAJOR@.@SUITESPARSE_CONFIG_VERSION_MINOR@ )
endif ( )
endif ( )
if ( NOT SuiteSparse_config_FOUND )
set ( AMD_FOUND OFF )
return ( )
endif ( )


# Import target
include ( ${CMAKE_CURRENT_LIST_DIR}/AMDTargets.cmake )

# The following is only for backward compatibility with FindAMD.

set ( _target_shared SuiteSparse::AMD )
set ( _target_static SuiteSparse::AMD_static )
set ( _var_prefix "AMD" )

if ( NOT @BUILD_SHARED_LIBS@ AND NOT TARGET ${_target_shared} )
# make sure there is always an import target without suffix )
add_library ( ${_target_shared} ALIAS ${_target_static} )
endif ( )

get_target_property ( ${_var_prefix}_INCLUDE_DIR ${_target_shared} INTERFACE_INCLUDE_DIRECTORIES )
if ( ${_var_prefix}_INCLUDE_DIR )
# First item in SuiteSparse targets contains the "main" header directory.
list ( GET ${_var_prefix}_INCLUDE_DIR 0 ${_var_prefix}_INCLUDE_DIR )
endif ( )
get_target_property ( ${_var_prefix}_LIBRARY ${_target_shared} IMPORTED_IMPLIB )
if ( NOT ${_var_prefix}_LIBRARY )
get_target_property ( _library_chk ${_target_shared} IMPORTED_LOCATION )
if ( EXISTS ${_library_chk} )
set ( ${_var_prefix}_LIBRARY ${_library_chk} )
endif ( )
endif ( )
if ( TARGET ${_target_static} )
get_target_property ( ${_var_prefix}_STATIC ${_target_static} IMPORTED_LOCATION )
endif ( )

# Check for most common build types
set ( _config_types "Debug" "Release" "RelWithDebInfo" "MinSizeRel" "None" )

get_property ( _isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG )
if ( _isMultiConfig )
# For multi-configuration generators (e.g., Visual Studio), prefer those
# configurations.
list ( PREPEND _config_types ${CMAKE_CONFIGURATION_TYPES} )
else ( )
# For single-configuration generators, prefer the current configuration.
list ( PREPEND _config_types ${CMAKE_BUILD_TYPE} )
endif ( )

list ( REMOVE_DUPLICATES _config_types )

foreach ( _config ${_config_types} )
string ( TOUPPER ${_config} _uc_config )
if ( NOT ${_var_prefix}_LIBRARY )
get_target_property ( _library_chk ${_target_shared}
IMPORTED_IMPLIB_${_uc_config} )
if ( EXISTS ${_library_chk} )
set ( ${_var_prefix}_LIBRARY ${_library_chk} )
endif ( )
endif ( )
if ( NOT ${_var_prefix}_LIBRARY )
get_target_property ( _library_chk ${_target_shared}
IMPORTED_LOCATION_${_uc_config} )
if ( EXISTS ${_library_chk} )
set ( ${_var_prefix}_LIBRARY ${_library_chk} )
endif ( )
endif ( )
if ( TARGET ${_target_static} AND NOT ${_var_prefix}_STATIC )
get_target_property ( _library_chk ${_target_static}
IMPORTED_LOCATION_${_uc_config} )
if ( EXISTS ${_library_chk} )
set ( ${_var_prefix}_STATIC ${_library_chk} )
endif ( )
endif ( )
endforeach ( )

set ( AMD_LIBRARIES ${AMD_LIBRARY} )

macro ( suitesparse_check_exist _var _files )
# ignore generator expressions
string ( GENEX_STRIP "${_files}" _files2 )

foreach ( _file ${_files2} )
if ( NOT EXISTS "${_file}" )
message ( FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist!" )
endif ( )
endforeach ()
endmacro ( )

suitesparse_check_exist ( AMD_INCLUDE_DIR ${AMD_INCLUDE_DIR} )
suitesparse_check_exist ( AMD_LIBRARY ${AMD_LIBRARY} )

message ( STATUS "AMD version: ${AMD_VERSION}" )
message ( STATUS "AMD include: ${AMD_INCLUDE_DIR}")
message ( STATUS "AMD library: ${AMD_LIBRARY}")
message ( STATUS "AMD static: ${AMD_STATIC}")
Loading

0 comments on commit 1e07daa

Please sign in to comment.