diff --git a/paddle/go/pserver/client.go b/paddle/go/pserver/client.go index 04bf58cd3e216c62fad040bc0abc44c241099bcb..5b110af648da684c945ba6bfda3d50fa9a295773 100644 --- a/paddle/go/pserver/client.go +++ b/paddle/go/pserver/client.go @@ -13,49 +13,71 @@ const ( Float64 ) +// Parameter is a piece of data to sync with the parameter server. type Parameter struct { Name string ElementType ElementType Content []byte } +// ParameterWithConfig contains the parameter and the configuration. type ParameterWithConfig struct { Param Parameter - Config []byte + Config []byte // parameter configuration in Proto Buffer format } +// Gradient is the gradient of the parameter. type Gradient Parameter +// Client is the client to parameter servers. type Client struct { } +// NewClient creates a new client. func NewClient(addr string) *Client { return &Client{} } -func (c *Client) BeginInitParams(pserverConfigProto []byte) (bool, error) { +// BeginInitParams begins to initialize parameters on parameter +// servers. +// +// BeginInitParams will be called from multiple trainers, only one +// trainer will be selected to initialize the parameters on parameter +// servers. Other trainers will be blocked until the initialization is +// done, and they need to get the initialized parameters from +// parameter servers using GetParams. +func (c *Client) BeginInitParams(pserverConfigProto []byte) (selected bool, err error) { return true, nil } +// InitParam initializes the parameter on parameter servers. func (c *Client) InitParam(paramWithConfigs ParameterWithConfig) error { return nil } +// FinishInitParams tells parameter servers client has sent all +// parameters to parameter servers as initialization. func (c *Client) FinishInitParams() error { return nil } +// SendGrads sends gradients to parameter servers for updating +// parameters. func (c *Client) SendGrads(grads []Gradient) error { return nil } +// GetParams gets parameters from parameter servers. func (c *Client) GetParams(names []string) ([]Parameter, error) { return nil, nil } +// SaveModel indicates parameters to save the parameter to the given +// path. func (c *Client) SaveModel(path string) error { return nil } +// Cleanup cleans up the client states. func (c *Client) Cleanup() { }