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

Automatic Int precision and stencil regeneration change #104

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

CharlesKrop
Copy link

Added a feature to automatically determine the precision of an integer based on the global precision of the stencil. retained functionality of i32/i64, but now raises an error if an integer of the incorrect precision is passed to the stencil. In short: Int/i32/i64 should now behave identically to Float/f32/f64.

Changed the default value of rebuild from True to False for _get_factories. This alleviates a problem of unmodified stencils being recompiled when they are called from a subclass.

…uld remove the need for i32/i64 declaration (although their functionality is still retained) and replace both with the regular Int type
@CharlesKrop CharlesKrop marked this pull request as draft January 31, 2025 18:52
@FlorianDeconinck FlorianDeconinck self-requested a review January 31, 2025 18:52
@CharlesKrop CharlesKrop marked this pull request as ready for review January 31, 2025 18:54


def global_set_floating_point_precision():
def global_set_precision():
"""Set the global floating point precision for all reference
to Float in the codebase. Defaults to 64 bit."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Update docstring

to Float in the codebase. Defaults to 64 bit."""
global Float
precision_in_bit = floating_point_precision()
def global_set_precision():
Copy link
Collaborator

Choose a reason for hiding this comment

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

- def global_set_precision():
+ def global_set_precision() -> type:

elif precision_in_bit == 32:
return NDSL_32BIT_FLOAT_TYPE
return NDSL_32BIT_FLOAT_TYPE, NDSL_32BIT_INT_TYPE
else:
NotImplementedError(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
NotImplementedError(
raise NotImplementedError(

@FlorianDeconinck
Copy link
Collaborator

While you are in the vicinity can you also had specialization type for IntField32/64, IntFieldIJ32/64, IntFieldK32/64

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.

2 participants