From 8030ed075277d414a562f7a2facffbc305f7cc5a Mon Sep 17 00:00:00 2001 From: Tim Davis Date: Sat, 25 Nov 2023 19:17:32 -0600 Subject: [PATCH] CHOLMOD testing for root-cmakelists --- CHOLMOD/CMakeLists.txt | 154 +++++++++++++++------------------ CHOLMOD/Demo/cholmod_di_demo.c | 10 --- CMakeLists.txt | 20 ++++- 3 files changed, 90 insertions(+), 94 deletions(-) diff --git a/CHOLMOD/CMakeLists.txt b/CHOLMOD/CMakeLists.txt index 17ccdacf6..ec2efe063 100644 --- a/CHOLMOD/CMakeLists.txt +++ b/CHOLMOD/CMakeLists.txt @@ -643,26 +643,9 @@ endif ( ) # Demo library and programs #------------------------------------------------------------------------------- -option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." on ) +option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." off ) if ( DEMO ) - enable_testing ( ) - - #--------------------------------------------------------------------------- - # demo library - #--------------------------------------------------------------------------- - - message ( STATUS "Also compiling the demos in CHOLMOD/Demo" ) - - #--------------------------------------------------------------------------- - # Demo programs - #--------------------------------------------------------------------------- - - add_executable ( cholmod_di_demo "Demo/cholmod_di_demo.c" ) - add_executable ( cholmod_dl_demo "Demo/cholmod_dl_demo.c" ) - add_executable ( cholmod_si_demo "Demo/cholmod_si_demo.c" ) - add_executable ( cholmod_sl_demo "Demo/cholmod_sl_demo.c" ) - add_executable ( cholmod_di_simple "Demo/cholmod_di_simple.c" ) add_executable ( cholmod_dl_simple "Demo/cholmod_dl_simple.c" ) add_executable ( cholmod_si_simple "Demo/cholmod_si_simple.c" ) @@ -674,24 +657,6 @@ if ( DEMO ) add_executable ( reade "Demo/reade.f" ) endif ( ) - # Libraries required for Demo programs - target_link_libraries ( cholmod_di_demo PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) - if ( SUITESPARSE_CUDA ) - target_link_libraries ( cholmod_di_demo PUBLIC CHOLMOD_CUDA ) - endif ( ) - target_link_libraries ( cholmod_si_demo PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) - if ( SUITESPARSE_CUDA ) - target_link_libraries ( cholmod_si_demo PUBLIC CHOLMOD_CUDA ) - endif ( ) - target_link_libraries ( cholmod_dl_demo PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) - if ( SUITESPARSE_CUDA ) - target_link_libraries ( cholmod_dl_demo PUBLIC CHOLMOD_CUDA ) - endif ( ) - target_link_libraries ( cholmod_sl_demo PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) - if ( SUITESPARSE_CUDA ) - target_link_libraries ( cholmod_sl_demo PUBLIC CHOLMOD_CUDA ) - endif ( ) - target_link_libraries ( cholmod_di_simple PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) if ( SUITESPARSE_CUDA ) target_link_libraries ( cholmod_di_simple PUBLIC CHOLMOD_CUDA ) @@ -709,56 +674,81 @@ if ( DEMO ) target_link_libraries ( cholmod_sl_simple PUBLIC CHOLMOD_CUDA ) endif ( ) - add_test ( NAME int32_double_bcsstk01 - COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk01.tri ) - add_test ( NAME int64_double_bcsstk01 - COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk01.tri ) - add_test ( NAME int32_single_bcsstk01 - COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk01.tri ) - add_test ( NAME int64_single_bcsstk01 - COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk01.tri ) - - add_test ( NAME int32_double_lp_afiro - COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/lp_afiro.tri ) - add_test ( NAME int64_double_lp_afiro - COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/lp_afiro.tri ) - add_test ( NAME int32_single_lp_afiro - COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/lp_afiro.tri ) - add_test ( NAME int64_single_lp_afiro - COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/lp_afiro.tri ) - - add_test ( NAME int32_double_can24 - COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/can___24.mtx ) - add_test ( NAME int64_double_can24 - COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/can___24.mtx ) - add_test ( NAME int32_single_can24 - COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/can___24.mtx ) - add_test ( NAME int64_single_can24 - COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/can___24.mtx ) - - add_test ( NAME int32_double_complex - COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/c.tri ) - add_test ( NAME int64_double_complex - COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/c.tri ) - add_test ( NAME int32_single_complex - COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/c.tri ) - add_test ( NAME int64_single_complex - COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/c.tri ) - - add_test ( NAME int32_double_supernodal - COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk02.tri ) - add_test ( NAME int64_double_supernodal - COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk02.tri ) - add_test ( NAME int32_single_supernodal - COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk02.tri ) - add_test ( NAME int64_single_supernodal - COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk02.tri ) +endif ( ) -else ( ) +#------------------------------------------------------------------------------- +# testing +#------------------------------------------------------------------------------- - message ( STATUS "Skipping the demos in CHOLMOD/Demo" ) +enable_testing ( ) +add_executable ( cholmod_di_demo "Demo/cholmod_di_demo.c" ) +add_executable ( cholmod_dl_demo "Demo/cholmod_dl_demo.c" ) +add_executable ( cholmod_si_demo "Demo/cholmod_si_demo.c" ) +add_executable ( cholmod_sl_demo "Demo/cholmod_sl_demo.c" ) + +# Libraries required for tests +target_link_libraries ( cholmod_di_demo PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) +if ( SUITESPARSE_CUDA ) + target_link_libraries ( cholmod_di_demo PUBLIC CHOLMOD_CUDA ) endif ( ) +target_link_libraries ( cholmod_si_demo PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) +if ( SUITESPARSE_CUDA ) + target_link_libraries ( cholmod_si_demo PUBLIC CHOLMOD_CUDA ) +endif ( ) +target_link_libraries ( cholmod_dl_demo PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) +if ( SUITESPARSE_CUDA ) + target_link_libraries ( cholmod_dl_demo PUBLIC CHOLMOD_CUDA ) +endif ( ) +target_link_libraries ( cholmod_sl_demo PUBLIC CHOLMOD SuiteSparse::SuiteSparseConfig ) +if ( SUITESPARSE_CUDA ) + target_link_libraries ( cholmod_sl_demo PUBLIC CHOLMOD_CUDA ) +endif ( ) + +add_test ( NAME CHOLMOD_int32_double_bcsstk01 + COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk01.tri ) +add_test ( NAME CHOLMOD_int64_double_bcsstk01 + COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk01.tri ) +add_test ( NAME CHOLMOD_int32_single_bcsstk01 + COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk01.tri ) +add_test ( NAME CHOLMOD_int64_single_bcsstk01 + COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk01.tri ) + +add_test ( NAME CHOLMOD_int32_double_lp_afiro + COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/lp_afiro.tri ) +add_test ( NAME CHOLMOD_int64_double_lp_afiro + COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/lp_afiro.tri ) +add_test ( NAME CHOLMOD_int32_single_lp_afiro + COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/lp_afiro.tri ) +add_test ( NAME CHOLMOD_int64_single_lp_afiro + COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/lp_afiro.tri ) + +add_test ( NAME CHOLMOD_int32_double_can24 + COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/can___24.mtx ) +add_test ( NAME CHOLMOD_int64_double_can24 + COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/can___24.mtx ) +add_test ( NAME CHOLMOD_int32_single_can24 + COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/can___24.mtx ) +add_test ( NAME CHOLMOD_int64_single_can24 + COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/can___24.mtx ) + +add_test ( NAME CHOLMOD_int32_double_complex + COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/c.tri ) +add_test ( NAME CHOLMOD_int64_double_complex + COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/c.tri ) +add_test ( NAME CHOLMOD_int32_single_complex + COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/c.tri ) +add_test ( NAME CHOLMOD_int64_single_complex + COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/c.tri ) + +add_test ( NAME CHOLMOD_int32_double_supernodal + COMMAND cholmod_di_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk02.tri ) +add_test ( NAME CHOLMOD_int64_double_supernodal + COMMAND cholmod_dl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk02.tri ) +add_test ( NAME CHOLMOD_int32_single_supernodal + COMMAND cholmod_si_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk02.tri ) +add_test ( NAME CHOLMOD_int64_single_supernodal + COMMAND cholmod_sl_demo ${PROJECT_SOURCE_DIR}/Demo/Matrix/bcsstk02.tri ) #------------------------------------------------------------------------------- # report status diff --git a/CHOLMOD/Demo/cholmod_di_demo.c b/CHOLMOD/Demo/cholmod_di_demo.c index 8cf961279..fbd27bf50 100644 --- a/CHOLMOD/Demo/cholmod_di_demo.c +++ b/CHOLMOD/Demo/cholmod_di_demo.c @@ -55,8 +55,6 @@ static void my_handler (int status, const char *file, int line, } } -#include - int main (int argc, char **argv) { double @@ -87,20 +85,12 @@ int main (int argc, char **argv) // get the file containing the input matrix //-------------------------------------------------------------------------- - char cwd [PATH_MAX] ; - if (getcwd (cwd, PATH_MAX) != NULL) - { - fprintf (stderr, "cwd: %s\n", cwd) ; - printf ("cwd: %s\n", cwd) ; - } - ff = NULL ; prefer_zomplex = 0 ; if (argc > 1) { if ((f = fopen (argv [1], "r")) == NULL) { - my_handler (CHOLMOD_INVALID, __FILE__, __LINE__, "unable to open file") ; } diff --git a/CMakeLists.txt b/CMakeLists.txt index d73bd49c2..295e8528b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -466,7 +466,23 @@ include ( SuiteSparseReport ) # enable testing facilities #------------------------------------------------------------------------------- -# Currently, only LAGraph and Mongoose have ctests. -# FIXME: Consider converting (some of) the existing demos to ctests. +# Currently, only LAGraph, Mongoose, and CHOLMOD have ctests. + +# FIXME: convert more of the existing demos to ctests. + +# Most packages have a ./Tcov folder with a full statement coverage test, +# but these are not imported into cmake yet. + +# Most packages also have a ./Demo folder, with shorter examples. These would +# be nice to add as quick ctests. + +# CHOLMOD/Tcov takes about 20 minutes to run. It is also a full coverage +# test of AMD, CAMD, COLAMD, and CCOLAMD, however. The current CHOLMOD +# ctest is based on a few ./Demo programs. It's fast but not a full coverate +# test. + +# The CSparse/CXSparse Tcov tests are very fast and would be good candidates to +# add. enable_testing ( ) +