EAMxx: allow atmosphere processes to call python code
This PR adds the possibility for atm procs to create py bindings of their fields and call py code at runtime.
So far, I only added a test running a py impl of cldfrac instead of the C++ code.
Btw, I think the test is exposing the fact that the outputs of the test were all 0's, which I don't think was expected. I have to dig a bit.
Good start, but I don't think we should integrate this as-is. Feel free to push back... I think we should be strive to unify our approach with the pyeamxx nanobind interfacing...
Unfortunately, I had to abandon nanobind, since it's not meant to be used for calling Python from C++. It's purpose is to wrap C++ code in a py module, so you can call from python. I asked this to both snl and google AI bots, and both came up with the same explanation (more or less what I said above). I spent a day trying to figure out why passing a nb::ndarray to python would segfault, and eventually tracked it down to that reasoning. Both AI bots suggested pybind11 for calling py from c++...
Good start, but I don't think we should integrate this as-is. Feel free to push back... I think we should be strive to unify our approach with the pyeamxx nanobind interfacing...
Unfortunately, I had to abandon nanobind, since it's not meant to be used for calling Python from C++. It's purpose is to wrap C++ code in a py module, so you can call from python. I asked this to both snl and google AI bots, and both came up with the same explanation (more or less what I said above). I spent a day trying to figure out why passing a nb::ndarray to python would segfault, and eventually tracked it down to that reasoning. Both AI bots suggested pybind11 for calling py from c++...
That's surprising but ofc you're right: https://github.com/wjakob/nanobind/discussions/302
Ok, then the main objection is gone; we will move the pyeamxx stuff from nanobind to pybind11 later after seeing where this effort reaches...
Uhm, I realized that there is no test of this feature anywhere. Maybe I need to enable the py support in our CI.
Edit: I enabled it in our CPU ci machine file only.
Closing for now. Will reopen when I fix a few things.