On Thu Nov 23, 2023 at 01:24 CET, Eli Bendersky wrote:
> On Wed, Nov 22, 2023 at 11:31 AM Sebastien Binet
> <
sebasti...@cern.ch>
> wrote:
>
> > Hi there,
> >
> > In this week "compiler minutes" [1], one can read:
> >
> > """
> > - Go on future platforms (RAM efficiency. NUMA?)
> > - (maybe) Go-Python interop for AI-powered applications
> > - [David]: is it a good idea to use cgo for Go-Python interop?
> > - [Michael]: no. better with pipe or RPC
> > """
> >
> > Would it be possible to have a bit more informations ?
> > What kind of interop is it ? Exchanging binary data ? On disk ?
> > Establishing a protobuf-based-like standard ?
> > Something else ?
> >
>
> All of it, maybe :-)
> We're just exploring the issue, throwing ideas around. There are many
> potential options, each with its own tradeoffs in terms of performance
> vs. effort.
depending on the timescale, one could also imagine having a Go-based python VM (e.g.
github.com/go-python/gpython) that can run a limited set of python modules (even the C-based ones, like pypy did at some point ?).
alternatively, "just" rely on pickle-based, Apache Arrow-based or numpy array-based exchanged data.
for Arrow and numpy, there are already packages that do offer a fair amount of interop:
-
https://github.com/apache/arrow/tree/main/go
-
https://github.com/sbinet/npyio/ (shameless plug.)
(we could imagine also adding some buffer protocol implementation à la PEP-3118)
for pickle, gpython has support up to protocol=3, and gopickle seems to have support for up to 5:
-
https://github.com/nlpodyssey/gopickle
(adding support for array.array to gopickle was relatively straightforward)
-s