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

Proof of concept PR for numba guvectorized functions for setting value and norm for a field. #192

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

swapneelap
Copy link
Member

No description provided.

Copy link
Member

@lang-m lang-m left a comment

Choose a reason for hiding this comment

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

I think it would be good to integrate this functionality during the refactoring. The benefit can be significant I guess and just documenting how to do it manually is not very user-friendly (at least for me as a user). Some questions/comments:

  • Do we have some actual numbers on the speed-up depending on cell size and complexity?
  • The implementation should go to _as_array (-> the callable implementation).
  • I would suggest to use try ... except, try numba first and if it fails use the simple for loop (+ logging, maybe debug level, to know what is going on).

self.array = _as_array(val, self.mesh, self.dim, dtype=self.dtype)
if callable(val):
nb_value_func = nb.guvectorize(
[(nb.float64[:], nb.float64[:])], "(n)->(n)", nopython=True
Copy link
Member

Choose a reason for hiding this comment

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

What happens if nopython=True is wrong? Is it ignored or does it raise an exception?

@lang-m lang-m marked this pull request as draft December 8, 2022 17:41
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.

None yet

2 participants