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

Stop cffi_utils failing on KeyError #2993

Merged
merged 5 commits into from
Jan 19, 2024
Merged

Stop cffi_utils failing on KeyError #2993

merged 5 commits into from
Jan 19, 2024

Conversation

mscroggs
Copy link
Member

@mscroggs mscroggs commented Jan 17, 2024

If PETSc's int or scalar type is not in _CTYPES, dolfinx currently throws a KeyError on import. This will prevent that, and errors will only occur if cffi_utils is used.

@jorgensd jorgensd added the bug Something isn't working label Jan 17, 2024
Copy link
Member

@garth-wells garth-wells left a comment

Choose a reason for hiding this comment

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

How are CI tests managing to pass without this change?

@mscroggs
Copy link
Member Author

How are CI tests managing to pass without this change?

the images on CI have types that are in _CTYPES so it's fine. Somehow my local Docker image doesn't though

@garth-wells
Copy link
Member

How are CI tests managing to pass without this change?

the images on CI have types that are in _CTYPES so it's fine. Somehow my local Docker image doesn't though

How are CI tests managing to pass without this change?

the images on CI have types that are in _CTYPES so it's fine. Somehow my local Docker image doesn't though

I can’t see what other NumPy types petsc4py supports. Can you check what the petsc4py integer and scalar types are in your image?

@mscroggs
Copy link
Member Author

How are CI tests managing to pass without this change?

the images on CI have types that are in _CTYPES so it's fine. Somehow my local Docker image doesn't though

How are CI tests managing to pass without this change?

the images on CI have types that are in _CTYPES so it's fine. Somehow my local Docker image doesn't though

I can’t see what other NumPy types petsc4py supports. Can you check what the petsc4py integer and scalar types are in your image?

IntType is np.longlong, ScalarType is np.float64

@garth-wells
Copy link
Member

I can’t see what other NumPy types petsc4py supports. Can you check what the petsc4py integer and scalar types are in your image?

IntType is np.longlong, ScalarType is np.float64

Maybe just add np.longlong to the dictionary?

@mscroggs
Copy link
Member Author

I can’t see what other NumPy types petsc4py supports. Can you check what the petsc4py integer and scalar types are in your image?

IntType is np.longlong, ScalarType is np.float64

Maybe just add np.longlong to the dictionary?

Done, but I think it's worth merging the rest of this in too so that if someone at any point uses petsc with a type we're yet to include, they only get errors when using cffi_utils and not when importing dolfinx

@garth-wells garth-wells added this pull request to the merge queue Jan 19, 2024
Merged via the queue into main with commit 14e3863 Jan 19, 2024
19 checks passed
@garth-wells garth-wells deleted the mscroggs/longlong branch January 19, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants