Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU timer: no timer used. #822

Closed
DragonPara opened this issue Jun 3, 2024 · 2 comments
Closed

CPU timer: no timer used. #822

DragonPara opened this issue Jun 3, 2024 · 2 comments

Comments

@DragonPara
Copy link
Contributor

  • cmake command
    cmake -G"Ninja Multi-Config" -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -DCMAKE_Fortran_COMPILER=ifort -DSUITESPARSE_USE_OPENMP=ON -DSUITESPARSE_ENABLE_PROJECTS="umfpack" -DCMAKE_INSTALL_PREFIX=F:\umfpackWork\suitesparse7.7 --fresh ..

  • compile command
    cmake --build . --config Release

  • test code

#include <stdio.h>
#include "umfpack.h"
int n = 5;
int Ap[] = {0, 2, 5, 9, 10, 12};
int Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4};
double Ax[] = {2., 3., 3., -1., 4., 4., -3., 1., 2., 2., 6., 1.};
double b[] = {8., 45., -3., 3., 19.};
double x[5];
int main(void)
{
    double *null = (double *)NULL;
    int i;
    void *Symbolic, *Numeric;
    double infos[UMFPACK_INFO];
    (void)umfpack_di_symbolic(n, n, Ap, Ai, Ax, &Symbolic, null, infos);
    (void)umfpack_di_numeric(Ap, Ai, Ax, Symbolic, &Numeric, null, infos);
    umfpack_di_free_symbolic(&Symbolic);
    (void)umfpack_di_solve(UMFPACK_A, Ap, Ai, Ax, x, b, Numeric, null, infos);
    umfpack_di_free_numeric(&Numeric);
    for (i = 0; i < n; i++)
        printf("x [%d] = %g\n", i, x[i]);
    double control[UMFPACK_CONTROL];
    umfpack_di_defaults(control);
    control[UMFPACK_PRL] = 7;
    umfpack_di_report_info(control,infos);
}

output

x [0] = 1
x [1] = 2
x [2] = 3
x [3] = 4
x [4] = 5
UMFPACK V6.3.3 (Mar 22, 2024), Info:
    matrix entry defined as:          double
    Int (generic integer) defined as: int32_t
    BLAS library used: Intel MKL 64lp BLAS (32-bit integers).  size of BLAS integer: 4
    MATLAB: no.
    CPU timer: no timer used.
    number of rows in matrix A:       5
    number of columns in matrix A:    5
    entries in matrix A:              12
...

But if I set -DCMAKE_C_FLAGS=-openmp, timer will be set to omp_get_wtime()

CPU timer: omp_get_wtime ( )

Why -DSUITESPARSE_USE_OPENMP=ON not work?

@DragonPara DragonPara changed the title cmake -G"Ninja Multi-Config" -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -DCMAKE_Fortran_COMPILER=ifort -DSUITESPARSE_USE_OPENMP=ON -DSUITESPARSE_ENABLE_PROJECTS="umfpack" -DCMAKE_INSTALL_PREFIX=F:\umfpackWork\suitesparse7.7 --fresh .. CPU timer: no timer used. Jun 3, 2024
mmuetzel added a commit to mmuetzel/SuiteSparse that referenced this issue Jun 3, 2024
UMFPACK is built without OpenMP. (It doesn't use it directly.)
Hence, `_OPENMP` is not defined when building its sources.

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

Fixes DrTimothyAldenDavis#822.
mmuetzel added a commit to mmuetzel/SuiteSparse that referenced this issue Jun 3, 2024
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 DrTimothyAldenDavis#822.
@mmuetzel
Copy link
Contributor

mmuetzel commented Jun 3, 2024

Thank you for reporting the issue.

Afaict, the OpenMP timer function is correctly used when SuiteSparse is configured with -DSUITESPARSE_USE_OPENMP=ON. Only the output in the report by UMFPACK is wrong.

PR #823 should be fixing that.

mmuetzel added a commit to mmuetzel/SuiteSparse that referenced this issue Jun 5, 2024
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 DrTimothyAldenDavis#822.
@DrTimothyAldenDavis
Copy link
Owner

Fixed with #823.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants