modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
22.92k stars 2.58k forks source link

[Feature Request] Support for grpc #3181

Open liuzhishan opened 2 months ago

liuzhishan commented 2 months ago

Review Mojo's priorities

What is your request?

I want to use grpc in Mojo.

What is your motivation for this change?

In distributed computing, workers need to communicate with each other, so grpc is a key part of distributed computing. Since Mojo aim to be the world's unified AI infrastructure, grpc seems to be inevitable eventually.

And I check the grpc homepage, mojo is not supported yet officially. Are there any plan about this subject, or are there any other preliminary work need to be done first ? Some idea could be considered:

  1. As @Brian-M-J pointed out in discussion https://github.com/modularml/mojo/discussions/3132, one way to support grpc is to make a Mojo wrapper for the core C++ library. But it may require some support for c++ interop.
  2. Generate Mojo code for grpc, and then use it in Mojo as other language.

Both ways seems to be a lot of work. I think grpc is a huge subject, these are my some simple thought about grpc. Maybe need some more discussion about this subject.

Any other details?

No response

martinvuyk commented 2 months ago

I think GRPC is something that should be developed in a separate library not a standard library since it is not a dominant protocol.

And I also think it is too early because we don't even have a socket module or an http module or a json module which are arguably much more dominant in the Web than GRPC and should be prioritized

JoeLoser commented 2 months ago

As Martin mentioned, I think it's quite early for us to focus on gRPC, although I see its value. I'd recommend we wait for C++ interop to push on this, or at a minimum, until our C interop is better and/or we have more first class Mojo modules like socket, etc.

liuzhishan commented 2 months ago

Thanks for the reply, @martinvuyk @JoeLoser . It seems too early to focus on grpc now. And to my knowledge c interop and c++ interop need to be implemented in the Mojo compiler, not the library, so we need to wait the preliminary work.

I have some experience in developing distributed training, and many of the challenge in training are exactly Mojo aim to solve. So I'am every interested in using Mojo in training stage. If there are any releated work, I'm very happy to help.

martinvuyk commented 1 month ago

Hi @liuzhishan, forgot to come back and give you some links. If you're interested there are projects like Maxim's Flatbuffers in Mojo (Flatbuffers are a spin-off of Protobuf, but yeah long term we should definitely have an external Protobuf library), there are a bunch of other interesting projects you may join or take inspiration from. The Discord server has some interesting stuff.

liuzhishan commented 1 month ago

Hi @martinvuyk thanks for the advice, I'll check these projects.