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

Rename DISABLE_TBB flag and disable on MacOS by default #9747

Merged

Conversation

wraitii
Copy link
Contributor

@wraitii wraitii commented Nov 5, 2024

Per #9746 , mac os compilation on ARM fails by default because of std::execution::par_unseq.

This PR fixes that by explicitly disabling it on MacOS since apple clang doesn't support it. There's probably a better plug somewhere but I'm not ultra-familiar with how you setup the build system, should this be a preset, should this be based on apple-clang specifically, etc. Can adapt the PR as needed.

I also rename DISABLE_TBB here because it seems to me that this should be part of the native C++20 support on other platforms, but I have to admit I'm really unfamiliar with the details here and I'm not sure if intel TBB is needed, or indeed what it does exactly. Can cut this from the PR.

Likewise, this turns parallel algorithms ON by default on the same C++20 assumption, but that could well not work.

@Maddiaa0 Maddiaa0 requested a review from ludamad November 5, 2024 11:53
@ludamad
Copy link
Collaborator

ludamad commented Nov 5, 2024

Nit: I would prefer if this were PAR_ALGOS
Bigger concern: this would regress performance in mac noir. Checking Apple is not accurate - if you use homebrew llvm@16 it builds. It would need to be a more narrow version check to be forced off

@wraitii
Copy link
Contributor Author

wraitii commented Nov 5, 2024

Nit: I would prefer if this were PAR_ALGOS

Will change.

Bigger concern: this would regress performance in mac noir. Checking Apple is not accurate - if you use homebrew llvm@16 it builds. It would need to be a more narrow version check to be forced off

Is this library supposed to be compiled with homebrew llvm16 on macOs? The docs don't really specify and Apple ships LLVM 16 with the latest Xcode. If so, I can also update the readme.

As for tighter checks, I see two avenues:

  • I rely on C++20 feature testing and use the #ifndef __cpp_lib_parallel_algorithm macro. This works on my local machine, but I'm not sure it will enable the optimisation on all supported platforms.
  • I still use a config variable but detect Apple-clang specifically.

@ludamad
Copy link
Collaborator

ludamad commented Nov 5, 2024

It could be documented for sure, mac support tends to lag because so many people use a big ol' Linux shared computer. Appreciate the readme update and yeah checking for apple clang works for me!

@wraitii
Copy link
Contributor Author

wraitii commented Nov 5, 2024

Added a note in the readme, made the check specific to AppleClang (and this works on my machine™) and renamed to PAR_ALGOS

@@ -31,7 +31,7 @@ option(DISABLE_AZTEC_VM "Don't build Aztec VM (acceptable if iterating on core p
option(MULTITHREADING "Enable multi-threading" ON)
option(OMP_MULTITHREADING "Enable OMP multi-threading" OFF)
option(FUZZING "Build ONLY fuzzing harnesses" OFF)
option(DISABLE_TBB "Intel Thread Building Blocks" ON)
option(ENABLE_PAR_ALGOS "Enable parallel algorithms" ON)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks my brain still reads it as a latin language but less so now :D

@ludamad
Copy link
Collaborator

ludamad commented Nov 5, 2024

LGTM thanks!

@ludamad ludamad merged commit 047a964 into AztecProtocol:master Nov 5, 2024
Maddiaa0 pushed a commit that referenced this pull request Nov 6, 2024
Per #9746 , mac os compilation on ARM fails by default because of
`std::execution::par_unseq`.

This PR fixes that by explicitly disabling it on MacOS since apple clang
doesn't support it. There's probably a better plug somewhere but I'm not
ultra-familiar with how you setup the build system, should this be a
preset, should this be based on apple-clang specifically, etc. Can adapt
the PR as needed.

I also rename DISABLE_TBB here because it seems to me that this should
be part of the native C++20 support on other platforms, but I have to
admit I'm really unfamiliar with the details here and I'm not sure if
intel TBB is needed, or indeed what it does exactly. Can cut this from
the PR.

Likewise, this turns parallel algorithms ON by default on the same C++20
assumption, but that could well not work.
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