AMReX-Astro/Microphysics

discussion: explore alternative object-oriented API

Opened this issue · 0 comments

It turns out that SYCL does not support managed global variables. Currently, this makes using Intel GPUs impossible.

As an alternative, it was proposed to move global state into a struct that is passed to each function in #1433. However, this has some downsides: it's annoying to pass around an additional function argument, and this will require more host-device copies and also increase kernel launch latency.

As a major API change, it is possible in principle to rewrite the networks (and EOSes) to use a singleton class instance (or, non-singleton functor objects that carry around the state with them). It might be possible to have both the new object-oriented API and the old API at the same time for non-SYCL builds.

As a side effect, this would make it possible to build Microphysics as a shared (or static) library (or otherwise greatly simplify the build process) since the network could be selected at runtime.