Skip to content

Add void* to tabulate_tensor kernel#749

Closed
sclaus2 wants to merge 11 commits into
FEniCS:mainfrom
sclaus2:sclaus/add-void-to-kernels
Closed

Add void* to tabulate_tensor kernel#749
sclaus2 wants to merge 11 commits into
FEniCS:mainfrom
sclaus2:sclaus/add-void-to-kernels

Conversation

@sclaus2

@sclaus2 sclaus2 commented Feb 19, 2025

Copy link
Copy Markdown
Contributor

Add void* user_data to tabulate_tensor kernel to allow for easier extensions of non-standard integration kernels such as runtime kernels. Depends on dolfinx PR FEniCS/dolfinx#3643 .

@sclaus2 sclaus2 changed the title sclaus/add void to kernels Add void* to tabulate_tensor kernel Feb 19, 2025
Comment thread ffcx/codegeneration/utils.py Outdated

Returns:
A Numba signature and a code generation function that returns a void pointer.
""" # noqa: D205

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should be enough to add a new line after Custom intrinsic to return an empty void* pointer. to drop the noqa

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right. Done.

def get_void_pointer(typingctx, arr):
"""Custom intrinsic to get a void* pointer from a NumPy array.

This function takes a NumPy array and returns a void pointer to the array's data.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I actually don't know how numpy lays out its data in an ndarray - could we be a bit more precise here on what this void ptr points to?

arr: The NumPy array to get the void pointer from.

Returns:
A Numba signature and a code generation function that returns a void pointer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Again, more precision on array's data.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have expanded on the comment and I have added a test.

@jhale

jhale commented Feb 26, 2025

Copy link
Copy Markdown
Member

This looks fine to me, modulo the two comments on the docstrings related to 'numpy's data'.

@sclaus2

sclaus2 commented Mar 7, 2025

Copy link
Copy Markdown
Contributor Author

Has been replaced by #753

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.

4 participants