Skip to content

Commit

Permalink
Merge pull request #816 from DrTimothyAldenDavis/paru_dev2
Browse files Browse the repository at this point in the history
merge paru_dev2 into dev2, with major updates to ParU, GraphBLAS, and minor changes to CHOLMOD, SPQR, SPEX, and Example.
  • Loading branch information
DrTimothyAldenDavis authored May 29, 2024
2 parents 14e2699 + a77a225 commit fb5afcc
Show file tree
Hide file tree
Showing 279 changed files with 53,435 additions and 22,484 deletions.
75 changes: 63 additions & 12 deletions CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# cmake 3.22 is required to find the BLAS/LAPACK
cmake_minimum_required ( VERSION 3.22 )

set ( CHOLMOD_DATE "Mar 22, 2024" )
set ( CHOLMOD_DATE "Apr XX, 2024" ) # FIXME NOW
set ( CHOLMOD_VERSION_MAJOR 5 CACHE STRING "" FORCE )
set ( CHOLMOD_VERSION_MINOR 2 CACHE STRING "" FORCE )
set ( CHOLMOD_VERSION_SUB 1 CACHE STRING "" FORCE )
set ( CHOLMOD_VERSION_MINOR 3 CACHE STRING "" FORCE )
set ( CHOLMOD_VERSION_SUB 0 CACHE STRING "" FORCE )

