ggml
[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)
Brought by drakestapleton
ggml / src / ggml-rpc / transport.h
| 1 | #pragma once |
| 2 | |
| 3 | #include <cstddef> |
| 4 | #include <cstdint> |
| 5 | #include <memory> |
| 6 | |
| 7 | struct socket_t; |
| 8 | typedef std::shared_ptr<socket_t> socket_ptr; |
| 9 | |
| 10 | static constexpr size_t MAX_CHUNK_SIZE = 1024ull * 1024ull * 1024ull; // 1 GiB |
| 11 | static constexpr size_t RPC_CONN_CAPS_SIZE = 24; |
| 12 | |
| 13 | struct socket_t { |
| 14 | ~socket_t(); |
| 15 | |
| 16 | bool send_data(const void * data, size_t size); |
| 17 | bool recv_data(void * data, size_t size); |
| 18 | // Must be called at every message boundary: the RDMA transport coalesces |
| 19 | // writes into fixed-size frames and posts the trailing partial frame only |
| 20 | // here. No-op on TCP. |
| 21 | bool flush(); |
| 22 | |
| 23 | socket_ptr accept(); |
| 24 | |
| 25 | void get_caps(uint8_t * local_caps); |
| 26 | void update_caps(const uint8_t * remote_caps); |
| 27 | const char * transport_name() const; |
| 28 | |
| 29 | static socket_ptr create_server(const char * host, int port); |
| 30 | static socket_ptr connect(const char * host, int port); |
| 31 | |
| 32 | private: |
| 33 | struct impl; |
| 34 | explicit socket_t(std::unique_ptr<impl> p); |
| 35 | std::unique_ptr<impl> pimpl; |
| 36 | }; |
| 37 | |
| 38 | bool rpc_transport_init(); |
| 39 | void rpc_transport_shutdown(); |