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
Rewrite pyccel omp handling for better support for other versions #1226
base: devel
Are you sure you want to change the base?
Conversation
the support for exit is limited to calls with integral arguments or without arguments (same as exit(0))
Replace every class in the ast/omp.py with new classes the new classes have the same name as the textx grammar rules because these classes are used as the base classes for the textx instead of the ones found in pyccel/parser/syntax/openmp.py
the version field will be used to store the version of the omp grammer used for a Construct/Clause this is done by making the grammer sets a version field for the Clause/Construct if there are multile versions of the grammer
the grammer is not finished an only supports parallel constructs and its clauses
instead of hardcoding the rules in the syntactic/semantic/printing stages we just delegate the work to the omp class new functions there will be 5 functions _visit_syntatic, _visit_semantic, _cprint, _fprint, _pprint those functions will be called from the syntactic/semantic/printing stages and the omp class will be responsible for checking the if everything is corrent and provide the correct printing
this way we can support multiple version of omp withouth having to duplicate the code and just use inheritance and override the methods to change the behavior of the previous version
- add a version setter for the OmpAnnotatedComment class to be able to check if the syntax is supported by the version of omp - fixing liter errors
Ok great. It looks like it's been a while since this branch was merged. Let me know if there's anything unfamiliar that you need a hand merging in |
Hello! Welcome to Pyccel! Thank you very much for your contribution ❤️. I am the GitHub bot. I will help guide you through the different stages necessary to validate a review in Pyccel. If you haven't yet seen our developer docs make sure you check them out here. Amongst other things they describe the review process that we have just started. You can also get in touch with our other developers on our Pyccel Discord Server. To begin with I will give you a short checklist to make sure your pull request is complete. Please tick items off when you have completed them or determined that they are not necessary for this pull request. If you want me to run any specific tests to check out corner cases that you can't easily check on your computer, you can request this using the command Here is your checklist:
|
# Conflicts: # pyccel/ast/omp.py # pyccel/parser/semantic.py
- Implement omp syntax and semantic parser - Implement omp c printer - Make omp constructs aware of thier associated block. - Defferentiate between construct and directive notions
…osition_end of omp elements inside the pragma, change directives and clauses description, semantic checks were skipped before this commit
…le allowed clauses in grammar to avoid duplicated data
…ctive may require a diffent syntax of the same clause, this is to allow grouping all forms of each clause in one single place
- Dynamically extend parsers and printers with openmp parsers and printers. - Group functionalities common across omp versions. - Implement Python and Fortran printers.
Hello @EmilyBourne, I'm looking for an overall feedback this new design, which is still in need of some polishing, documentation, and refactoring. Below is an overview of the current design and its status: Status
Design Overview
|
This is an attempt to rewrite the way we are handling OpenMP annotated comments.
The main reason for the PR is to enable us to better support multiple versions of the OpenMP standards.
The other reason is to enable us to catch user errors before generating code and without "hardcoding" that in the semantic stage of the _visit_OmpAnnotatedComment function (here)
This is a small explanation of how the new implementation works.
Openmp
classes in theomp_versions
directory each one represents the support for a OpenMP versionOpenmp
class can inherit from a previous version so it is required to implement only the subclasses that represent the changed Omp Construct / Clause on that version.We select an
Openmp
class (from the omp_versions directory) that corresponds to the syntax version we need, then we use a function to extract all the subclasses related to an OpenMP Construct/Clause (subclasses starting with 'Omp') and provide those subclasses to Textx