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

[MRG] Fix MPIBackend platform logic #876

Merged

Conversation

gtdang
Copy link
Collaborator

@gtdang gtdang commented Aug 30, 2024

Updated the logic for MPIBackend and get_mpi_env function to not use the obtuse 'win' string search.

closes #875

@gtdang gtdang linked an issue Aug 30, 2024 that may be closed by this pull request
Comment on lines 87 to 88
# For Linux systems
if sys.platform not in ['win32', 'darwin']:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure if the original intent of this line was to just target Linux systems, but that was what it was doing using the 'win' not in logic. This has the same functionality but is more explicit of the platforms it avoids.

The old logic would have also excluded the 'cygwin' platform, a posix-translator layer for windows... but I doubt anyone will be trying to use hnn-core on that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You'll have to look at Blake's old commits to understand why this flag was added. Likely a Windows-specific thing not related to Mac.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing this is intended only for unix systems which support open-mpi (vs. ms-mpi), in which case we should only be avoiding windows here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, setting the OMPI_MCA_btl_base_warn_component_unused environment variable to 0 is only used for suppressing warning messages. Regardless of Blake's original intention here, I suggest that we either implement this consistently for all references to an open-mpi build (i.e., across Mac and Linux systems) or not at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear, I'm suggesting we remove 'darwin' from the list above or remove L87-89 altogether. Aside from that and @jasmainak's comments, this looks good to go by me.

@jasmainak
Copy link
Collaborator

what's the motivation for this fix? Does it break something for you? If it ain't broken, don't fix it ... we don't have the means to test it properly

@gtdang
Copy link
Collaborator Author

gtdang commented Sep 3, 2024

what's the motivation for this fix? Does it break something for you? If it ain't broken, don't fix it ... we don't have the means to test it properly

I found the incorrect logic on lines 655 while working on a refactor of the MPIBackend class wrt discussion in #871. I figured it'd be better to give it a separate PR instead of bundled with the refactor.

The logic is incorrect but you're correct, it's not breaking. I looked into why it's not breaking for Linux and discussed that in #875. That said, as a developer I had to spend time trying to understand bad logic while working on codebase. Clarity and readability is important for a maintainable codebase.

Copy link
Collaborator

@jasmainak jasmainak left a comment

Choose a reason for hiding this comment

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

tiny nitpick, otherwise LGTM. You need to update the PR from "Draft". @rythorpe merge button is yours

@gtdang gtdang force-pushed the fix-mpibackend-platform-logic branch from e266a9b to 898dc58 Compare September 4, 2024 16:36
@gtdang gtdang marked this pull request as ready for review September 4, 2024 16:37
@rythorpe rythorpe merged commit 22bedf0 into jonescompneurolab:master Sep 4, 2024
12 checks passed
@rythorpe
Copy link
Contributor

rythorpe commented Sep 4, 2024

Thanks @gtdang!

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.

MPIBackend platform logic
3 participants