• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • Compute Graph Framework SDK Reference  5.10
    All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    CGF Channel

    CGF Channel

    CGF Channel is a data allocation and transport framework. Its features include:

    • Multiple transport backends including local shared memory, socket ipc, and NvSciStream, with near zero API differences for applications to switch between them. Code producing or consuming data can be written without knowledge of whether their peer is in the same process, a remote process, or on a different SOC.
    • Multicasting from a single producer to multiple consumers.
    • Flexibility to transfer many data types and use application-defined data types.
    • Buffer pool allocation.
    • Fifo or mailbox consumption modes for consumers.

    CGF Channels include several different classes which are used together to accomplish its functionality.

    • ChannelObject is the abstract, weakly-typed interface which transports the data.
    • ChannelFactory serves as a shared context object for all ChannelObjects and is responsible for constructing them.
    • ChannelConnector is a utility which connects ChannelObjects to their peer producers and consumers at init-time.
    • Ports are lightweight objects that bind to a ChannelObject to provide a strongly-typed interface to allocate and transport data.
    • IChannelPacket is the interface that CGF Channels uses to handle type-specific functionality. Applications extend these interfaces in order to define how CGF Channels can allocate and transport their data types.

    Channels are allocated by the ChannelFactory with parameters specified in a string format. The parameters are specified in key=value pairs delineated by commas. Unrecognized keys and their values are ignored.

    The parameter keys include the following:

    Key Value Range Usage Description
    role {producer, consumer, composite} required Indicates if the channel is a producer, consumer. Composite role is deprecated.
    type {SHMEM_LOCAL, SOCKET, NVSCI} optional (default SHMEM_LOCAL) Indicates the type of channel, which implies the underlying transport protocal to use. Only channels of the same type may connect to each other.
    fifo-size optional (default 1) For producer localshmem channels, fifo-size hints the number of packets allocate. The size of the packet pool is the maximum of fifo-size parameters for any connected consumer or the producer plus one for each connected consumer and the producer. For consumer localshmem channels, fifo-size indicates the maximum logical size that the queue of received packets is allowed to reach. For producer socket channels, fifo-size is ignored except when producer-fifo=1. For consumer socket channels, fifo-size is the maximum logical size that the queue of received packets is allowed to reach once packets have been read from the socket and placed in memory. The consumer allocates a pool of packets equal to the fifo-size parameter. For producer nvsci channels, fifo-size is the number of packets to allocate. For consumer nvsci channels, fifo-size is ignored. There is no logical limit on the size of the received packet queue imposed by a consumer. Instead, the size of the queue is determined simply by the number of packets allocated by the producer.
    mode {mailbox, singleton} optional (default none) mode=mailbox indicates that the maximum size of the queue of received packets is one and that old packets received but not yet read by the application will be dropped (immediately released back to the producer), and replaced when a newer packet is received. mode=singleton is deprecated. When not specified the default behavior of consumers is that old packets are not dropped. For localshmem fifo consumers, the producer application thread will throw an error on attempt to send more packets than are allowed.
    id uint16 localshmem and socket only, required The unique producer id for the connection. Producer channels own the id and consumer channels use the id to identify the producer to connect to. For socket channels, the id is used as the port for the socket connection.
    num-clients uint16 socket and localshmem producer only, optional (default 1) Indicates the number of expected consumers to connect to the producer. If the number of connected consumers is less than num-clients, the producer is logically not yet connected.
    singleton-id uint16 localshmem producer only, optional (default none) singleton-id enables shared pool packet useage where multiple producers utilize the same underlying packet pool instead of allocating their own disjoint packet pools. Each pool has a unique id and singleton-id, passed to a producer localshmem channel, indicates the id of the shared packet pool for the channel to use. It is enforced by Channels that only one producer and its associated consumers may use each packet from the shared packet pool at a time. The shared packet pool size is limited to 1.
    ip IPv4 or IPv6 address string socket only, required The IP address of remote peer to connect to.
    producer-fifo 0 or 1 socket producer only, optional (default 0) Indicates if the socket producer channel shall allocate more than one buffer to be filled by the application before send. In use-cases where producer application fills and sends one buffer at a time, the default value is sufficient. Indicates the nvsciipc endpoints to connect to. For consumer channels, only one endpoint is required and allowed.

    Channels currently have many more deprecated parameters that are exposed and useable but not documented here.

    人人超碰97caoporen国产