-
Notifications
You must be signed in to change notification settings - Fork 0
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
Draft: Slice reference output for unit tests to immitate stencil action #400
base: main
Are you sure you want to change the base?
Conversation
) | ||
|
||
@pytest.fixture | ||
def bounds(self, grid): |
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.
Do you foresee the bounds being largely the same across most stencils? In that case it would be worth exploring whether you could define a "default" fixture in common
, and then let the user overwrite it in each StencilTest
@@ -151,44 +152,49 @@ def allocate_data(backend, input_data): | |||
} | |||
return input_data | |||
|
|||
Bounds = namedtuple("Bounds", ["horizontal_start", "horizontal_end", "vertical_start", "vertical_end"]) | |||
|
|||
@dataclass(frozen=True) | |||
class Output: |
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.
The Output
class can now be deleted
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.
Done.
offset_provider=grid.offset_providers, | ||
) | ||
|
||
reference_data = allocate_data(backend, input_data) |
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 may not be necessary to use allocate_data
on the reference data, this is to construct gt4py fields and allocate them on the GPU. In this case a simple copy should probably be enough.
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.
I have no clue how this works, if the gt4py stuff is allocated on the GPU, then you have cupy fields instead of numpy fields?
Then let's say the computations happen on GPU, when we do the np.allclose()
is the result field copied back to CPU before we do the comparison?
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.
Ok I think you can actually leave it as it is with the allocate_data, I missed that the data is being passed as numpy arrays here after all:
self.PROGRAM.with_backend(backend)( | ||
**input_data, | ||
offset_provider=grid.offset_providers, | ||
) | ||
for out in self.OUTPUTS: |
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.
Could you rename out
to output_field_name
or something like that for clarity?
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.
Done.
}, | ||
) | ||
|
||
input_data = allocate_data(backend, input_data) | ||
# To imitate the action of the gt4py stencil, we slice the reference output to only apply it in the given domain |
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.
Could you add another sentence as to why we choose to imitate the action of the gt4py stencil?
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.
Done.
Mandatory Tests Please make sure you run these tests via comment before you merge!
Optional Tests To run benchmarks you can use:
To run tests and benchmarks with the DaCe backend you can use:
In case your change might affect downstream icon-exclaim, please consider running
For more detailed information please look at CI in the EXCLAIM universe. |
No description provided.