ucx

package
v0.0.0-...-e36e541 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UCP_CONN_REQUEST_ATTR_FIELD_CLIENT_ADDR = C.UCP_CONN_REQUEST_ATTR_FIELD_CLIENT_ADDR
	UCP_CONN_REQUEST_ATTR_FIELD_CLIENT_ID   = C.UCP_CONN_REQUEST_ATTR_FIELD_CLIENT_ID
)

Variables

This section is empty.

Functions

func AllocateNativeMemory

func AllocateNativeMemory(size uint64) unsafe.Pointer

func CBytes

func CBytes(data []byte) unsafe.Pointer

func FreeNativeMemory

func FreeNativeMemory(pointer unsafe.Pointer)

func GoBytes

func GoBytes(p unsafe.Pointer, n uint64) []byte

func IsMemTypeSupported

func IsMemTypeSupported(memType UcsMemoryType, mask uint64) bool

Checks whether context's memory type mask (received via UcpContext.MemoryTypesMask()) supports particular memory type.

func NewUcxError

func NewUcxError(status UcsStatus) error

Types

type UcpAddress

type UcpAddress struct {
	Address *C.ucp_address_t
	Length  uint64
	// contains filtered or unexported fields
}

func (*UcpAddress) Close

func (a *UcpAddress) Close()

type UcpAmCbFlags

type UcpAmCbFlags uint64
const (
	// Indicates that the entire message will be handled in one callback.
	UCP_AM_FLAG_WHOLE_MSG UcpAmCbFlags = C.UCP_AM_FLAG_WHOLE_MSG

	// Guarantees that the specified callback, will always be called
	// with UCP_AM_RECV_ATTR_FLAG_DATA flag set,so the data will be accessible outside the callback,
	// until UcpAmData.Close() is called.
	UCP_AM_FLAG_PERSISTENT_DATA UcpAmCbFlags = C.UCP_AM_FLAG_PERSISTENT_DATA
)

type UcpAmData

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

Active Message data descriptor

func (*UcpAmData) CanPersist

func (d *UcpAmData) CanPersist() bool

Whether this amData descriptor can be persisted outside UcpAmRecvCallback callback by returning UCS_INPROGRESS

func (*UcpAmData) Close

func (d *UcpAmData) Close()

func (*UcpAmData) DataPointer

func (d *UcpAmData) DataPointer() (unsafe.Pointer, error)

Pointer to a received data

func (*UcpAmData) IsDataValid

func (d *UcpAmData) IsDataValid() bool

Whether actual data is received or need to call UcpAmData.Receive()

func (*UcpAmData) Length

func (d *UcpAmData) Length() uint64

func (*UcpAmData) Receive

func (d *UcpAmData) Receive(recvBuffer unsafe.Pointer, size uint64, params *UcpRequestParams) (*UcpRequest, error)

type UcpAmDataRecvCallback

type UcpAmDataRecvCallback = func(request *UcpRequest, status UcsStatus, length uint64)

type UcpAmRecvAttrs

type UcpAmRecvAttrs uint64
const (
	UCP_AM_RECV_ATTR_FIELD_REPLY_EP UcpAmRecvAttrs = C.UCP_AM_RECV_ATTR_FIELD_REPLY_EP
	UCP_AM_RECV_ATTR_FLAG_DATA      UcpAmRecvAttrs = C.UCP_AM_RECV_ATTR_FLAG_DATA
	UCP_AM_RECV_ATTR_FLAG_RNDV      UcpAmRecvAttrs = C.UCP_AM_RECV_ATTR_FLAG_RNDV
)

type UcpAmRecvCallback

type UcpAmRecvCallback = func(header unsafe.Pointer, headerSize uint64,
	data *UcpAmData, replyEp *UcpEp) UcsStatus

type UcpAmSendFlags

type UcpAmSendFlags uint64
const (
	// Force relevant reply endpoint to be passed to the data callback on the receiver.
	UCP_AM_SEND_FLAG_REPLY UcpAmSendFlags = C.UCP_AM_SEND_FLAG_REPLY
	// Force UCP to use only eager protocol for AM sends.
	UCP_AM_SEND_FLAG_EAGER UcpAmSendFlags = C.UCP_AM_SEND_FLAG_EAGER
	// Force UCP to use only rendezvous protocol for AM sends.
	UCP_AM_SEND_FLAG_RNDV UcpAmSendFlags = C.UCP_AM_SEND_FLAG_RNDV
)

type UcpCallback

type UcpCallback interface{}

type UcpConnRequestAttribute

type UcpConnRequestAttribute uint32

type UcpConnectionRequest

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

func (*UcpConnectionRequest) Query

func (*UcpConnectionRequest) Reject

func (c *UcpConnectionRequest) Reject() error

type UcpConnectionRequestAttributes

type UcpConnectionRequestAttributes struct {
	ClientAddress *net.TCPAddr
	ClientId      uint64
}

type UcpContext

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

