Skip to content

Commit

Permalink
Merge pull request #828 from DrTimothyAldenDavis/dev2
Browse files Browse the repository at this point in the history
umfpack, suitesparse_config, CI
  • Loading branch information
DrTimothyAldenDavis authored Jun 6, 2024
2 parents 1ca4c04 + ae25b9b commit aaa5e6b
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 33 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/root-cmakelists.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,14 @@ jobs:
if [ ${{ matrix.cuda }} = 'with' ]; then
_extra_config+=(-DCUDAToolkit_ROOT="$(cygpath -m "${{ steps.cuda-toolkit.outputs.CUDA_PATH }}")")
_extra_config+=(-DCMAKE_CUDA_COMPILER="$(cygpath -m "${{ steps.cuda-toolkit.outputs.CUDA_PATH }}")/bin/nvcc.exe")
# MSVC 19.40 is still Visual Studio 2022.
# Suppress erroneous version check.
_extra_config+=(-DCMAKE_CUDA_FLAGS=-allow-unsupported-compiler)
fi
if [ ${{ matrix.cc }} = 'clang-cl' ]; then
# Move away (old) clang-cl that would be in PATH to make sure that
# we use the one that matches the MSVC runtime.
mv C:/Program\ Files/LLVM C:/Program\ Files/LLVM_old
fi
mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build
cmake -G"Ninja Multi-Config" \
Expand Down
9 changes: 8 additions & 1 deletion SuiteSparse_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ else ( )
endif ( )
endif ( )

if ( NOT SUITESPARSE_CONFIG_USE_OPENMP AND NOT SUITESPARSE_HAVE_CLOCK_GETTIME )
if ( SUITESPARSE_CONFIG_USE_OPENMP OR SUITESPARSE_HAVE_CLOCK_GETTIME )
set ( SUITESPARSE_TIMER_ENABLED ON )
if ( SUITESPARSE_CONFIG_USE_OPENMP )
set ( SUITESPARSE_CONFIG_TIMER "omp_get_wtime" )
else ( )
set ( SUITESPARSE_CONFIG_TIMER "clock_gettime" )
endif ( )
else ( )
message ( STATUS "No OpenMP and no clock_gettime available. Timing functions won't work." )
endif ( )

Expand Down
26 changes: 15 additions & 11 deletions SuiteSparse_config/Config/SuiteSparse_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
#ifndef SUITESPARSE_CONFIG_H
#define SUITESPARSE_CONFIG_H

#ifdef __cplusplus
extern "C"
{
#endif

//------------------------------------------------------------------------------
// SuiteSparse-wide ANSI C11 #include files
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -263,6 +258,11 @@ extern "C"

#endif

#ifdef __cplusplus
extern "C"
{
#endif

//==============================================================================
// SuiteSparse_config parameters and functions
//==============================================================================
Expand Down Expand Up @@ -372,13 +372,17 @@ int SuiteSparse_divcomplex
// but other packages can themselves use OpenMP. In this case,
// those packages should use omp_get_wtime() directly. This can
// be done via the SUITESPARSE_TIME macro, defined below:
#cmakedefine SUITESPARSE_TIMER_ENABLED
#cmakedefine SUITESPARSE_HAVE_CLOCK_GETTIME
#if defined ( _OPENMP )
#define SUITESPARSE_TIMER_ENABLED
#define SUITESPARSE_TIME (omp_get_wtime ( ))
#elif defined ( SUITESPARSE_HAVE_CLOCK_GETTIME )
#define SUITESPARSE_TIMER_ENABLED
#define SUITESPARSE_TIME (SuiteSparse_time ( ))
#cmakedefine SUITESPARSE_CONFIG_TIMER @SUITESPARSE_CONFIG_TIMER@
#if defined ( SUITESPARSE_TIMER_ENABLED )
#if defined ( _OPENMP )
// Avoid indirection through the library if the compilation unit
// including this header happens to use OpenMP.
#define SUITESPARSE_TIME (omp_get_wtime ( ))
#else
#define SUITESPARSE_TIME (SuiteSparse_time ( ))
#endif
#else
// No timer is available
#define SUITESPARSE_TIME (0)
Expand Down
26 changes: 15 additions & 11 deletions SuiteSparse_config/SuiteSparse_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
#ifndef SUITESPARSE_CONFIG_H
#define SUITESPARSE_CONFIG_H

#ifdef __cplusplus
extern "C"
{
#endif

//------------------------------------------------------------------------------
// SuiteSparse-wide ANSI C11 #include files
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -263,6 +258,11 @@ extern "C"

#endif

#ifdef __cplusplus
extern "C"
{
#endif

//==============================================================================
// SuiteSparse_config parameters and functions
//==============================================================================
Expand Down Expand Up @@ -372,13 +372,17 @@ int SuiteSparse_divcomplex
// but other packages can themselves use OpenMP. In this case,
// those packages should use omp_get_wtime() directly. This can
// be done via the SUITESPARSE_TIME macro, defined below:
#define SUITESPARSE_TIMER_ENABLED
#define SUITESPARSE_HAVE_CLOCK_GETTIME
#if defined ( _OPENMP )
#define SUITESPARSE_TIMER_ENABLED
#define SUITESPARSE_TIME (omp_get_wtime ( ))
#elif defined ( SUITESPARSE_HAVE_CLOCK_GETTIME )
#define SUITESPARSE_TIMER_ENABLED
#define SUITESPARSE_TIME (SuiteSparse_time ( ))
#define SUITESPARSE_CONFIG_TIMER omp_get_wtime
#if defined ( SUITESPARSE_TIMER_ENABLED )
#if defined ( _OPENMP )
// Avoid indirection through the library if the compilation unit
// including this header happens to use OpenMP.
#define SUITESPARSE_TIME (omp_get_wtime ( ))
#else
#define SUITESPARSE_TIME (SuiteSparse_time ( ))
#endif
#else
// No timer is available
#define SUITESPARSE_TIME (0)
Expand Down
9 changes: 4 additions & 5 deletions UMFPACK/Source/umfpack_report_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

#include "umf_internal.h"

#define xstr(s) str(s)
#define str(s) #s

void UMFPACK_report_control
(
const double Control [UMFPACK_CONTROL]
Expand Down Expand Up @@ -381,11 +384,7 @@ void UMFPACK_report_control

PRINTF ((" CPU timer: ")) ;
#ifdef SUITESPARSE_TIMER_ENABLED
#ifdef _OPENMP
PRINTF (("omp_get_wtime ( )\n")) ;
#else
PRINTF (("SuiteSparse_time ( )\n")) ;
#endif
PRINTF (( xstr( SUITESPARSE_CONFIG_TIMER ) "\n")) ;
#else
PRINTF (("no timer used.\n")) ;
#endif
Expand Down
9 changes: 4 additions & 5 deletions UMFPACK/Source/umfpack_report_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
} \
}

#define xstr(s) str(s)
#define str(s) #s

/* RATIO macro uses a double relop, but ignore NaN case: */
#define RATIO(a,b,c) (((b) == 0) ? (c) : (((double) a)/((double) b)))

Expand Down Expand Up @@ -160,11 +163,7 @@ void UMFPACK_report_info

PRINTF ((" CPU timer: ")) ;
#ifdef SUITESPARSE_TIMER_ENABLED
#ifdef _OPENMP
PRINTF (("omp_get_wtime ( )\n")) ;
#else
PRINTF (("SuiteSparse_time ( )\n")) ;
#endif
PRINTF (( xstr( SUITESPARSE_CONFIG_TIMER ) "\n")) ;
#else
PRINTF (("no timer used.\n")) ;
#endif
Expand Down

0 comments on commit aaa5e6b

Please sign in to comment.