Add custom __reduce__ to kernels#268
Conversation
|
I'll try and take a look tomorrow. First I would like to understand how that LU factorization thing got into the pickling in the first place. |
The function it's complaining about is here My understanding is that without a custom |
|
Ah OK, that makes sense. In that case, I think this is probably as good as it gets. I guess what I'd like better is if the kernels were dataclasses, but 🤷 this won't prevent that, and getting them to be dataclasses seems like a somewhat bigger lift. |
All the ones in here are dataclasses, but that doesn't implement any special |
Don't know if it's worth it. Getting rid of custom constructors would be nice and would fix this, too, though. |
|
I'll go ahead and merge this for the time being; it's easy enough to revert. |
|
Thanks for making this! |
This is inspired by a failure in the Stokes branch from
pytentialinducer/pytential#162.It started reproducibly raising exceptions as below. From what I can tell, the issue there was that the
_memoize_dictfromsystem_utils_get_base_kernel_matrix_lu_factorizationsomehow got into the pickling process.I tried to implement a more generic
__reduce__withfields(self), but pretty much all the kernels have a custom constructor, so went with just copy pasting it a bit. Is there some better fix for this?