UCP application context (or just a context) is an opaque handle that holds a UCP communication instance's global information. It represents a single UCP communication instance. The communication instance could be an OS process (an application) that uses UCP library. This global information includes communication resources, endpoints, memory, temporary file storage, and other communication information directly associated with a specific UCP instance. The context also acts as an isolation mechanism, allowing resources associated with the context to manage multiple concurrent communication instances. For example, users can isolate their communication by allocating and using separate contexts. Alternatively, users can share the communication resources (memory, network resource context, etc.) between them by using the same application context. A message sent or a RMA operation performed in one application context cannot be received in any other application context.

func NewUcpContext

func NewUcpContext(contextParams *UcpParams) (*UcpContext, error)

func (*UcpContext) Close

func (c *UcpContext) Close() error

func (*UcpContext) MemMap

func (c *UcpContext) MemMap(memMapParams *UcpMmapParams) (*UcpMemory, error)

Associates memory allocated/mapped region with communication operations The network stack associated with an application context can typically send and receive data from the mapped memory without CPU intervention; some devices and associated network stacks require the memory to be registered to send and receive data.

func (*UcpContext) MemoryTypesMask

func (c *UcpContext) MemoryTypesMask() (uint64, error)

Mask which memory types are supported

func (*UcpContext) NewWorker

func (c *UcpContext) NewWorker(workerParams *UcpWorkerParams) (*UcpWorker, error)

This routine creates new UcpWorker.

func (*UcpContext) Query

func (c *UcpContext) Query(attrs ...UcpContextAttr) (*C.ucp_context_attr_t, error)

This routine fetches information about the context.

type UcpContextAttr

type UcpContextAttr uint32
const (
	UCP_ATTR_FIELD_REQUEST_SIZE UcpContextAttr = C.UCP_ATTR_FIELD_REQUEST_SIZE
	UCP_ATTR_FIELD_THREAD_MODE  UcpContextAttr = C.UCP_ATTR_FIELD_THREAD_MODE
	UCP_ATTR_FIELD_MEMORY_TYPES UcpContextAttr = C.UCP_ATTR_FIELD_MEMORY_TYPES
	UCP_ATTR_FIELD_NAME         UcpContextAttr = C.UCP_ATTR_FIELD_NAME
)

type UcpEp

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

func (*UcpEp) CloseNonBlocking

func (e *UcpEp) CloseNonBlocking(mode C.uint, params *UcpRequestParams) (*UcpRequest, error)

func (*UcpEp) CloseNonBlockingFlush

func (e *UcpEp) CloseNonBlockingFlush(params *UcpRequestParams) (*UcpRequest, error)

Non-blocking endpoint close. Schedules flushes on all outstanding operations.

func (*UcpEp) CloseNonBlockingForce

func (e *UcpEp) CloseNonBlockingForce(params *UcpRequestParams) (*UcpRequest, error)

Non-blocking endpoint closure. Releases the endpoint without any confirmation from the peer. All outstanding requests will be completed with UCS_ERR_CANCELED error.

func (*UcpEp) FlushNonBlocking

func (e *UcpEp) FlushNonBlocking(params *UcpRequestParams) (*UcpRequest, error)

This routine flushes all outstanding AMO and RMA communications on the endpoint. All the AMO and RMA operations issued on the ep prior to this call are completed both at the origin and at the target endpoint when this call returns.

func (*UcpEp) SendAmNonBlocking

func (e *UcpEp) SendAmNonBlocking(id uint, header unsafe.Pointer, headerSize uint64,
	data unsafe.Pointer, dataSize uint64, flags UcpAmSendFlags, params *UcpRequestParams) (*UcpRequest, error)

This routine sends an Active Message to an ep. Sending only header without actual data is allowed and is recommended for transferring a latency-critical amount of data. The maximum allowed header size can be obtained by querying worker attributes by the UcpWorker.Query() routine.

func (*UcpEp) SendTagNonBlocking

func (e *UcpEp) SendTagNonBlocking(tag uint64, address unsafe.Pointer, size uint64,
	params *UcpRequestParams) (*UcpRequest, error)

This routine sends a messages that is described by the local address and size to the destination endpoint. Each message is associated with a tag value that is used for message matching on the UcpWorker.RecvTagNonBlocking "receiver". The routine is non-blocking and therefore returns immediately, however the actual send operation may be delayed. The send operation is considered completed when it is safe to reuse the source buffer.

type UcpEpErrHandler

type UcpEpErrHandler func(ep *UcpEp, status UcsStatus)

This callback routine is invoked when transport level error detected. ep - Endpoint to handle transport level error. Upon return from the callback, this endpoint is no longer usable and all subsequent operations on this ep will fail with the error code passed in status.

type UcpEpParams

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

Tuning parameters for the UCP endpoint.

func (*UcpEpParams) SendClientId

func (p *UcpEpParams) SendClientId() *UcpEpParams

Send client id when connecting to remote socket address as part of the connection request payload. On the remote side value can be obtained by calling UcpConnectionRequest.Query(UCP_CONN_REQUEST_ATTR_FIELD_CLIENT_ID)

