Documentation
¶
Overview ¶
Package jaccl implements RDMA collective communication in Go.
It uses the Apple RDMA bindings directly. It does not call libjaccl or use cgo. The initial implementation targets Apple Thunderbolt RDMA on darwin/ arm64; unsupported platforms return ErrUnsupported.
Thread QoS on darwin/arm64 ¶
On darwin/arm64, after the first collective on an OS thread, jaccl raises that OS thread's QoS class to UserInteractive and leaves it there so subsequent collectives avoid per-operation QoS syscalls and P-core demotion. Because pthread QoS is an OS-thread attribute, other goroutines later scheduled on that OS thread inherit UserInteractive QoS.
Configure thread QoS per group with Config.WireQoS (WireQoSSticky, WireQoSPerOp, or WireQoSNone). Leaving Config.WireQoS at its zero value (WireQoSDefault) defers to the JACCL_WIRE_QOS environment variable ("sticky", "per_op", or "none") and defaults to WireQoSSticky.
Index ¶
- Constants
- Variables
- func Available() bool
- type Config
- type DType
- type Group
- func (g *Group) AllGather(ctx context.Context, dst, src []byte) error
- func (g *Group) AllMax(ctx context.Context, dst, src []byte, dtype DType) error
- func (g *Group) AllMin(ctx context.Context, dst, src []byte, dtype DType) error
- func (g *Group) AllReduce(ctx context.Context, dst, src []byte, dtype DType, op ReduceOp) error
- func (g *Group) AllSum(ctx context.Context, dst, src []byte, dtype DType) error
- func (g *Group) Barrier(ctx context.Context) error
- func (g *Group) Close() error
- func (g *Group) Rank() int
- func (g *Group) Recv(ctx context.Context, src int, dst []byte) error
- func (g *Group) RegisterBuffer(buf []byte) error
- func (g *Group) Send(ctx context.Context, dst int, src []byte) error
- func (g *Group) Size() int
- func (g *Group) UnregisterBuffer(buf []byte) error
- type ReduceOp
- type Topology
- type WireQoSMode
Constants ¶
const DefaultOpTimeout = 10 * time.Second
DefaultOpTimeout is the built-in wire-stall (no-progress) timeout applied to RDMA operations when the caller's context has no deadline and Config.OpTimeout is zero. It bounds wire stalls after both ranks have entered the operation (resetting on each completion), NOT peer arrival or Barrier agreement (which remain bounded only by the caller's context). Quiet-host 64 MiB collectives measure p99 = 7.34 ms; 10s provides >1300x headroom over normal tail latency while bounding silent UC message loss.
const Uint8 = UInt8
Uint8 is kept as the spelling used by the first Go API.
Variables ¶
var ( // ErrUnsupported reports that the local platform or RDMA provider is not supported. ErrUnsupported = errors.New("jaccl: unsupported") // ErrInvalidConfig reports an invalid group configuration. ErrInvalidConfig = errors.New("jaccl: invalid config") // ErrProtocol reports an invalid or mismatched peer protocol message. ErrProtocol = errors.New("jaccl: protocol error") // ErrClosed reports use of a closing or closed group. ErrClosed = errors.New("jaccl: group closed") // ErrPoisoned reports a group made unsafe by a transport failure. ErrPoisoned = errors.New("jaccl: group poisoned") // ErrPeerAborted reports that a peer rank failed and aborted the group over // the out-of-band TCP control channel. ErrPeerAborted = errors.New("jaccl: peer aborted") )
Functions ¶
Types ¶
type Config ¶
type Config struct {
Rank int
Size int
GroupID string
Coordinator string
Device string
// Devices is the upstream JACCL directed connectivity matrix. Each cell
// names zero or more RDMA devices for one source-to-destination link.
Devices [][][]string
// PreferRing asks ConfigFromEnv to choose a valid ring before a mesh.
PreferRing bool
Port uint8
Topology Topology
// OpTimeout bounds how long an operation waits without wire progress after
// both ranks have entered the operation when the caller's context has no
// deadline. It does not bound peer arrival or Barrier agreement. Zero
// selects DefaultOpTimeout; a negative value disables the built-in timeout.
OpTimeout time.Duration
// WireQoS controls darwin/arm64 OS-thread QoS management during RDMA
// operations. Zero (WireQoSDefault) defers to JACCL_WIRE_QOS or
// WireQoSSticky when unset.
WireQoS WireQoSMode
}
Config describes one rank in a group.
func ConfigFromEnv ¶
ConfigFromEnv reads the standalone JACCL configuration variables. It accepts JACCL_* names first, then the MLX_* aliases used by the upstream library.
The returned Config retains the full device matrix for parity tooling. The native backend uses the matrix during setup: a mesh selects its first directed device and a ring retains each directed wire.
type DType ¶
type DType uint8
DType is an element representation used by AllReduce. Its values match the standalone JACCL Dtype enum so an external parity fixture can use the same type table in both implementations.
const ( // Bool is a boolean element. Bool DType = iota // Int8 is a signed 8-bit integer element. Int8 // Int16 is a signed 16-bit integer element. Int16 // Int32 is a signed 32-bit integer element. Int32 // Int64 is a signed 64-bit integer element. Int64 // UInt8 is an unsigned 8-bit integer element. UInt8 // UInt16 is an unsigned 16-bit integer element. UInt16 // UInt32 is an unsigned 32-bit integer element. UInt32 // UInt64 is an unsigned 64-bit integer element. UInt64 // Float16 is an IEEE 754 binary16 element. Float16 // BFloat16 is a bfloat16 element. BFloat16 // Float32 is an IEEE 754 binary32 element. Float32 // Float64 is an IEEE 754 binary64 element. Float64 // Complex64 is a pair of IEEE 754 binary32 values. Complex64 )
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is a live RDMA communicator.
func OpenEnv ¶
OpenEnv reads a standalone JACCL-compatible environment configuration and opens the resulting group.
func (*Group) RegisterBuffer ¶
RegisterBuffer pre-registers a page-aligned buffer (e.g. mmap or Metal unified-memory slab) across all RDMA links in the group so subsequent collectives can use zero-copy direct MRs without hot-path ibv_reg_mr skew. Apple's RDMA provider registers only memory below 1 TiB, so a buffer from the Go heap cannot be registered; collectives on it use staging copies. Shared Metal buffers (macOS 27.2) land below 1 TiB and register. Buffers smaller than 64 KiB, or whose start address is not a multiple of the page size, are not registered and RegisterBuffer returns nil; any non-zero length is accepted when the start address is page-aligned. Callers should synchronize peers (e.g. Barrier) after registration and call UnregisterBuffer before freeing or unmapping buf.
func (*Group) UnregisterBuffer ¶
UnregisterBuffer deregisters a buffer previously registered with RegisterBuffer.
type Topology ¶
Topology reports the directly connected peers for a rank.
Peers must return no duplicate, self, or out-of-range ranks. Open validates both the local report and reciprocal reports exchanged with peers.
type WireQoSMode ¶
type WireQoSMode uint8
WireQoSMode controls darwin/arm64 OS-thread QoS management during RDMA operations. On other platforms it has no effect.
const ( // WireQoSDefault defers to the JACCL_WIRE_QOS environment variable, or // WireQoSSticky when unset. WireQoSDefault WireQoSMode = iota // WireQoSSticky promotes each OS thread to UserInteractive on its first // operation and leaves it promoted across subsequent calls. WireQoSSticky // WireQoSPerOp raises the thread to UserInteractive on entry and restores // its prior QoS class on return. WireQoSPerOp // WireQoSNone disables thread QoS management while still pinning the // goroutine to its OS thread during RDMA completion polling. WireQoSNone )
func (WireQoSMode) String ¶
func (m WireQoSMode) String() string
String returns the canonical name of m.
Source Files
¶
- available_unsupported.go
- cleanup.go
- config.go
- connectivity.go
- credit.go
- destination_exchange.go
- doc.go
- env.go
- errors.go
- group.go
- meshreduce.go
- mr_cache.go
- open_unsupported.go
- operation.go
- overlap.go
- protocol.go
- ready.go
- reduce.go
- reduce_kernels_default.go
- rendezvous.go
- ring.go
- ring_reduce.go
- slots.go
- slots_pipeline.go
- types.go
- wire_qos_other.go
- wire_spans_other.go
- workid.go