Skip to content

Commit

Permalink
UMFPACK: Display timer function used by SuiteSparse_config in report
Browse files Browse the repository at this point in the history
UMFPACK is built without OpenMP. (It doesn't use it directly.)
Hence, `_OPENMP` is not defined when the UMFPACK libraries are built.

Get the information about the used timer function directly from
SuiteSparse_config.h instead.

Fixes #822.
  • Loading branch information
mmuetzel committed Jun 5, 2024
1 parent 3df9cb3 commit f96ba9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
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_TIME ) "\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_TIME ) "\n")) ;
#else
PRINTF (("no timer used.\n")) ;
#endif
Expand Down

0 comments on commit f96ba9c

Please sign in to comment.