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

Handling of OMP Sentinels #297

Open
hiker opened this issue Mar 25, 2024 · 2 comments
Open

Handling of OMP Sentinels #297

hiker opened this issue Mar 25, 2024 · 2 comments
Labels
in progress Someone is actively working on this issue

Comments

@hiker
Copy link
Collaborator

hiker commented Mar 25, 2024

Some UM files contains OMP sentinels for use statements, e.g. control/grids/p_to_t_vol.F90:

!$ USE compute_chunk_size_mod, ONLY: compute_chunk_size  ! Note OpenMP sentinel

Since fparser does not support this, FAB misses this dependency (and compilation fails). While I have a patch more or less ready to go (https://github.com/hiker/fab/tree/13_omp_sentinels), I have discussed this in our telco, and we agreed that this would be a useful feature for fparser to support, see stfc/fparser#443. So I'll add this support to fparser, and once this has been released, we just need to enable this feature in FAB (it will be disabled by default in order not to break compatibility).

@hiker
Copy link
Collaborator Author

hiker commented Apr 4, 2024

I have just submitted stfc/fparser#444 to get support for omp conditional sentinels into fparser. I have confirmed that fab now detects the dependencies in the original case when setting the fparser flag to handle them:

diff --git a/source/fab/parse/fortran_common.py b/source/fab/parse/fortran_common.py
index 0ed4f3f..8b987d8 100644
--- a/source/fab/parse/fortran_common.py
+++ b/source/fab/parse/fortran_common.py
@@ -142,7 +142,8 @@ class FortranAnalyserBase(ABC):
 
     def _parse_file(self, fpath):
         """Get a node tree from a fortran file."""
-        reader = FortranFileReader(str(fpath), ignore_comments=False)
+        reader = FortranFileReader(str(fpath), ignore_comments=False,
+                                   omp_sentinel=True)
         reader.exit_on_error = False  # don't call sys.exit, it messes up the multi-processing
 
         try:

This obviously needs a new fparser release

@hiker hiker self-assigned this Apr 29, 2024
@hiker hiker added the in progress Someone is actively working on this issue label Apr 29, 2024
@hiker
Copy link
Collaborator Author

hiker commented Apr 29, 2024

stfc/fparser#444. has been merged, so once we do the next fparser release we can support these statements. As part of the improved compiler support I am also improving the handling of openmp, so FAB will 'know' whether openmp is enabled or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress Someone is actively working on this issue
Projects
None yet
Development

No branches or pull requests

1 participant