message ( STATUS "Building CHOLMOD version: v"
${CHOLMOD_VERSION_MAJOR}.
Expand Down Expand Up @@ -112,10 +112,10 @@ endif ( )
#-------------------------------------------------------------------------------

if ( NOT SUITESPARSE_ROOT_CMAKELISTS )
find_package ( SuiteSparse_config 7.7.0
find_package ( SuiteSparse_config 7.8.0
PATHS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/build NO_DEFAULT_PATH )
if ( NOT TARGET SuiteSparse::SuiteSparseConfig )
find_package ( SuiteSparse_config 7.7.0 REQUIRED )
find_package ( SuiteSparse_config 7.8.0 REQUIRED )
endif ( )

find_package ( AMD 3.3.2
Expand Down Expand Up @@ -302,6 +302,55 @@ endif ( )
# configure files
#-------------------------------------------------------------------------------

if ( CHOLMOD_CHECK )
set ( CHOLMOD_HAS_CHECK ON )
else ( )
set ( CHOLMOD_HAS_CHECK OFF )
endif ( )

if ( CHOLMOD_CHOLESKY )
set ( CHOLMOD_HAS_CHOLESKY ON )
else ( )
set ( CHOLMOD_HAS_CHOLESKY OFF )
endif ( )

if ( CHOLMOD_PARTITION )
set ( CHOLMOD_HAS_PARTITION ON )
else ( )
set ( CHOLMOD_HAS_PARTITION OFF )
endif ( )

if ( CHOLMOD_CAMD )
# CHOLMOD has both CAMD and CCOLAMD
set ( CHOLMOD_HAS_CAMD ON )
else ( )
set ( CHOLMOD_HAS_CAMD OFF )
endif ( )

if ( CHOLMOD_MATRIXOPS )
set ( CHOLMOD_HAS_MATRIXOPS ON )
else ( )
set ( CHOLMOD_HAS_MATRIXOPS OFF )
endif ( )

if ( CHOLMOD_MODIFY )
set ( CHOLMOD_HAS_MODIFY ON )
else ( )
set ( CHOLMOD_HAS_MODIFY OFF )
endif ( )

if ( CHOLMOD_SUPERNODAL )
set ( CHOLMOD_HAS_SUPERNODAL ON )
else ( )
set ( CHOLMOD_HAS_SUPERNODAL OFF )
endif ( )

if ( CHOLMOD_GPL )
set ( CHOLMOD_HAS_GPL ON )
else ( )
set ( CHOLMOD_HAS_GPL OFF )
endif ( )

configure_file ( "Config/cholmod.h.in"
"${PROJECT_SOURCE_DIR}/Include/cholmod.h"
NEWLINE_STYLE LF )
Expand Down Expand Up @@ -522,13 +571,15 @@ endif ( )

# CHOLMOD_CUDA
if ( CHOLMOD_HAS_CUDA )
if ( BUILD_SHARED_LIBS )
target_compile_definitions ( CHOLMOD PUBLIC "CHOLMOD_HAS_CUDA" )
endif ( )
set ( CHOLMOD_CFLAGS "${CHOLMOD_CFLAGS} -DCHOLMOD_HAS_CUDA" )
if ( BUILD_STATIC_LIBS )
target_compile_definitions ( CHOLMOD_static PUBLIC "CHOLMOD_HAS_CUDA" )
endif ( )
# cmake now configures cholmod.h with "#define CHOLMOD_HAS_CUDA" if CHOLMOD is
# being compiled with CUDA, so the -DCHOLMOD_HAS_CUDA flag is no longer needed.
# if ( BUILD_SHARED_LIBS )
# target_compile_definitions ( CHOLMOD PUBLIC "CHOLMOD_HAS_CUDA" )
# endif ( )
# set ( CHOLMOD_CFLAGS "${CHOLMOD_CFLAGS} -DCHOLMOD_HAS_CUDA" )
# if ( BUILD_STATIC_LIBS )
# target_compile_definitions ( CHOLMOD_static PUBLIC "CHOLMOD_HAS_CUDA" )
# endif ( )
if ( BUILD_SHARED_LIBS )
target_link_libraries ( CHOLMOD PRIVATE CUDA::nvrtc CUDA::cudart_static CUDA::cublas )
target_include_directories ( CHOLMOD INTERFACE
Expand Down
12 changes: 6 additions & 6 deletions CHOLMOD/Check/cholmod_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,32 +623,32 @@ int CHOLMOD(gpu_stats)
int print = Common->print ;
double cpu_time, gpu_time ;

#ifdef CHOLMOD_HAS_CUDA
#if defined ( CHOLMOD_HAS_CUDA ) && defined ( CHOLMOD_INT64 )
P2 ("%s", "\nCHOLMOD GPU/CPU statistics:\n") ;
#else
P2 ("%s", "\nCHOLMOD BLAS statistics:\n") ;
#endif
P2 ("SYRK CPU calls %12.0f", (double) Common->CHOLMOD_CPU_SYRK_CALLS) ;
P2 (" time %12.4e\n", Common->CHOLMOD_CPU_SYRK_TIME) ;
#ifdef CHOLMOD_HAS_CUDA
#if defined ( CHOLMOD_HAS_CUDA ) && defined ( CHOLMOD_INT64 )
P2 (" GPU calls %12.0f", (double) Common->CHOLMOD_GPU_SYRK_CALLS) ;
P2 (" time %12.4e\n", Common->CHOLMOD_GPU_SYRK_TIME) ;
#endif
P2 ("GEMM CPU calls %12.0f", (double) Common->CHOLMOD_CPU_GEMM_CALLS) ;
P2 (" time %12.4e\n", Common->CHOLMOD_CPU_GEMM_TIME) ;
#ifdef CHOLMOD_HAS_CUDA
#if defined ( CHOLMOD_HAS_CUDA ) && defined ( CHOLMOD_INT64 )
P2 (" GPU calls %12.0f", (double) Common->CHOLMOD_GPU_GEMM_CALLS) ;
P2 (" time %12.4e\n", Common->CHOLMOD_GPU_GEMM_TIME) ;
#endif
P2 ("POTRF CPU calls %12.0f", (double) Common->CHOLMOD_CPU_POTRF_CALLS) ;
P2 (" time %12.4e\n", Common->CHOLMOD_CPU_POTRF_TIME) ;
#ifdef CHOLMOD_HAS_CUDA
#if defined ( CHOLMOD_HAS_CUDA ) && defined ( CHOLMOD_INT64 )
P2 (" GPU calls %12.0f", (double) Common->CHOLMOD_GPU_POTRF_CALLS) ;
P2 (" time %12.4e\n", Common->CHOLMOD_GPU_POTRF_TIME) ;
#endif
P2 ("TRSM CPU calls %12.0f", (double) Common->CHOLMOD_CPU_TRSM_CALLS) ;
P2 (" time %12.4e\n", Common->CHOLMOD_CPU_TRSM_TIME) ;
#ifdef CHOLMOD_HAS_CUDA
#if defined ( CHOLMOD_HAS_CUDA ) && defined ( CHOLMOD_INT64 )
P2 (" GPU calls %12.0f", (double) Common->CHOLMOD_GPU_TRSM_CALLS) ;
P2 (" time %12.4e\n", Common->CHOLMOD_GPU_TRSM_TIME) ;
#endif
Expand All @@ -659,7 +659,7 @@ int CHOLMOD(gpu_stats)
gpu_time = Common->CHOLMOD_GPU_SYRK_TIME + Common->CHOLMOD_GPU_TRSM_TIME +
Common->CHOLMOD_GPU_GEMM_TIME + Common->CHOLMOD_GPU_POTRF_TIME ;

#ifdef CHOLMOD_HAS_CUDA
#if defined ( CHOLMOD_HAS_CUDA ) && defined ( CHOLMOD_INT64 )
P2 ("time in the BLAS: CPU %12.4e", cpu_time) ;
P2 (" GPU %12.4e", gpu_time) ;
P2 (" total: %12.4e\n", cpu_time + gpu_time) ;
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/Cholesky/cholmod_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#ifndef NCHOLESKY

#include "amd.h"
#if (!defined (AMD_VERSION) || (AMD_VERSION < AMD_VERSION_CODE (3,3)))
#error "CHOLMOD:Cholesky requires AMD 3.3.1 or later"
#if (!defined (AMD__VERSION) || (AMD__VERSION < SUITESPARSE__VERCODE(3,3,2)))
#error "CHOLMOD:Cholesky requires AMD 3.3.2 or later"
#endif

//------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/Cholesky/cholmod_colamd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#ifndef NCHOLESKY

#include "colamd.h"
#if (!defined (COLAMD_VERSION) || (COLAMD_VERSION < COLAMD_VERSION_CODE (3,3)))
#error "CHOLMOD:Cholesky requires COLAMD 3.3.1 or later"
#if (!defined (COLAMD__VERSION) || (COLAMD__VERSION < SUITESPARSE__VERCODE(3,3,3)))
#error "CHOLMOD:Cholesky requires COLAMD 3.3.3 or later"
#endif

//------------------------------------------------------------------------------
Expand Down
98 changes: 96 additions & 2 deletions CHOLMOD/Config/cholmod.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ int cholmod_l_version (int version [3]) ;

#define CHOLMOD__VERSION SUITESPARSE__VERCODE(@CHOLMOD_VERSION_MAJOR@,@CHOLMOD_VERSION_MINOR@,@CHOLMOD_VERSION_SUB@)
#if !defined (SUITESPARSE__VERSION) || \
(SUITESPARSE__VERSION < SUITESPARSE__VERCODE(7,7,0))
#error "CHOLMOD @CHOLMOD_VERSION_MAJOR@.@CHOLMOD_VERSION_MINOR@.@CHOLMOD_VERSION_SUB@ requires SuiteSparse_config 7.7.0 or later"
(SUITESPARSE__VERSION < SUITESPARSE__VERCODE(7,8,0))
#error "CHOLMOD @CHOLMOD_VERSION_MAJOR@.@CHOLMOD_VERSION_MINOR@.@CHOLMOD_VERSION_SUB@ requires SuiteSparse_config 7.8.0 or later"
#endif

//------------------------------------------------------------------------------
Expand All @@ -320,6 +320,7 @@ int cholmod_l_version (int version [3]) ;
// You do not have to edit any CHOLMOD files to compile and install CHOLMOD.
// However, if you do not use all of CHOLMOD's modules, you need to compile
// with the appropriate flag, or edit this file to add the appropriate #define.
// cmake configures these options for you.
//
// Compiler flags for CHOLMOD
//
Expand Down Expand Up @@ -349,6 +350,66 @@ int cholmod_l_version (int version [3]) ;
// #define NPRINT
// #define NGPL

// These flags are configured by cmake when CHOLMOD is compiled:
#cmakedefine CHOLMOD_HAS_GPL
#cmakedefine CHOLMOD_HAS_CHECK
#cmakedefine CHOLMOD_HAS_CHOLESKY
#cmakedefine CHOLMOD_HAS_CAMD
#cmakedefine CHOLMOD_HAS_PARTITION
#cmakedefine CHOLMOD_HAS_MATRIXOPS
#cmakedefine CHOLMOD_HAS_MODIFY
#cmakedefine CHOLMOD_HAS_SUPERNODAL
#cmakedefine CHOLMOD_HAS_CUDA
#cmakedefine CHOLMOD_HAS_OPENMP

#if defined(MATLAB_MEX_FILE) || defined(MATHWORKS)
// CHOLMOD MATLAB interface does not use CUDA
#undef CHOLMOD_HAS_CUDA
#endif

// The cmake flags defined above also ensure CHOLMOD knows which modules
// are available when it was compiled:

#ifndef CHOLMOD_HAS_GPL
#undef NGPL
#define NGPL
#endif

#ifndef CHOLMOD_HAS_CHECK
#undef NCHECK
#define NCHECK
#endif

#ifndef CHOLMOD_HAS_CHOLESKY
#undef NCHOLESKY
#define NCHOLESKY
#endif

#ifndef CHOLMOD_HAS_CAMD
#undef NCAMD
#define NCAMD
#endif

#ifndef CHOLMOD_HAS_PARTITION
#undef NPARTITION
#define NPARTITION
#endif

#ifndef CHOLMOD_HAS_MATRIXOPS
#undef NMATRIXOPS
#define NMATRIXOPS
#endif

#ifndef CHOLMOD_HAS_MODIFY
#undef NMODIFY
#define NMODIFY
#endif

#ifndef CHOLMOD_HAS_SUPERNODAL
#undef NSUPERNODAL
#define NSUPERNODAL
#endif

// The NGPL option disables the MatrixOps, Modify, and Supernodal modules. The
// existence of this #define here, and its use in these 3 modules, does not
// affect the license itself; see CHOLMOD/Doc/License.txt for your actual
Expand All @@ -370,6 +431,39 @@ int cholmod_l_version (int version [3]) ;
// the CHOLMOD:Utility Module is always required
#if 1

//------------------------------------------------------------------------------
// CHOLMOD query: check for CHOLMOD configuration
//------------------------------------------------------------------------------

#ifdef __cplusplus
extern "C" {
#endif

typedef enum
{
CHOLMOD_QUERY_HAS_GPL = 0, // has GPL licensed modules
CHOLMOD_QUERY_HAS_CHECK = 1, // has Check Module
CHOLMOD_QUERY_HAS_CHOLESKY = 2, // has Cholesky Module
CHOLMOD_QUERY_HAS_CAMD = 3, // has CAMD and CCOLAMD
CHOLMOD_QUERY_HAS_PARTITION = 4, // has Partition Module
CHOLMOD_QUERY_HAS_MATRIXOPS = 5, // has MatrixOps Module
CHOLMOD_QUERY_HAS_MODIFY = 6, // has Modify Module
CHOLMOD_QUERY_HAS_SUPERNODAL = 7, // has Supernodal Module
CHOLMOD_QUERY_HAS_CUDA = 8, // has GPU Module
CHOLMOD_QUERY_HAS_OPENMP = 9 // has OpenMP
}
cholmod_query_t ;

bool cholmod_query // true if CHOLMOD has a specific feature
(
cholmod_query_t feature
) ;
bool cholmod_l_query (cholmod_query_t feature) ;

#ifdef __cplusplus
}
#endif

//------------------------------------------------------------------------------
// CUDA BLAS
//------------------------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions CHOLMOD/Doc/CHOLMOD_UserGuide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2669,6 +2669,16 @@ \subsection{{\tt cholmod\_version}: return current CHOLMOD version}
prototypes. Both use {\tt int}'s. Unlike all other CHOLMOD functions, this
function does not take the {\tt Common} object as an input parameter.

%-------------------------------------------------------------------------------
\newpage \section{{\tt Utility} Module: query CHOLMOD configuration}
%-------------------------------------------------------------------------------

\input{_query.tex}
Returns \verb'true' if CHOLMOD has been compiled with the specific feature.
The feature is an enum defined as follows:

\input{_query_t.tex}

%-------------------------------------------------------------------------------
\newpage \section{{\tt Check} Module routines}
%-------------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions CHOLMOD/Doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Apr XX, 2024: version 5.3.0 FIXME NOW

* added cholmod_query: to deterimine at run time which modules
of CHOLMOD have been compiled into the libcholmod.so.
Also added CHOLMOD_HAS_* #defines in cholmod.h, configured
by cmake when CHOLMOD is compiled.

Mar 22, 2024: version 5.2.1

* minor updates to build system
Expand Down
2 changes: 2 additions & 0 deletions CHOLMOD/Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ CHOLMOD_UserGuide.pdf: CHOLMOD_UserGuide.tex UserGuide.bib $(I) $(C) $(M) Makefi
./getproto '/void \*cholmod_realloc/, /\*\) ;/' ../Include/cholmod.h > _realloc.tex
./getproto '/int cholmod_realloc_multiple/, /\*\) ;/' ../Include/cholmod.h > _realloc_multiple.tex
./getproto '/int cholmod_version/, /l_version/' ../Include/cholmod.h > _version.tex
./getproto '/bool cholmod_query/, /l_query/' ../Include/cholmod.h > _query.tex
./getproto '/typedef enum/, /cholmod_query_t/' ../Include/cholmod.h > _query_t.tex
./getproto '/int cholmod_check_common/, /\*\) ;/' ../Include/cholmod.h > _check_common.tex
./getproto '/int cholmod_print_common/, /\*\) ;/' ../Include/cholmod.h > _print_common.tex
./getproto '/int cholmod_check_sparse/, /\*\) ;/' ../Include/cholmod.h > _check_sparse.tex
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/Doc/cholmod_version.tex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
% version of SuiteSparse/CHOLMOD
\date{VERSION 5.2.1, Mar 22, 2024}
\date{VERSION 5.3.0, Apr XX, 2024}
4 changes: 2 additions & 2 deletions CHOLMOD/GPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if ( BUILD_SHARED_LIBS )
${CHOLMOD_CUDA_INCLUDES} )
set_target_properties ( CHOLMOD PROPERTIES POSITION_INDEPENDENT_CODE ON )
set_target_properties ( CHOLMOD PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
target_compile_definitions ( CHOLMOD PUBLIC "CHOLMOD_HAS_CUDA" )
# target_compile_definitions ( CHOLMOD PUBLIC "CHOLMOD_HAS_CUDA" )
endif ( )

if ( BUILD_STATIC_LIBS )
Expand All @@ -62,7 +62,7 @@ if ( BUILD_STATIC_LIBS )
${CHOLMOD_CUDA_INCLUDES} )
set_target_properties ( CHOLMOD_static PROPERTIES CUDA_SEPARABLE_COMPILATION on )
set_target_properties ( CHOLMOD_static PROPERTIES POSITION_INDEPENDENT_CODE on )
target_compile_definitions ( CHOLMOD_static PUBLIC "CHOLMOD_HAS_CUDA" )
# target_compile_definitions ( CHOLMOD_static PUBLIC "CHOLMOD_HAS_CUDA" )
endif ( )

if ( BUILD_SHARED_LIBS )
Expand Down
Loading

0 comments on commit fb5afcc

Please sign in to comment.