-
Notifications
You must be signed in to change notification settings - Fork 29
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
Identify module variables used by kernels #190
Comments
In both cases, we could solve the problem by re-writing the kernel so that the module data is passed by argument instead. The module 'use' can then be promoted into the PSy layer. This transformation will require the fparser2 AST of the kernel which is (part of) the subject of #185. |
However, if we pass the module data by argument, we will need then need to add declarations for those arguments within the kernel subroutine. This will require us to find the original declarations of the module data (by parsing module code). |
For OpenACC it is therefore probably simplest to modify the module code by the insertion of the necessary directive (to instruct the compiler that the quantity being declared is required on the device). |
Couple of questions:
|
For the 1st question we will let the user specify one or more search paths on the command line. Possibly in the same way as we do for Fortran include files. Therefore as long as the build system knows where the modules live we should be fine. |
I think the first should be OK. Currently we supply the top-level directory to the whole code tree for telling PSyclone where the kernels live, which seems to work fine. |
This is an interesting coordination problem. What happens at the moment (or what are the plans for a future build system)? Do they run interleaved as part of a single build phase (or are they planned to)? I think PSyclone could promote use statements from kernels to the PSy layer without needing to have access to the contents of the module referenced in the use statement. That would mean that the modules themselves would not need to exist (or be visible) at the time An alternative would be for the auto-generation systems to coordinate. For example, a PSyclone script could let the Configurator know to add in appropriate directives when it generated the modules? |
|
@rupertford the build system works by copying existing source into a working directory, then running the code generators and putting the code into the working directory, then compiling. The "dependerater" works out dependencies: so, for example, if I modify a generated *_psy.f90 file it won't rerun PSyclone on the x90 file that produced it. I would say you should do the appropriate solution for PSyclone, but it would be useful to know what it is as we are about to do a redesign of fcm make (the Met Office build system) taking into account code generation requirements. So far all our requirements have been a single-pass of a code generator whereas we may need to think about two-passes - configurator to create namelist reading code then PSyclone to add directives. |
Thanks @stevemullerworth. If you are re-designing fcm to support code generation and translation then I would humbly suggest that you build in the possibility of multiple passes (not fixing to one or two) irrespective of what we end up agreeing for PSyclone. |
Hi @stevemullerworth and @rupertford. I am also in favour of multiple passes, as well as configurator having capability to use different PSyclone command-line options and/or transformation scripts for different Fortran source files - even different invokes in the same source file if we want to do fine-grained optimisations. We currently only have one makefile for PSyclone in the LFRic build system (and one optimisation script, but this is a bit easier to change) so having different command-line options for each miniapp is impossible. We cannot really have a more detailed and varied application of PSyclone until we have this flexibility. |
Right now
that searches include files in the given list of directories for the Nemo API. We agreed with @arporter that we can use the same parameter to provide the list of directories where Once the module is found and parsed into a PSyIR container, we need a new PSyIR Transformation to promote symbol_table globals (e.g. Complementary, some globals are defined as parameters (e.g. Applying this 2 transformation will improve the coverage (and performance?) of the generated OpenCL and OpenACC kernels. |
… and adds them into the argument_list
…code writes the symbol_table globals
… NameSpaceManager to prevent clashes
…tion #190 GlobalsToArguments transformation
In OpenCL (#174) and OpenACC we have a problem because we currently allow a Fortran kernel to
use
data from modules other than the one containing it. In OpenCL, the only way of providing data to a kernel is via an argument. In OpenACC, the original declaration of any module dataused
'd by a kernel must be marked-up with a directive. Therefore in both cases we are going to need to parse the kernel and identify any module data that is imported.The text was updated successfully, but these errors were encountered: