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 explicit linking to atomic library when required #1

Merged
merged 8 commits into from
Nov 7, 2023

Conversation

csparker247
Copy link

This PR checks if the compiler provides std::atomic as an external library and links PTL libraries against it if required. This is essentially an update of @LocutusOfBorg's changes for PTLv3.

@csparker247 csparker247 marked this pull request as draft November 1, 2023 14:50
@csparker247
Copy link
Author

csparker247 commented Nov 1, 2023

I've tested that this still builds fine on my M1 MBP.

I also want to draw attention here to this comment. In short, the original intent of this was to support riscv64 on gcc when gcc didn't provide atomic natively. Since the original contribution, gcc has added native support for atomic on riscv64, so these changes aren't strictly necessary for that platform, but may be useful for others.

@csparker247 csparker247 marked this pull request as ready for review November 1, 2023 16:03
@csparker247
Copy link
Author

I also meant to ask, do you want to open a PR to the upstream from tomopy/PTL, or should I just go ahead and open it myself?

@carterbox carterbox closed this Nov 3, 2023
@carterbox carterbox reopened this Nov 3, 2023
@carterbox carterbox closed this Nov 3, 2023
@carterbox carterbox reopened this Nov 3, 2023
Copy link
Member

@carterbox carterbox left a comment

Choose a reason for hiding this comment

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

Thanks for opening this PR. I think these changes are still necessary if downstream users only have access to version of GCC before they added atomics support.

Please address linting errors from the upstream CI checks that I just activated. I'm not sure that the other fails are related to this PR.

Comment on lines 56 to 57
if(MSVC OR APPLE) # apple do not need latomic link
set(HAVE_CXX_ATOMICS_WITHOUT_LIB True)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we just skip directly to setting this variable for MSVC and APPLE? Isn't the point of this test to actually check if the code snips above compile?

Copy link
Author

@csparker247 csparker247 Nov 3, 2023

Choose a reason for hiding this comment

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

That's a good question. It was part of the original commits, and I can at least confirm that removing APPLE there breaks my build. But really the compiler check should handle that, I would think. I'll look closer at the rest of the module logic.

Copy link
Author

@csparker247 csparker247 Nov 6, 2023

Choose a reason for hiding this comment

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

I need to lint my latest changes, but I've refactored CheckAtomic in a way that should be more generic across platforms.

@carterbox carterbox closed this Nov 3, 2023
@carterbox carterbox reopened this Nov 3, 2023
@carterbox carterbox self-assigned this Nov 7, 2023
@carterbox carterbox closed this Nov 7, 2023
@carterbox carterbox reopened this Nov 7, 2023
@carterbox carterbox merged commit 7cc409e into tomopy:3.x Nov 7, 2023
52 checks passed
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.

3 participants