Closed kaushikcfd closed 2 years ago
As the one responsible for the current code.. Agreed!
IIUC, you're proposing that ArrayContext.{from,to}_numpy
should support containers?
IIUC, you're proposing that ArrayContext.{from,to}_numpy should support containers?
No, just that the logic of what array types are legal to be frozen must be moved the respective implementations. I found this condition: https://github.com/inducer/arraycontext/blob/17dcc60de852f5ff84b81dee68968a80ff22aa69/arraycontext/container/traversal.py#L835 to be quite restrictive, as we couldn't convert cl_arrays to NumPy arrays for PytatoPyOpenCLArrayContext.
For my understanding, why doesn't PytatoPyOpenCLArrayContext
advertise support for both the frozen and unfrozen array types? i.e. for both pt.Array
and cl.Array
.
Agree with @alexfikl, that seems like a relatively clean thing to do.
That was because operations like pt.Array+cla.Array aren't defined.
That was because operations like pt.Array+cla.Array aren't defined.
I think that's alright. array_types
just says "these are the possible types that come out of this". It doesn't need to entail a promise of interoperability.
I agree, I like this. I'll change #160 to implement this. Thanks to both!
For the following script:
I get the following error:
My proposal would be to keep the
arraycontext.container.to_numpy
's implementation lean by simply callingactx.to_numpy
on every leaf array and let theto_numpy
method raiseTypeError
whenever appropriate.