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

the SuiteSparse package in homebrew is compiled without OpenMP and without TIMER (i.e. no SuiteSparse_tic) #313

Closed
freeseek opened this issue Apr 22, 2023 · 2 comments

Comments

@freeseek
Copy link

When running a piece of software based on CHOLMOD with the Homebrew SuiteSparse package, I realized that the timer function was not enabled (no SuiteSparse_tic). After digging into it a bit, I believe that this is the result of the SUITESPARSE_TIMER_ENABLED macro not being enabled in SuiteSparse_config.h:

#ifndef NTIMER
    #if defined ( _OPENMP )
        #define SUITESPARSE_TIMER_ENABLED
    #elif defined ( _POSIX_C_SOURCE )
        #if _POSIX_C_SOURCE >= 199309L
        #define SUITESPARSE_TIMER_ENABLED
        #endif
    #endif
#endif

This is because brew on Mac uses clang which does not define _POSIX_C_SOURCE. Also, the brew package version does not link to OpenMP. I filed a bug with Homebrew but their understanding is that this is something that should be resolved in the SuiteSparse code, not in Homebrew. I wish I could be more helpful but I do not fully understand how options are selected at compilation time

@DrTimothyAldenDavis
Copy link
Owner

I can see what I can do to enable the timer, but disabling OpenMP for SuiteSparse is a mistake. One of my recent packages (GraphBLAS) makes significant use of OpenMP, and disabling will slow GraphBLAS down by 20x or more on some systems. Homebrew should use OpenMP with SuiteSparse. SuiteSparse is using OpenMP for more than the timer.

The other packages (CHOLMOD, UMFPACK, SPQR) use a parallel BLAS, which normally also requires OpenMP.

The timing code is here:

/* SuiteSparse_tic: return current wall clock time */
.

Getting a timer to work in a portable manner is non-trivial (linux, mac, windows, different compilers, etc), which is why the default is to use the OpenMP timer if available, or the POSIX timer otherwise.

@DrTimothyAldenDavis
Copy link
Owner

I've tried to use the ANSI C clock function, that that causes problems too: it's often not very accurate, and it is not always implemented in right way (see for example https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/clock?redirectedfrom=MSDN&view=msvc-170 ).

Getting the timer to work well and in a portable manner has been a nightmare so I don't intend to change it. The timer requires either OpenMP or POSIX, or it is disabled. I can't change that.

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

2 participants