-
Notifications
You must be signed in to change notification settings - Fork 12
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
Repo reorganisation: Moving transformations #296
Conversation
ce687fa
to
048c4b5
Compare
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/296/index.html |
3bcad1b
to
7f70cc3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #296 +/- ##
==========================================
+ Coverage 94.97% 95.09% +0.12%
==========================================
Files 151 165 +14
Lines 32407 35282 +2875
==========================================
+ Hits 30779 33552 +2773
- Misses 1628 1730 +102
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
7f70cc3
to
11ec7c1
Compare
Thanks, really nice! I'm happy with it and haven't discovered anything problematic. I think in order to be consistent:
Why not?
Me thinking out loud:
I guess that further repo reorganisation like "separate operations (inlinecall, subscript, sum, ...) from the symbols/literals" will be done in a future/separate PR?! |
@MichaelSt98 Many thanks for the review - to answer your questions:
Yes, absolutely, that was an oversight! Will fix in the needed rebase!
Mostly because I actually thought "transform" to be a good high-level description for "fusion/fission/interchange" and "hoist/extract". Open for suggestions though, as the grouping by target "node type" seemed not scalable to me. Agree in general on the proposed further sub-division or the With regards to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for taking so long to review this and many thanks, this looks fantastic.
I agree with all what's been said so far. Regarding the renaming to just loop
& co I share your assessment that this might not scale well and the transform
adds information despite being somewhat redundant at first look - since it is the commonly used terminology for the kind of changes applied by the utilities in there.
I've added some comments where I spotted missing docstrings or possible clean-up opportunities, but overall this looks very good.
The documentation scripts need to be updated, too, but since we have already dangling pointers in there and Sphinx steps over this gracefully, we may as well do a sweep in a separate PR to rectify this.
install
Outdated
@@ -508,5 +507,5 @@ echo "Activate the Loki environment with" | |||
echo | |||
echo " source loki-activate" | |||
echo | |||
echo "You can test the Loki installation by running 'py.test transformations lint_rules .'" | |||
echo "You can test the Loki installation by running 'py.test lint_rules .'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be running 'py.test lint_rules loki'
, I think.
""" | ||
Update imports of wrapped subroutines. | ||
""" | ||
from loki.batch import SchedulerConfig # pylint: disable=import-outside-toplevel,cyclic-import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import could now also take place at the toplevel, no?
|
||
|
||
@pytest.fixture(scope='module', name='here') | ||
@pytest.fixture(scope='function', name='here') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that it matters too much, but curious why the scope has changed for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! I had previously used this in the build, but now it works without this, so can go back to "module" scoping.
builder.clean() | ||
(here/f'{driver.name}.f90').unlink() | ||
(here/f'{kernel_module.name}.f90').unlink() | ||
(tempdir/f'{driver.name}.f90').unlink() | ||
(tempdir/f'{kernel_module.name}.f90').unlink() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be redundant with the tempdir clean-up in the fixture?
loki/tools/files.py
Outdated
def write_env_launch_script(here, binary, args): | ||
# Write a script to source env.sh and launch the binary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a while to figure out why we have these because they didn't show up with test coverage. So, I would suggest adding short docstrings:
def write_env_launch_script(here, binary, args): | |
# Write a script to source env.sh and launch the binary | |
def write_env_launch_script(here, binary, args): | |
""" | |
Utility method that is used for regression tests that require | |
activating an environment file before running :data:`binary`. | |
This writes a simple script of the form | |
.. code-block:: | |
source env.sh | |
bin/<binary> <args> | |
exit $? | |
Parameters | |
---------- | |
here : pathlib.Path or str | |
The directory in which the script is created | |
binary : str | |
The name of the binary | |
args : list of str | |
List of arguments to pass to the binary | |
Returns | |
------- | |
pathlib.Path | |
The path to the created script file | |
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for these! Added as suggested.
return str(lokidir.resolve()), target, backup | ||
|
||
|
||
def local_loki_cleanup(target, backup): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def local_loki_cleanup(target, backup): | |
def local_loki_cleanup(target, backup): | |
Companion utility to :any:`local_loki_setup` to revert the changes | |
This removes a symlink at :data:`target`, if it exists, and moves the | |
:data:`backup` path in its original location. | |
Parameters | |
--------- | |
target : pathlib.Path | |
The target injection path as returned by :any:`local_loki_setup` | |
backup : pathlib.Path | |
The backup path as created by :any:`local_loki_setup` |
This also split the module_wrap transformation from the dependency transformation and puts it into its own source file.
0dbb754
to
da4814c
Compare
da4814c
to
fddecf8
Compare
Ok, apologies, this took a bit longer than anticipated. @reuterbal I think I've addressed all comments - many thanks for the suggestions! I've also tried to address the naming inconsistencies pointed out by @MichaelSt98, but those generated some name clashes in the test base ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. I found another oopsie and my docstring suggestion was faulty (sorry!), but otherwise good to go!
install
Outdated
@@ -512,7 +511,7 @@ print_step "Installation finished" | |||
echo | |||
echo "Activate the Loki environment with" | |||
echo | |||
echo " source loki-activate" | |||
echo " source loki-activate"xf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something's gone wrong here
echo " source loki-activate"xf | |
echo " source loki-activate" |
loki/tools/files.py
Outdated
""" | ||
Utility method that is used to determine paths for injecting the | ||
currently running source code of Loki into an | ||
[ecbundle](https://github.com/ecmwf/ecbundle)-based worktree This |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, got caught out by the annoying RST vs. MD syntax differences for link formatting...
Also, empty line after the first sentence improves formatting in the HTML output.
[ecbundle](https://github.com/ecmwf/ecbundle)-based worktree This | |
`ecbundle <https://github.com/ecmwf/ecbundle>`_-based worktree. | |
This |
fddecf8
to
fb56455
Compare
The next step in our spring clean (issue #253) is to move all the internally support transformations into the core package, alongside the associated tests. This then also merges the
loki.transform
general utilities into the more customloki.transformations
packages.I've tried to restrain myself to only move files and fix-up import headers, with a few small exceptions listed in the details below:
Transformation
andPipeline
class have been moved intoloki.batch
as they are the interface to the schedulertransformations
has been moved intoloki.transformations
loki.tools
loki.transformations.single_column
,loki.transformations.transpile
andloki.transformations.build_system
have been separatedDependencyTransformation
andModuleWrapTransformation
have been mode to separate files insidetrnasformations.build_system
loki.transform
has been moved intoloki.transformations
, often removing thetransform_xxx
prefixAnd finally, apologies to @MichaelSt98 , as this one might conflict quite a bit with his current stuff... 😬