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

Restructure modules #68

Merged
merged 25 commits into from
Mar 5, 2024
Merged

Restructure modules #68

merged 25 commits into from
Mar 5, 2024

Conversation

ktras
Copy link
Collaborator

@ktras ktras commented Feb 27, 2024

Closes #64.

ktras added 17 commits February 26, 2024 10:50
interface of `prif_init` into `prif` module and change
`program_startup_s` to extend from `prif_private_s`.
`prif`. Change `program_termination_s` to extend `prif_private_s`.
Update all `program_termination_m` use-stmts.
`atomic_s` to extend `prif_private_s`.
definition of `notify_type` to `prif_private_s`. Change `notify_s`
to extend `prif_private_s`.
`events_s` to extend `prif_private_s`.
`critical_s` to extend `prif_private_s`.
`locks_s` to extend `prif_private_s`.
`synchronization_s` to extend `prif_private_s`.
the interfaces for the collectives to `prif` and keep the operation
abstract interfaces in the newly named module. Change all the
submodules with the definitions of the collectives to extend
`prif_private_s`.
`prif_queries_s` to extend `prif_private_s`.
`image_queries_s` to extend `prif_private_s`.
`coarray_queries_s` to extend `prif_private_s`.
`alias_s` to extend `prif_private_s`.
`coarray_access_s` to extend `prif_private_s`.
`teams_m` and move all their interfaces to `prif`. Change
`allocation_s` and `teams_s` to extend `prif_private_s`. Update
all related `use-stmts`
Copy link
Member

@bonachea bonachea left a comment

Choose a reason for hiding this comment

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

Overall this looks like the wonderful and long-overdue cleanup we discussed.

Added a few questions and minor requests.

Copy link
Member

Choose a reason for hiding this comment

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

It's difficult to audit all the cross-file declaration motion in this PR.

Were there any meaningful changes to the contents of the public prif_ module subroutine interfaces as they moved from the *_m.f90 files to prif.f90?

Copy link
Collaborator Author

@ktras ktras Feb 27, 2024

Choose a reason for hiding this comment

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

I made no changes to the content of the interfaces when moving them. Just cut and paste from one module to the other. And I was as careful as I could be to ensure that no changes were accidentally made.

src/caffeine/prif_private_s.f90 Outdated Show resolved Hide resolved
src/prif.f90 Outdated Show resolved Hide resolved
src/prif.f90 Outdated Show resolved Hide resolved
src/prif.f90 Outdated Show resolved Hide resolved
src/prif.f90 Outdated Show resolved Hide resolved
src/caffeine/collective_helpers_m.f90 Outdated Show resolved Hide resolved
the types defined in the `prif` module, and move the Fortran
intrinsic derived types to the `prif` module
@ktras
Copy link
Collaborator Author

ktras commented Feb 28, 2024

I just moved the definition of handle_data to the bottom of the prif module. prif_coarray_handle and prif_team_type type definitions cannot be moved to the same location because there are arguments of those types above.

@ktras ktras requested a review from bonachea February 28, 2024 00:12
@bonachea
Copy link
Member

I just moved the definition of handle_data to the bottom of the prif module. prif_coarray_handle and prif_team_type type definitions cannot be moved to the same location because there are arguments of those types above.

I thought we tried this in our prototyping meeting and decided that at least one compiler rejected the declaration of prif_coarray_handle when the handle_data pointer field was an incomplete type? What compilers have you successfully tested against?

Of course what ultimately matters most is what flang-new will accept, which I'm guessing is currently "none of this". On a related note, I think this PR needs to update the table in the top-level README where we track major modern Fortran features the Caffeine implementation requires. We at least need to add "Submodule support [1]" (which I believe was added in F08?), and probably remove the [1] from contiguous attribute, which is now "baked into" the PRIF API. There may be other updates needed.

Copy link
Member

@bonachea bonachea 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 the recent changes, which look good.

Some unresolved tasks remain.

@ktras
Copy link
Collaborator Author

ktras commented Feb 28, 2024

I thought we tried this in our prototyping meeting and decided that at least one compiler rejected the declaration of prif_coarray_handle when the handle_data pointer field was an incomplete type? What compilers have you successfully tested against?

When compiling the whole software stack, the only compiler we are currently developing with is gfortran.

Based on this comment, I tried compiling just the prif module (with the handle_data type definition at the bottom of the module) with the following compilers and with the following results:

Compiler Result
gfortran compiles
ifx compiles
cray ftn compiles
nvfortran compiles
nagfor doesn't compile for different reason (doesn't have c_ptrdiff_t support).

the last remaining location that uses them, `co_reduce_s`. Remove
`collective_helpers_m`.
@ktras ktras requested a review from bonachea February 28, 2024 19:03
@ktras
Copy link
Collaborator Author

ktras commented Feb 28, 2024

@bonachea Thank you for the further feedback. I have answered your compiler question above and then updated the PR in reference to your requested changes around collective_helpers_m and replied to that comment above. I believe I have addressed all of your review comments to this point. Please let me know about any further feedback, thanks!

Copy link
Member

@bonachea bonachea left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the overhaul and recent fixes.

@bonachea
Copy link
Member

Wooops, I just noticed that doc-generator.md also needs updates as a result of this reorg, assuming we are still maintaining the FORD docs.

Copy link
Member

@bonachea bonachea left a comment

Choose a reason for hiding this comment

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

After additional thought, I've added two further minor requests.

src/caffeine/prif_private_s.f90 Show resolved Hide resolved
redundant when defining PRIF around which procedures should
provide termination.
@ktras ktras requested a review from bonachea March 4, 2024 21:03
Copy link
Member

@everythingfunctional everythingfunctional left a comment

Choose a reason for hiding this comment

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

LGTM, especially since the changes to the tests were so minimal.

Copy link
Member

@bonachea bonachea left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for this valuable cleanup

@ktras ktras merged commit 01ccb44 into main Mar 5, 2024
6 checks passed
@ktras ktras deleted the restructure-modules branch March 5, 2024 00:37
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.

Restructure prif modules
3 participants