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

feat[next] Enable GPU backend tests #1357

Merged
merged 20 commits into from
Nov 20, 2023

Conversation

havogt
Copy link
Contributor

@havogt havogt commented Nov 14, 2023

No description provided.

@havogt havogt force-pushed the field_storage_interface_gpu branch from 779d60a to 5c179a1 Compare November 15, 2023 12:59
@havogt
Copy link
Contributor Author

havogt commented Nov 17, 2023

I reviewed @DropD 's changes. Did you review mine?

DropD
DropD previously approved these changes Nov 17, 2023
@DropD DropD self-requested a review November 17, 2023 12:23
@DropD DropD dismissed their stale review November 17, 2023 12:26

premature

Comment on lines 127 to 130
if hasattr(value, "__array__") or hasattr(value, "__getitem__"):
raise ValueError(
"`ConstInitializer` can not be used with non-scalars. Use `Case.as_field` instead."
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if hasattr(value, "__array__") or hasattr(value, "__getitem__"):
raise ValueError(
"`ConstInitializer` can not be used with non-scalars. Use `Case.as_field` instead."
)
if not core_defs.is_scalar_type(value):
raise ValueError(
"`ConstInitializer` can not be used with non-scalars. Use `Case.as_field` instead."
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed that...

class ConstInitializer(DataInitializer):
"""Initialize with a given value across the coordinate space."""

value: ScalarValue

def __init__(self, value: ScalarValue):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def __init__(self, value: ScalarValue):
def __init__(self, value: core_defs.Scalar):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and remove ScalarValue completely

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but kept ScalarValue pointing to core_defs.Scalar as this seems to be the pattern that is used in this field

mask = cases.allocate(cartesian_case, conditional_nested_tuple, "mask").strategy(
cases.ConstInitializer(bool_field)
)()
mask = cartesian_case.as_field([IDim], np.random.choice(a=[False, True], size=size))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we built in to cases that boolean fields are allocated with alternating values by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe in a follow-up PR to get the GPU support in

@havogt
Copy link
Contributor Author

havogt commented Nov 20, 2023

will merge now as no one complained about my last changes...

@havogt havogt merged commit 42912cc into GridTools:main Nov 20, 2023
33 checks passed
@havogt havogt deleted the field_storage_interface_gpu branch November 20, 2023 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants