Documentation
¶
Overview ¶
The communicator package implements an intermediary to communicate with Chronica's scheduler. The primitives are based on the syntax of the Message Passing Interface (MPI); the communicator runtime always starts with Init and ends with Finalize. At the beginning of each training epoch, Bcast is invoked to broadcast the schedule for the corresponding epoch to all workers.
Index ¶
- Constants
- Variables
- func RegisterCommunicatorServer(s grpc.ServiceRegistrar, srv CommunicatorServer)
- type BcastRequest
- func (*BcastRequest) Descriptor() ([]byte, []int)deprecated
- func (x *BcastRequest) GetCoefficient() float64
- func (x *BcastRequest) GetEpoch() int64
- func (x *BcastRequest) GetIntercept() float64
- func (x *BcastRequest) GetRank() int64
- func (*BcastRequest) ProtoMessage()
- func (x *BcastRequest) ProtoReflect() protoreflect.Message
- func (x *BcastRequest) Reset()
- func (x *BcastRequest) String() string
- type BcastResponse
- type CommunicatorClient
- type CommunicatorServer
- type InitRequest
- func (*InitRequest) Descriptor() ([]byte, []int)deprecated
- func (x *InitRequest) GetBatchSize() int64
- func (x *InitRequest) GetGroups() []int64
- func (x *InitRequest) GetKind() Schedule
- func (x *InitRequest) GetPartition() bool
- func (x *InitRequest) GetRank() int64
- func (x *InitRequest) GetSeed() int64
- func (x *InitRequest) GetSizes() []int64
- func (*InitRequest) ProtoMessage()
- func (x *InitRequest) ProtoReflect() protoreflect.Message
- func (x *InitRequest) Reset()
- func (x *InitRequest) String() string
- type Schedule
- type UnimplementedCommunicatorServer
- type UnsafeCommunicatorServer
Constants ¶
const ( Communicator_Init_FullMethodName = "/communicator.Communicator/Init" Communicator_Bcast_FullMethodName = "/communicator.Communicator/Bcast" Communicator_Finalize_FullMethodName = "/communicator.Communicator/Finalize" )
Variables ¶
var ( Schedule_name = map[int32]string{ 0: "STATIC", 1: "DYNAMIC", 2: "GUIDED", } Schedule_value = map[string]int32{ "STATIC": 0, "DYNAMIC": 1, "GUIDED": 2, } )
Enum value maps for Schedule.
var Communicator_ServiceDesc = grpc.ServiceDesc{ ServiceName: "communicator.Communicator", HandlerType: (*CommunicatorServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Init", Handler: _Communicator_Init_Handler, }, { MethodName: "Bcast", Handler: _Communicator_Bcast_Handler, }, { MethodName: "Finalize", Handler: _Communicator_Finalize_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "communicator.proto", }
Communicator_ServiceDesc is the grpc.ServiceDesc for Communicator service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_communicator_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCommunicatorServer ¶
func RegisterCommunicatorServer(s grpc.ServiceRegistrar, srv CommunicatorServer)
Types ¶
type BcastRequest ¶
type BcastRequest struct { Epoch int64 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"` Rank int64 `protobuf:"varint,2,opt,name=rank,proto3" json:"rank,omitempty"` Coefficient *float64 `protobuf:"fixed64,3,opt,name=coefficient,proto3,oneof" json:"coefficient,omitempty"` Intercept *float64 `protobuf:"fixed64,4,opt,name=intercept,proto3,oneof" json:"intercept,omitempty"` // contains filtered or unexported fields }
func (*BcastRequest) Descriptor
deprecated
func (*BcastRequest) Descriptor() ([]byte, []int)
Deprecated: Use BcastRequest.ProtoReflect.Descriptor instead.
func (*BcastRequest) GetCoefficient ¶
func (x *BcastRequest) GetCoefficient() float64
func (*BcastRequest) GetEpoch ¶
func (x *BcastRequest) GetEpoch() int64
func (*BcastRequest) GetIntercept ¶
func (x *BcastRequest) GetIntercept() float64
func (*BcastRequest) GetRank ¶
func (x *BcastRequest) GetRank() int64
func (*BcastRequest) ProtoMessage ¶
func (*BcastRequest) ProtoMessage()
func (*BcastRequest) ProtoReflect ¶
func (x *BcastRequest) ProtoReflect() protoreflect.Message
func (*BcastRequest) Reset ¶
func (x *BcastRequest) Reset()
func (*BcastRequest) String ¶
func (x *BcastRequest) String() string
type BcastResponse ¶
type BcastResponse struct { Indices []int64 `protobuf:"varint,1,rep,packed,name=indices,proto3" json:"indices,omitempty"` // contains filtered or unexported fields }
func (*BcastResponse) Descriptor
deprecated
func (*BcastResponse) Descriptor() ([]byte, []int)
Deprecated: Use BcastResponse.ProtoReflect.Descriptor instead.
func (*BcastResponse) GetIndices ¶
func (x *BcastResponse) GetIndices() []int64
func (*BcastResponse) ProtoMessage ¶
func (*BcastResponse) ProtoMessage()
func (*BcastResponse) ProtoReflect ¶
func (x *BcastResponse) ProtoReflect() protoreflect.Message
func (*BcastResponse) Reset ¶
func (x *BcastResponse) Reset()
func (*BcastResponse) String ¶
func (x *BcastResponse) String() string
type CommunicatorClient ¶
type CommunicatorClient interface { // RPC for initializing training environment. Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*empty.Empty, error) // RPC for broadcasting schedule to all workers. Bcast(ctx context.Context, in *BcastRequest, opts ...grpc.CallOption) (*BcastResponse, error) // RPC for terminating training environment. Finalize(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error) }
CommunicatorClient is the client API for Communicator service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkgo.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewCommunicatorClient ¶
func NewCommunicatorClient(cc grpc.ClientConnInterface) CommunicatorClient
type CommunicatorServer ¶
type CommunicatorServer interface { // RPC for initializing training environment. Init(context.Context, *InitRequest) (*empty.Empty, error) // RPC for broadcasting schedule to all workers. Bcast(context.Context, *BcastRequest) (*BcastResponse, error) // RPC for terminating training environment. Finalize(context.Context, *empty.Empty) (*empty.Empty, error) // contains filtered or unexported methods }
CommunicatorServer is the server API for Communicator service. All implementations must embed UnimplementedCommunicatorServer for forward compatibility
func NewCommunicatorServer ¶
func NewCommunicatorServer(done chan<- os.Signal, worldSize int) CommunicatorServer
NewCommunicatorServer creates a new communicator server with the given arguments.
type InitRequest ¶
type InitRequest struct { Rank int64 `protobuf:"varint,1,opt,name=rank,proto3" json:"rank,omitempty"` BatchSize int64 `protobuf:"varint,2,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` Seed int64 `protobuf:"varint,3,opt,name=seed,proto3" json:"seed,omitempty"` Sizes []int64 `protobuf:"varint,4,rep,packed,name=sizes,proto3" json:"sizes,omitempty"` Groups []int64 `protobuf:"varint,5,rep,packed,name=groups,proto3" json:"groups,omitempty"` Partition *bool `protobuf:"varint,6,opt,name=partition,proto3,oneof" json:"partition,omitempty"` Kind *Schedule `protobuf:"varint,7,opt,name=kind,proto3,enum=communicator.Schedule,oneof" json:"kind,omitempty"` // contains filtered or unexported fields }
func (*InitRequest) Descriptor
deprecated
func (*InitRequest) Descriptor() ([]byte, []int)
Deprecated: Use InitRequest.ProtoReflect.Descriptor instead.
func (*InitRequest) GetBatchSize ¶
func (x *InitRequest) GetBatchSize() int64
func (*InitRequest) GetGroups ¶
func (x *InitRequest) GetGroups() []int64
func (*InitRequest) GetKind ¶ added in v0.2.0
func (x *InitRequest) GetKind() Schedule
func (*InitRequest) GetPartition ¶
func (x *InitRequest) GetPartition() bool
func (*InitRequest) GetRank ¶
func (x *InitRequest) GetRank() int64
func (*InitRequest) GetSeed ¶ added in v0.2.6
func (x *InitRequest) GetSeed() int64
func (*InitRequest) GetSizes ¶
func (x *InitRequest) GetSizes() []int64
func (*InitRequest) ProtoMessage ¶
func (*InitRequest) ProtoMessage()
func (*InitRequest) ProtoReflect ¶
func (x *InitRequest) ProtoReflect() protoreflect.Message
func (*InitRequest) Reset ¶
func (x *InitRequest) Reset()
func (*InitRequest) String ¶
func (x *InitRequest) String() string
type Schedule ¶
type Schedule int32
func (Schedule) Descriptor ¶
func (Schedule) Descriptor() protoreflect.EnumDescriptor
func (Schedule) EnumDescriptor
deprecated
func (Schedule) Number ¶
func (x Schedule) Number() protoreflect.EnumNumber
func (Schedule) Type ¶
func (Schedule) Type() protoreflect.EnumType
type UnimplementedCommunicatorServer ¶
type UnimplementedCommunicatorServer struct { }
UnimplementedCommunicatorServer must be embedded to have forward compatible implementations.
func (UnimplementedCommunicatorServer) Bcast ¶
func (UnimplementedCommunicatorServer) Bcast(context.Context, *BcastRequest) (*BcastResponse, error)
func (UnimplementedCommunicatorServer) Init ¶
func (UnimplementedCommunicatorServer) Init(context.Context, *InitRequest) (*empty.Empty, error)
type UnsafeCommunicatorServer ¶
type UnsafeCommunicatorServer interface {
// contains filtered or unexported methods
}
UnsafeCommunicatorServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CommunicatorServer will result in compilation errors.