Pular para o conteúdo principal

synapsys.transport

Transport strategy implementations for inter-process communication.

TransportStrategy (Abstract Base Class)

All transports implement this interface:

MethodDescription
write(channel: str, data: np.ndarray) -> NoneWrites data to a named channel
read(channel: str) -> np.ndarrayReads data from a named channel
close() -> NoneReleases resources

SharedMemoryTransport

Zero-copy transport using OS shared memory. Best for processes on the same machine.

SharedMemoryTransport(
name: str,
channels: dict[str, int],
create: bool = False,
)
ParameterDescription
nameOS shared memory block identifier
channelsDict mapping channel name to number of float64 values
createTrue for the owner process (allocates memory)
atenção

Only the create=True instance calls unlink() on close. All other instances call only close().

ZMQTransport

PUB/SUB asynchronous transport over a network.

ZMQTransport(address: str, mode: Literal["pub", "sub"])

ZMQReqRepTransport

Synchronous REQ/REP transport for lock-step simulation over a network.

ZMQReqRepTransport(address: str, mode: Literal["server", "client"])
Order matters

Server must call read() before write(). Client must call write() before read(). Mismatched order causes deadlock.

Source

See synapsys/transport/ on GitHub.