client

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the client to parameter servers.

func NewClient

func NewClient(l Lister, pserverNum int, sel Selector) *Client

NewClient creates a new client.

func (*Client) BeginInitParams

func (c *Client) BeginInitParams() (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 (*Client) FinishInitParams

func (c *Client) FinishInitParams() error

FinishInitParams tells parameter servers client has sent all parameters to parameter servers as initialization.

func (*Client) GetParams

func (c *Client) GetParams(names []string) ([]pserver.Parameter, error)

GetParams gets parameters from parameter servers.

func (*Client) InitParam

func (c *Client) InitParam(paramWithConfigs pserver.ParameterWithConfig) error

InitParam initializes the parameter on parameter servers.

func (*Client) SendGrads

func (c *Client) SendGrads(grads []pserver.Gradient) error

SendGrads sends gradients to parameter servers for updating parameters.

type Etcd

type Etcd struct {
	// contains filtered or unexported fields
}

Etcd is used by pserver client that is a part of trainer process. TODO: 1. add watcher to watch the change state of pservers.

func NewEtcd

func NewEtcd(endpoints string) *Etcd

NewEtcd create a etcd client to return the state of pserver on etcd.

func (*Etcd) Close

func (e *Etcd) Close() error

Close closes the etcd client.

func (*Etcd) Desired

func (e *Etcd) Desired() int

Desired read ps desired number from etcd.

func (*Etcd) Done

func (e *Etcd) Done() error

Done indicates the parameter initialization process is done.

func (*Etcd) List

func (e *Etcd) List() []Server

List return the pserver list read from etcd.

func (*Etcd) Select

func (e *Etcd) Select() (bool, error)

Select indicates if the current trainer is selected to initialize the pserver parameters.

type Lister

type Lister interface {
	List() []Server
}

Lister lists currently available parameter servers.

type Selector

type Selector interface {
	// Select selects if the client should initialize parameter servers.
	Select() (bool, error)
	// Done indicates the initialization process is done.
	Done() error
}

Selector selects if the client should initialize parameters and reports the initialization process done.

type Server

type Server struct {
	Index int
	Addr  string
}

Server is the identification of a parameter Server.

Directories

Path Synopsis
c

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL