https://github.com/go-python/gopy can manage the python bindings for you 
automatically.  The bigger issue for ML is GPU.  I wrote a gosl (Go shader 
language) package that converts Go to hlsl which can be compiled in vulkan for 
compute shaders -- works well for my needs: https://github.com/emer/gosl   The 
same approach should also work for generating CUDA code, but I was already 
using vulkan in Go so that was easier.

In any case, after doing all the work of making my Go-based models available in 
Python via gopy, almost everyone found it easier to just use the Go models 
directly :)  That's the thing about Go: you really don't need the python front 
end in the same way that you do for C++, which takes so much longer to build, 
and is so unpleasant to code in.

The rest of the world will almost certainly keep using python and its 
established toolkits, so there isn't much hope of changing the ecosystem, but 
if you have some specific use-case and enjoy coding in Go, you can most likely 
make it work for you and some of your close friends :)

- Randy

> On Apr 14, 2024, at 10:31 PM, envee <neeraj.vaidy...@gmail.com> wrote:
> 
> "
> - python -> c++ is one less layer of complexity to reason about than python 
> -> c -> go 
> "
> But doesn't the numpy package already use ctypes, for example ?maybe not a 
> golang-nuts question, but I was just wondering what is it that C++ can 
> perhaps do that Go cannot when creating bindings for Python ?
> 
> On Mon, Apr 15, 2024 at 1:05 PM Matt Parker <mattfparke...@gmail.com> wrote:
> - python -> c++ is one less layer of complexity to reason about than python 
> -> c -> go
> - the go runtime is great for developer ergonomics, but is going to cost more 
> flops than equivalent code in c++ because of features like garbage 
> collection. additionally the concurrent features of go are great but 
> concurrent ML backends will probably be used a lot more than they are read + 
> written, so probably a fair tradeoff to sacrifice readability for performance 
> here. 
> On Sunday, April 14, 2024 at 8:15:51 AM UTC-4 envee wrote:
> After reading briefly about ML and how Python is used as a "veneer" for C++ 
> code, I was wondering why Go is not used as the backend, given it's excellent 
> concurrency support and ease of use.
> Basically, I was thinking if the backend is written as a shared object in Go, 
> and then used in Python using ctypes.
> I have seen a huge number of libraries on the awesome-go website, but don't 
> know if they have Python bindings.
> Any views ?
> What really is a limitation which does not encourage developers to prefer Go 
> over C++ as the ML backend ?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/dc8d6282-d1cf-43db-a0ee-a1347e345638n%40googlegroups.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/CALFCev5_64WLaXJrxAT8e8EDr5ts7xXO47gc91vONedETUQ9rg%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/D9FF9D25-3877-4E11-AFFE-CAEFA8DFDEF9%40gmail.com.

Reply via email to