func (*UcpEpParams) SetConnRequest

func (p *UcpEpParams) SetConnRequest(c *UcpConnectionRequest) *UcpEpParams

Connection request from client; means that this type of the endpoint creation is possible only on server side in client-server connection establishment flow.

func (*UcpEpParams) SetErrorHandler

func (p *UcpEpParams) SetErrorHandler(errHandler UcpEpErrHandler) *UcpEpParams

Handler to process transport level failure.

func (*UcpEpParams) SetName

func (p *UcpEpParams) SetName(name string) *UcpEpParams

Tracing and analysis tools can identify the endpoint using this name.

func (*UcpEpParams) SetPeerErrorHandling

func (p *UcpEpParams) SetPeerErrorHandling() *UcpEpParams

Guarantees that send requests are always completed (successfully or error) even in case of remote failure, disables protocols and APIs which may cause a hang or undefined behavior in case of peer failure, may affect performance and memory footprint

func (*UcpEpParams) SetSocketAddress

func (p *UcpEpParams) SetSocketAddress(a *net.TCPAddr) (*UcpEpParams, error)

Destination address in the form of a sockaddr; means that this type of the endpoint creation is possible only on client side in client-server connection establishment flow.

func (*UcpEpParams) SetUcpAddress

func (p *UcpEpParams) SetUcpAddress(a *UcpAddress) *UcpEpParams

Destination address

type UcpListener

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

func (*UcpListener) Close

func (l *UcpListener) Close()

func (*UcpListener) Query

type UcpListenerAttribute

type UcpListenerAttribute uint32
const (
	UCP_LISTENER_ATTR_FIELD_SOCKADDR UcpListenerAttribute = C.UCP_LISTENER_ATTR_FIELD_SOCKADDR
)

type UcpListenerAttributes

type UcpListenerAttributes struct {
	Address *net.TCPAddr
}

type UcpListenerConnectionHandler

type UcpListenerConnectionHandler = func(connRequest *UcpConnectionRequest)

This callback routine is invoked on the server side to handle incoming connections from remote clients.

type UcpListenerParams

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

Tuning parameters for the UCP listener.

func (*UcpListenerParams) SetConnectionHandler

func (p *UcpListenerParams) SetConnectionHandler(connHandler UcpListenerConnectionHandler) *UcpListenerParams

Handler of an incoming connection request in a client-server connection flow.

func (*UcpListenerParams) SetSocketAddress

func (p *UcpListenerParams) SetSocketAddress(a *net.TCPAddr) (*UcpListenerParams, error)

Destination address

type UcpMemAttribute

type UcpMemAttribute uint32
const (
	UCP_MEM_ATTR_FIELD_ADDRESS  UcpMemAttribute = C.UCP_MEM_ATTR_FIELD_ADDRESS
	UCP_MEM_ATTR_FIELD_LENGTH   UcpMemAttribute = C.UCP_MEM_ATTR_FIELD_LENGTH
	UCP_MEM_ATTR_FIELD_MEM_TYPE UcpMemAttribute = C.UCP_MEM_ATTR_FIELD_MEM_TYPE
)

type UcpMemAttributes

type UcpMemAttributes struct {

	// Address of the memory segment.
	Address unsafe.Pointer

	// Size of the memory segment.
	Length uint64

	// Type of allocated or registered memory
	MemType UcsMemoryType
}

type UcpMemory

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

Memory handle is an opaque object representing a memory region allocated through UCP library, which is optimized for remote memory access operations (zero-copy operations). The memory could be registered to one or multiple network resources that are supported by UCP, such as InfiniBand, Gemini, and others.

func (*UcpMemory) Close

func (m *UcpMemory) Close() error

func (*UcpMemory) Query

func (m *UcpMemory) Query(attrs ...UcpMemAttribute) (*UcpMemAttributes, error)

This routine returns address and length of memory segment mapped with UcpContext.MemMap routine.

type UcpMmapParams

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

Tuning parameters for the UCP memory mapping.

func (*UcpMmapParams) Allocate

func (p *UcpMmapParams) Allocate() *UcpMmapParams

Identify requirement for allocation, if passed address is not a null-pointer then it will be used as a hint or direct address for allocation.

func (*UcpMmapParams) Fixed

func (p *UcpMmapParams) Fixed() *UcpMmapParams

Don't interpret address as a hint: place the mapping at exactly that address. The address must be a multiple of the page size.

func (*UcpMmapParams) Nonblocking

func (p *UcpMmapParams) Nonblocking() *UcpMmapParams

Complete the registration faster, possibly by not populating the pages up-front, and mapping them later when they are accessed by communication routines.

func (*UcpMmapParams) SetAddress

func (p *UcpMmapParams) SetAddress(address unsafe.Pointer) *UcpMmapParams

If the address is not NULL, the routine maps (registers) the memory segment pointed to by this address. If the pointer is NULL, the library allocates mapped (registered) memory segment and returns its address in this argument.

func (*UcpMmapParams) SetLength

