Deprecate with_container_arithmetic's bcast_numpy_array arg - #95
Deprecate with_container_arithmetic's bcast_numpy_array arg#95kaushikcfd wants to merge 1 commit into
Conversation
inducer
commented
Sep 29, 2021
cc @majosm (I think this would be worth a look once you're back) |
majosm
commented
Oct 4, 2021
Not sure if I like the change in illinois-ceesd/mirgecom#514... requiring the application programmer to distinguish between numpy arrays of dtype float and object arrays containing floats seems less than ideal. Would it be enough to just forbid setting both |
kaushikcfd
commented
Oct 5, 2021
@majosm: Yep, the interface won't be as brief as before, but I can see folks preferring Numpy over PyOpenCL in MIRGE-Com (for development purposes), as PyOpenCL arrays aren't quite fully implemented when it comes to features like broadcasting, non-contiguous copies, etc. (@thomasgibson took this route while prototyping some of his stuff). And, if we intend to support a Numpy-based array context, casting them into object arrays before using them for arithmetic is a deal-breaker for its implementation. |
Uh oh!
There was an error while loading. Please reload this page.
inducer
commented
Oct 7, 2021
I think an array context that just wraps As far as I can tell, it's not straightforward from looking at a numpy array in If there's an elegant way that gets us numpy array contexts and avoids the compat break, I'd be curious to hear about it. But as long as it an either-or between plain-numpy array contexts and slicker-looking broadcasting, I'll take the former, I think. |
cd81e92 to
7da8e1fComparemajosm
commented
Oct 7, 2021
Is there a use case for |
kaushikcfd
commented
Oct 7, 2021
Yep, if we use PytatoArrayContext for the project https://github.com/illinois-ceesd/drivers_y1-nozzle, we do see failures if |
kaushikcfd
commented
Oct 7, 2021
About |
majosm
commented
Oct 7, 2021
Ah, ok. Yeah, I can't really think of any way around this then. |
Passing both 'bcast_numpy_array' and '_bcast_actx_array_types' was ill-defined. For example, in the case of an ArrayContext whose thawed array type is np.ndarray the specification would contradict between broadcasting the argument numpy_array to return an object array *OR* peforming the operation with every leaf array. Consider the example below, ( - 'Foo: ArrayContainer' whose arithmetic routines are generated by `with_container_arithmetic(bcast_numpy=True, _bcast_actx_array_types=True)` - 'actx: ArrayContextT' for whom `np.ndarray` is a valid thawed array type. ) Foo(DOFArray(actx, [38*actx.ones(3, np.float64)])) + np.array([3, 4, 5]) could be either of: - array([Foo(DOFArray([array([41, 41, 41])])), Foo(DOFArray([array([42, 42, 42])])), Foo(DOFArray([array([43, 43, 43])]))]), OR, - Foo(DOFArray(actx, array([41, 42, 43])))
7da8e1f to
dee59a7Compare
Draft because