Skip to content

Commit

Permalink
CHOLMOD testing for root-cmakelists
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Nov 26, 2023
1 parent 7f96eac commit 8030ed0
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 94 deletions.
154 changes: 72 additions & 82 deletions CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand All @@ -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 )
Expand All @@ -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
Expand Down
10 changes: 0 additions & 10 deletions CHOLMOD/Demo/cholmod_di_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ static void my_handler (int status, const char *file, int line,
}
}

#include <unistd.h>

int main (int argc, char **argv)
{
double
Expand Down Expand Up @@ -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") ;
}
Expand Down
20 changes: 18 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ( )

0 comments on commit 8030ed0

Please sign in to comment.