func (p *UcpMmapParams) SetLength(length uint64) *UcpMmapParams

Length (in bytes) to allocate or map (register).

func (*UcpMmapParams) SetMemoryType

func (p *UcpMmapParams) SetMemoryType(memType UcsMemoryType) *UcpMmapParams

Memory type (for possible memory types see UcsMemoryType) It is an optimization hint to avoid memory type detection for map buffer. The meaning of this field depends on the operation type.

  • Memory allocation: (UcpMmapParams.Allocate() is set) This field specifies the type of memory to allocate. If it's not set UCS_MEMORY_TYPE_HOST will be assumed by default.
  • Memory registration: This field specifies the type of memory which is pointed by UcpMmapParams.SetAddress(). If it's not set, or set to UCS_MEMORY_TYPE_UNKNOWN, the memory type will be detected internally.

func (*UcpMmapParams) SetProtection

func (p *UcpMmapParams) SetProtection(prot UcpProtection) *UcpMmapParams

Memory protection mode, e.g. UCP_MEM_MAP_PROT_LOCAL_READ This value is optional. If it's not set, the UcpContext.Mmap routine will consider the flags as set to UCP_MEM_MAP_PROT_LOCAL_READ|UCP_MEM_MAP_PROT_LOCAL_WRITE| UCP_MEM_MAP_PROT_REMOTE_READ|UCP_MEM_MAP_PROT_REMOTE_WRITE.

type UcpParams

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

Tuning parameters for UCP library. The structure defines the parameters that are used for UCP library tuning during UCP library "initialization".

UCP library implementation uses the "features" parameter to optimize the library functionality that minimize memory footprint. For example, if the application does not require send/receive semantics UCP library may avoid allocation of expensive resources associated with send/receive queues.

func (*UcpParams) EnableAM

func (p *UcpParams) EnableAM() *UcpParams

Request Active Message support feature.

func (*UcpParams) EnableAtomic32Bit

func (p *UcpParams) EnableAtomic32Bit() *UcpParams

Request 32-bit atomic operations support.

func (*UcpParams) EnableAtomic64Bit

func (p *UcpParams) EnableAtomic64Bit() *UcpParams

Request 64-bit atomic operations support.

func (*UcpParams) EnableRMA

func (p *UcpParams) EnableRMA() *UcpParams

Request remote memory access support.

func (*UcpParams) EnableSharedWorkers

func (p *UcpParams) EnableSharedWorkers() *UcpParams

Indicates if this context is shared by multiple workers from different threads. If so, this context needs thread safety support; otherwise, the context does not need to provide thread safety. For example, if the context is used by single worker, and that worker is shared by multiple threads, this context does not need thread safety; if the context is used by worker 1 and worker 2, and worker 1 is used by thread 1 and worker 2 is used by thread 2, then this context needs thread safety. Note that actual thread mode may be different from mode passed to UcpContext.

func (*UcpParams) EnableStream

func (p *UcpParams) EnableStream() *UcpParams

Request stream support.

func (*UcpParams) EnableTag

func (p *UcpParams) EnableTag() *UcpParams

Request tag matching support.

func (*UcpParams) EnableWakeup

func (p *UcpParams) EnableWakeup() *UcpParams

Request interrupt notification support.

func (*UcpParams) SetEstimatedNumEPS

func (p *UcpParams) SetEstimatedNumEPS(estimatedNumEPS uint64) *UcpParams

An optimization hint of how many endpoints would be created on this context. Does not affect semantics, but only transport selection criteria and the resulting performance. The value can be also set by UCX_NUM_EPS environment variable. In such case it will override the number of endpoints set by this method.

func (*UcpParams) SetEstimatedNumPPN

func (p *UcpParams) SetEstimatedNumPPN(estimatedNumPPN uint64) *UcpParams

An optimization hint for a single node. For example, when used from MPI or OpenSHMEM libraries, this number will specify the number of Processes Per Node (PPN) in the job. Does not affect semantics, only transport selection criteria and the resulting performance. The value can be also set by the UCX_NUM_PPN environment variable, which will override the number of endpoints set by this method.

func (*UcpParams) SetName

func (p *UcpParams) SetName(name string) *UcpParams

Tracing and analysis tools can identify the context using this name.

func (*UcpParams) SetTagSenderMask

func (p *UcpParams) SetTagSenderMask(tagSenderMask uint64) *UcpParams

Mask which specifies particular bits of the tag which can uniquely identify the sender (UCP endpoint) in tagged operations. This field defaults to 0 if not specified.

type UcpProtection

type UcpProtection uint32
const (
	UCP_MEM_MAP_PROT_LOCAL_READ   UcpProtection = C.UCP_MEM_MAP_PROT_LOCAL_READ
	UCP_MEM_MAP_PROT_LOCAL_WRITE  UcpProtection = C.UCP_MEM_MAP_PROT_LOCAL_WRITE
	UCP_MEM_MAP_PROT_REMOTE_READ  UcpProtection = C.UCP_MEM_MAP_PROT_REMOTE_READ
	UCP_MEM_MAP_PROT_REMOTE_WRITE UcpProtection = C.UCP_MEM_MAP_PROT_REMOTE_WRITE
)

