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

Add conditional stdpar feature #256

Closed
wants to merge 4 commits into from
Closed

Conversation

mhoemmen
Copy link
Contributor

GCC, even 13.1.0, needs TBB in order for <execution> features to compile. Thus, we added a LINALG_ENABLE_TBB CMake option, and documented the option in README.md. We've tested the option using a local TBB from-source build from their main branch, with GCC 13.1.0. (You may need to set the CMake option TBB_STRICT=OFF, to disable warnings as errors in TBB.)

Previously, stdBLAS was using the MDSPAN_EXAMPLES_USE_EXECUTION_POLICIES macro to protect use of std::execution features in examples. We added a new macro LINALG_HAS_EXECUTION (conditionally defined in macros.hpp) to indicate that std::execution features can be used, and replaced all instances of MDSPAN_EXAMPLES_USE_EXECUTION_POLICIES with LINALG_HAS_EXECUTION.

While doing this, we noticed that macros.hpp was not including the CMake-generated header file linalg_config.h, even though linalg_config.h has a nonzero number of macro definitions in it. Thus, we made sure that macros.hpp includes linalg_config.h, so that macros.hpp (and thereby all stdBLAS headers) can pick up CMake options. (Otherwise, CMake options aren't very useful!)

Requiring a CMake-generated header file effectively makes stdBLAS no longer a header-only library. We consider this reasonable, especially since many implementations in practice would want to link against a binary-only BLAS library. The only other option would be to require GCC users to use TBB. However, the TBB repository doesn't seem to have software releases past 2021, and it's not clear whether the main branch can be considered stable. Thus, we think conditionally disabling <execution> features if using GCC and TBB is not available is reasonable.

These changes were copied over from PR #254 (thanks to @amklinv-nnl for implementing them!). This PR supersedes PR #254.

Document option in README.md.
... macro with LINALG_HAS_EXECUTION.
In the next commit, we'll conditionally define it
in a common place.
Make sure that LINALG_ENABLE_TBB is defined as a macro,
if set as a CMake option.  It's conditionally defined
in the generated header file linalg_config.h
(which already exists and conditionally defines other macros).

Also, make sure that macros.hpp includes the generated
header file linalg_config.h.
Given that linalg_config.h already had macros defined in it,
other stdBLAS headers really should have been including it.
Customization point execpolicy_mapper remains the same,
but algorithms now use it in a wrapper that checks the return type,
to ensure that infinite recursion errors are checked at compile time.

Also, fix <execution> header include guard.
@mhoemmen
Copy link
Contributor Author

@crtrott fixed issues with this PR and submitted that as a new PR #283 . PR #283 replaces this PR.

@mhoemmen mhoemmen closed this Sep 16, 2024
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

Successfully merging this pull request may close these issues.

2 participants