type UcpRequest

type UcpRequest struct {
	Status UcsStatus
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(request C.ucs_status_ptr_t, callbackId uint64, immidiateInfo interface{}) (*UcpRequest, error)

func (*UcpRequest) Close

func (r *UcpRequest) Close()

This routine releases the non-blocking request back to the library, regardless of its current state. Communications operations associated with this request will make progress internally, however no further notifications or callbacks will be invoked for this request.

func (*UcpRequest) GetStatus

func (r *UcpRequest) GetStatus() UcsStatus

This routine checks the state of the request and returns its current status. Any value different from UCS_INPROGRESS means that request is in a completed state.

type UcpRequestParams

type UcpRequestParams struct {
	Cb UcpCallback
	// contains filtered or unexported fields
}

func (*UcpRequestParams) SetCallback

func (p *UcpRequestParams) SetCallback(cb UcpCallback) *UcpRequestParams

func (*UcpRequestParams) SetMemType

func (p *UcpRequestParams) SetMemType(memType UcsMemoryType) *UcpRequestParams

type UcpSendCallback

type UcpSendCallback = func(request *UcpRequest, status UcsStatus)

type UcpTagRecvCallback

type UcpTagRecvCallback = func(request *UcpRequest, status UcsStatus, tagInfo *UcpTagRecvInfo)

type UcpTagRecvInfo

type UcpTagRecvInfo struct {
	SenderTag uint64
	Length    uint64
}

type UcpWakeupEvent

type UcpWakeupEvent uint32
const (
	UCP_WAKEUP_RMA      UcpWakeupEvent = C.UCP_WAKEUP_RMA
	UCP_WAKEUP_AMO      UcpWakeupEvent = C.UCP_WAKEUP_AMO
	UCP_WAKEUP_TAG_SEND UcpWakeupEvent = C.UCP_WAKEUP_TAG_SEND
	UCP_WAKEUP_TAG_RECV UcpWakeupEvent = C.UCP_WAKEUP_TAG_RECV
	UCP_WAKEUP_TX       UcpWakeupEvent = C.UCP_WAKEUP_TX
	UCP_WAKEUP_RX       UcpWakeupEvent = C.UCP_WAKEUP_RX
	UCP_WAKEUP_EDGE     UcpWakeupEvent = C.UCP_WAKEUP_EDGE
)

type UcpWorker

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

UCP worker is an opaque object representing the communication context. The worker represents an instance of a local communication resource and the progress engine associated with it. The progress engine is a construct that is responsible for asynchronous and independent progress of communication directives. The progress engine could be implemented in hardware or software. The worker object abstracts an instance of network resources such as a host channel adapter port, network interface, or multiple resources such as multiple network interfaces or communication ports. It could also represent virtual communication resources that are defined across multiple devices. Although the worker can represent multiple network resources, it is associated with a single UcpContext "UCX application context". All communication functions require a context to perform the operation on the dedicated hardware resource(s) and an "endpoint" to address the destination.

Worker are parallel "threading points" that an upper layer may use to optimize concurrent communications.

func (*UcpWorker) Arm

func (w *UcpWorker) Arm() UcsStatus

This routine needs to be called before waiting on each notification on this worker, so will typically be called once the processing of the previous event is over, as part of the wake-up mechanism.

The worker must be armed before waiting on an event (must be re-armed after it has been signaled for re-use) with UcpWorker.Arm(). The events triggering a signal of the file descriptor from UcpWorker.GetEfd() depend on the interfaces used by the worker and defined in the transport layer, and typically represent a request completion or newly available resources. It can also be triggered by calling UcpWorker.Signal().

The file descriptor is guaranteed to become signaled only if new communication events occur on the worker. Therefore one must drain all existing events before waiting on the file descriptor. This can be achieved by calling UcpWorker.Progress() repeatedly until it returns 0.

func (*UcpWorker) Close

func (w *UcpWorker) Close()

func (*UcpWorker) GetAddress

func (w *UcpWorker) GetAddress() (*UcpAddress, error)

This routine returns the address of the worker object. This address can be passed to remote instances of the UCP library in order to connect to this worker. Ucp worker address - is an opaque object that is used as an identifier for a UcpWorker instance.

func (*UcpWorker) GetEfd

func (w *UcpWorker) GetEfd() (int, error)

This routine returns a valid file descriptor for polling functions. The file descriptor will get signaled when an event occurs, as part of the wake-up mechanism. Signaling means a call to poll() or select() with this file descriptor will return at this point, with this descriptor marked as the reason (or one of the reasons) the function has returned. The user does not need to release the obtained file descriptor.

The wake-up mechanism exists to allow for the user process to register for notifications on events of the underlying interfaces, and wait until such occur. This is an alternative to repeated polling for request completion. The goal is to allow for waiting while consuming minimal resources from the system. This is recommended for cases where traffic is infrequent, and latency can be traded for lower resource consumption while waiting for it.

There are two alternative ways to use the wakeup mechanism: the first is the file descriptor obtained per worker (this function) and the second is the UcpWorker.Wait() function for waiting on the next event internally.

func (*UcpWorker) NewEndpoint

func (w *UcpWorker) NewEndpoint(epParams *UcpEpParams) (*UcpEp, error)

This routine creates new UcpEndpoint.

func (*UcpWorker) NewListener

func (w *UcpWorker) NewListener(listenerParams *UcpListenerParams) (*UcpListener, error)

This routine creates new UcpListener.

func (*UcpWorker) Progress

func (w *UcpWorker) Progress() uint

This routine explicitly progresses all communication operations on a worker. Typically, request wait and test routines call UcpWorker.Progress() "this routine" to progress any outstanding operations. Transport layers, implementing asynchronous progress using threads, require callbacks and other user code to be thread safe. The state of communication can be advanced (progressed) by blocking routines. Nevertheless, the non-blocking routines can not be used for communication progress.

func (*UcpWorker) Query

func (w *UcpWorker) Query(attrs ...UcpWorkerAttribute) (*UcpWorkerAttributes, error)

func (*UcpWorker) RecvAmDataNonBlocking

func (w *UcpWorker) RecvAmDataNonBlocking(dataDesc *UcpAmData, recvBuffer unsafe.Pointer, size uint64,
	params *UcpRequestParams) (*UcpRequest, error)

Receive Active Message as defined by provided data descriptor.

func (*UcpWorker) RecvTagNonBlocking

func (w *UcpWorker) RecvTagNonBlocking(address unsafe.Pointer, size uint64,
	tag uint64, tagMask uint64, params *UcpRequestParams) (*UcpRequest, error)

This routine receives a message that is described by the local address and size on the worker. The tag value of the receive message has to match thetag and tagMask values, where the tagMask indicates what bits of the tag have to be matched. The routine is a non-blocking and therefore returns immediately. The receive operation is considered completed when the message is delivered to the buffer. In order to notify the application about completion of the receive operation the UCP library will invoke the call-back when the received message is in the receive buffer and ready for application access. If the receive operation cannot be stated the routine returns an error.

func (*UcpWorker) SetAmRecvHandler

func (w *UcpWorker) SetAmRecvHandler(id uint, flags UcpAmCbFlags, cb UcpAmRecvCallback) error

This routine installs a user defined callback to handle incoming Active Messages with a specific id. This callback is called whenever an Active Message that was sent from the remote peer by UcpEndpoint.SendAm is received on this worker.

func (*UcpWorker) Signal

func (w *UcpWorker) Signal() error

This routine signals that the event has happened, as part of the wake-up mechanism. This function causes a blocking call to UcpWorker.Wait() or waiting on a file descriptor from UcpWorker.GetEfd() to return, even if no event from the underlying interfaces has taken place.

func (*UcpWorker) Wait

func (w *UcpWorker) Wait() error

This routine waits (blocking) until an event has happened, as part of the wake-up mechanism.

This function is guaranteed to return only if new communication events occur on the UcpWorker. Therefore one must drain all existing events before waiting on the file descriptor. This can be achieved by calling UcpWorker.Progress() repeatedly until it returns 0.

There are two alternative ways to use the wakeup mechanism. The first is by polling on a per-worker file descriptor obtained from UcpWorker.GetEfd(). The second is by using this function to perform an internal wait for the next event associated with the specified worker.

@note During the blocking call the wake-up mechanism relies on other means of notification and may not progress some of the requests as it would when calling UcpWorker.Progress() (which is not invoked in that duration).

type UcpWorkerAttribute

type UcpWorkerAttribute uint32
const (
	UCP_WORKER_ATTR_FIELD_THREAD_MODE     UcpWorkerAttribute = C.UCP_WORKER_ATTR_FIELD_THREAD_MODE
	UCP_WORKER_ATTR_FIELD_ADDRESS         UcpWorkerAttribute = C.UCP_WORKER_ATTR_FIELD_ADDRESS
	UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS   UcpWorkerAttribute = C.UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS
	UCP_WORKER_ATTR_FIELD_MAX_AM_HEADER   UcpWorkerAttribute = C.UCP_WORKER_ATTR_FIELD_MAX_AM_HEADER
	UCP_WORKER_ATTR_FIELD_NAME            UcpWorkerAttribute = C.UCP_WORKER_ATTR_FIELD_NAME
	UCP_WORKER_ATTR_FIELD_MAX_INFO_STRING UcpWorkerAttribute = C.UCP_WORKER_ATTR_FIELD_MAX_INFO_STRING
)

type UcpWorkerAttributes

type UcpWorkerAttributes struct {
	ThreadMode     UcsThreadMode
	Address        *UcpAddress
	MaxAmHeader    uint64
	MaxDebugString uint64
}

type UcpWorkerParams

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

Tuning parameters for the UCP worker.

func (*UcpWorkerParams) SetAmAlignment

func (p *UcpWorkerParams) SetAmAlignment(alignment uint64) *UcpWorkerParams

Minimal address alignment of the active message data pointer as passed in argument data to the active message handle

func (*UcpWorkerParams) SetClientId

func (p *UcpWorkerParams) SetClientId(clientId uint64) *UcpWorkerParams

Client id that is sent as part of the connection request payload when connecting to a remote socket address. On the remote side, this value can be obtained by calling UcpConnectionRequest.Query(UCP_CONN_REQUEST_ATTR_FIELD_CLIENT_ID)

func (*UcpWorkerParams) SetCpuMask

func (p *UcpWorkerParams) SetCpuMask(mask *big.Int) *UcpWorkerParams

Mask of which CPUs worker resources should preferably be allocated on. This value is optional. If it's not set, resources are allocated according to system's default policy.

func (*UcpWorkerParams) SetEventFD

func (p *UcpWorkerParams) SetEventFD(fd uintptr) *UcpWorkerParams

External event file descriptor. Events on the worker will be reported on the provided event file descriptor. The provided file descriptor must be capable of aggregating notifications for arbitrary events, for example epoll(7) on Linux systems. userData will be used as the event user-data on systems which support it. For example, on Linux, it will be placed in epoll_data_t::ptr, when returned from epoll_wait(2). Otherwise, events would be reported to the event file descriptor returned from UcpWorker.GetEfd().

func (*UcpWorkerParams) SetName

func (p *UcpWorkerParams) SetName(name string) *UcpWorkerParams

Tracing and analysis tools can identify the worker using this name.

func (*UcpWorkerParams) SetThreadMode

func (p *UcpWorkerParams) SetThreadMode(threadMode UcsThreadMode) *UcpWorkerParams

The parameter thread_mode suggests the thread safety mode which worker and the associated resources should be created with. This is an optional parameter. The default value is UCS_THREAD_MODE_SINGLE and it is used when the value of the parameter is not set. When this parameter is set, the UcpContext.NewWorker() attempts to create worker with this thread mode. The thread mode with which worker is created can differ from the suggested mode. The actual thread mode of the worker should be obtained using the query interface UcpWorker.Query().

func (*UcpWorkerParams) SetUserData

func (p *UcpWorkerParams) SetUserData(data []byte) *UcpWorkerParams

User data associated with the current worker.

func (*UcpWorkerParams) SetWakeupEvent

func (p *UcpWorkerParams) SetWakeupEvent(event UcpWakeupEvent) *UcpWorkerParams

Mask of events (UcpWakeupEvent) which are expected on wakeup. This value is optional. If it's not set, all types of events will trigger on wakeup.

func (*UcpWorkerParams) WakeupAMO

func (p *UcpWorkerParams) WakeupAMO() *UcpWorkerParams

Wakeup on atomic operation send completion.

func (*UcpWorkerParams) WakeupEdge

func (p *UcpWorkerParams) WakeupEdge() *UcpWorkerParams

Use edge-triggered wakeup. The event file descriptor will be signaled only for new events, rather than existing ones.

func (*UcpWorkerParams) WakeupRMA

func (p *UcpWorkerParams) WakeupRMA() *UcpWorkerParams

Wakeup on remote memory access send completion.

func (*UcpWorkerParams) WakeupRX

func (p *UcpWorkerParams) WakeupRX() *UcpWorkerParams

This event type will generate an event on completion of any receive operation (complete or partial, according to the underlying protocol).

func (*UcpWorkerParams) WakeupTX

func (p *UcpWorkerParams) WakeupTX() *UcpWorkerParams

This event type will generate an event on completion of any outgoing operation (complete or partial, according to the underlying protocol) for any type of transfer (send, atomic, or RMA).

func (*UcpWorkerParams) WakeupTagRecv

func (p *UcpWorkerParams) WakeupTagRecv() *UcpWorkerParams

Wakeup on tag recv completion.

func (*UcpWorkerParams) WakeupTagSend

func (p *UcpWorkerParams) WakeupTagSend() *UcpWorkerParams

Wakeup on tag send completion.

type UcsMemoryType

type UcsMemoryType int
const (
	UCS_MEMORY_TYPE_HOST         UcsMemoryType = C.UCS_MEMORY_TYPE_HOST         /**< Default system memory */
	UCS_MEMORY_TYPE_CUDA         UcsMemoryType = C.UCS_MEMORY_TYPE_CUDA         /**< NVIDIA CUDA memory */
	UCS_MEMORY_TYPE_CUDA_MANAGED UcsMemoryType = C.UCS_MEMORY_TYPE_CUDA_MANAGED /**< NVIDIA CUDA managed (or unified) memory */
	UCS_MEMORY_TYPE_ROCM         UcsMemoryType = C.UCS_MEMORY_TYPE_ROCM         /**< AMD ROCM memory */
	UCS_MEMORY_TYPE_ROCM_MANAGED UcsMemoryType = C.UCS_MEMORY_TYPE_ROCM_MANAGED /**< AMD ROCM managed system memory */
	UCS_MEMORY_TYPE_UNKNOWN      UcsMemoryType = C.UCS_MEMORY_TYPE_UNKNOWN
)

func (UcsMemoryType) String

func (m UcsMemoryType) String() string

type UcsStatus

type UcsStatus int
const (
	UCS_OK                         UcsStatus = C.UCS_OK
	UCS_INPROGRESS                 UcsStatus = C.UCS_INPROGRESS
	UCS_ERR_NO_MESSAGE             UcsStatus = C.UCS_ERR_NO_MESSAGE
	UCS_ERR_NO_RESOURCE            UcsStatus = C.UCS_ERR_NO_RESOURCE
	UCS_ERR_IO_ERROR               UcsStatus = C.UCS_ERR_IO_ERROR
	UCS_ERR_NO_MEMORY              UcsStatus = C.UCS_ERR_NO_MEMORY
	UCS_ERR_INVALID_PARAM          UcsStatus = C.UCS_ERR_INVALID_PARAM
	UCS_ERR_UNREACHABLE            UcsStatus = C.UCS_ERR_UNREACHABLE
	UCS_ERR_INVALID_ADDR           UcsStatus = C.UCS_ERR_INVALID_ADDR
	UCS_ERR_NOT_IMPLEMENTED        UcsStatus = C.UCS_ERR_NOT_IMPLEMENTED
	UCS_ERR_MESSAGE_TRUNCATED      UcsStatus = C.UCS_ERR_MESSAGE_TRUNCATED
	UCS_ERR_NO_PROGRESS            UcsStatus = C.UCS_ERR_NO_PROGRESS
	UCS_ERR_BUFFER_TOO_SMALL       UcsStatus = C.UCS_ERR_BUFFER_TOO_SMALL
	UCS_ERR_NO_ELEM                UcsStatus = C.UCS_ERR_NO_ELEM
	UCS_ERR_SOME_CONNECTS_FAILED   UcsStatus = C.UCS_ERR_SOME_CONNECTS_FAILED
	UCS_ERR_NO_DEVICE              UcsStatus = C.UCS_ERR_NO_DEVICE
	UCS_ERR_BUSY                   UcsStatus = C.UCS_ERR_BUSY
	UCS_ERR_CANCELED               UcsStatus = C.UCS_ERR_CANCELED
	UCS_ERR_SHMEM_SEGMENT          UcsStatus = C.UCS_ERR_SHMEM_SEGMENT
	UCS_ERR_ALREADY_EXISTS         UcsStatus = C.UCS_ERR_ALREADY_EXISTS
	UCS_ERR_OUT_OF_RANGE           UcsStatus = C.UCS_ERR_OUT_OF_RANGE
	UCS_ERR_TIMED_OUT              UcsStatus = C.UCS_ERR_TIMED_OUT
	UCS_ERR_EXCEEDS_LIMIT          UcsStatus = C.UCS_ERR_EXCEEDS_LIMIT
	UCS_ERR_UNSUPPORTED            UcsStatus = C.UCS_ERR_UNSUPPORTED
	UCS_ERR_REJECTED               UcsStatus = C.UCS_ERR_REJECTED
	UCS_ERR_NOT_CONNECTED          UcsStatus = C.UCS_ERR_NOT_CONNECTED
	UCS_ERR_CONNECTION_RESET       UcsStatus = C.UCS_ERR_CONNECTION_RESET
	UCS_ERR_FIRST_LINK_FAILURE     UcsStatus = C.UCS_ERR_FIRST_LINK_FAILURE
	UCS_ERR_LAST_LINK_FAILURE      UcsStatus = C.UCS_ERR_LAST_LINK_FAILURE
	UCS_ERR_FIRST_ENDPOINT_FAILURE UcsStatus = C.UCS_ERR_FIRST_ENDPOINT_FAILURE
	UCS_ERR_ENDPOINT_TIMEOUT       UcsStatus = C.UCS_ERR_ENDPOINT_TIMEOUT
	UCS_ERR_LAST_ENDPOINT_FAILURE  UcsStatus = C.UCS_ERR_LAST_ENDPOINT_FAILURE
	UCS_ERR_LAST                   UcsStatus = C.UCS_ERR_LAST
)

func (UcsStatus) String

func (m UcsStatus) String() string

type UcsThreadMode

type UcsThreadMode int
const (
	UCS_THREAD_MODE_SINGLE     UcsThreadMode = C.UCS_THREAD_MODE_SINGLE
	UCS_THREAD_MODE_SERIALIZED UcsThreadMode = C.UCS_THREAD_MODE_SERIALIZED
	UCS_THREAD_MODE_MULTI      UcsThreadMode = C.UCS_THREAD_MODE_MULTI
)

type UcxError

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

func (*UcxError) Error

func (e *UcxError) Error() string

func (*UcxError) GetStatus

func (e *UcxError) GetStatus() UcsStatus

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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