LCI
lci.h File Reference

Header file for all LCI code. More...

#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include "lci_config.h"
Include dependency graph for lci.h:

Go to the source code of this file.

Classes

struct  LCI_lbuffer_t
 LCI long communication buffer. More...
 
struct  LCI_mbuffer_t
 LCI medium communication buffer. More...
 
union  LCI_short_t
 LCI short data. More...
 
struct  LCI_iovec_t
 LCI iovec, which is comprised of a piggyback buffer and multiple long buffers. More...
 
union  LCI_data_t
 A generic type for communication buffers. More...
 
struct  LCI_request_t
 Request object. Completion mechanisms will write completion information to it. More...
 

Macros

#define LCI_API   __attribute__((visibility("default")))
 
#define LCI_DEFAULT_COMP_REMOTE   0
 
#define LCI_SEGMENT_ALL   NULL
 
#define LCI_RANK_ANY   (-1)
 
#define LCI_SHORT_SIZE   32
 The size of LCI short data. More...
 

Typedefs

typedef uint32_t LCI_tag_t
 Tag type. More...
 
typedef void * LCI_comp_t
 LCI generic completion type. More...
 
typedef struct LCII_mr_t * LCI_segment_t
 LCI memory segment. More...
 
typedef struct LCI_lbuffer_t LCI_lbuffer_t
 
typedef struct LCI_mbuffer_t LCI_mbuffer_t
 
typedef struct LCI_iovec_t LCI_iovec_t
 
typedef struct LCI_device_s * LCI_device_t
 The device type. More...
 
typedef struct LCI_endpoint_s * LCI_endpoint_t
 The endpoint type. More...
 
typedef struct LCI_plist_s * LCI_plist_t
 The property list type. More...
 
typedef void(* LCI_handler_t) (LCI_request_t request)
 The active message handler type. More...
 

Enumerations

enum  LCI_error_t {
  LCI_OK = 0, LCI_ERR_RETRY, LCI_ERR_RETRY_LOCK, LCI_ERR_RETRY_NOMEM,
  LCI_ERR_FEATURE_NA, LCI_ERR_FATAL
}
 LCI Error type. More...
 
enum  LCI_match_t { LCI_MATCH_RANKTAG = 0, LCI_MATCH_TAG }
 LCI Match type. Define the matching rule between sends and receives. More...
 
enum  LCI_port_t { LCI_PORT_COMMAND = 0, LCI_PORT_MESSAGE = 1 }
 LCI Port type. More...
 
enum  LCI_comp_type_t { LCI_COMPLETION_NONE = 0, LCI_COMPLETION_QUEUE, LCI_COMPLETION_HANDLER, LCI_COMPLETION_SYNC }
 LCI completion enumeration type. More...
 
enum  LCI_data_type_t { LCI_IMMEDIATE = 0, LCI_MEDIUM, LCI_LONG, LCI_IOVEC }
 LCI data type. More...
 

Functions

LCI_API LCI_error_t LCI_initialize ()
 Initialize the LCI runtime. No LCI calls are allowed to be called before LCI_initialize except LCI_initialized. More...
 
LCI_API LCI_error_t LCI_initialized (int *flag)
 Check whether the LCI runtime has been initialized. More...
 
LCI_API LCI_error_t LCI_finalize ()
 Finalize the LCI runtime. No LCI calls are allowed to be called after LCI_finalize except LCI_initialized. More...
 
LCI_API LCI_error_t LCI_barrier ()
 Invoke a barrier across all LCI processes in the same job. The call will block the calling thread until the barrier completes. This is not thread-safe. More...
 
LCI_API LCI_error_t LCI_device_init (LCI_device_t *device_ptr)
 Initialize a device. More...
 
LCI_API LCI_error_t LCI_device_free (LCI_device_t *device_ptr)
 Initialize a device. More...
 
LCI_API LCI_error_t LCI_plist_create (LCI_plist_t *plist_ptr)
 Create a property list. More...
 
LCI_API LCI_error_t LCI_plist_free (LCI_plist_t *plist_ptr)
 Free a property list. More...
 
LCI_API LCI_error_t LCI_plist_get (LCI_endpoint_t ep, LCI_plist_t *plist_ptr)
 Query the property list of an endpoint. More...
 
LCI_API LCI_error_t LCI_plist_decode (LCI_plist_t plist, char *string)
 Decode a property list into a string. More...
 
LCI_API LCI_error_t LCI_plist_set_match_type (LCI_plist_t plist, LCI_match_t match_type)
 Set the tag matching rule of the property list. More...
 
LCI_API LCI_error_t LCI_plist_set_comp_type (LCI_plist_t plist, LCI_port_t port, LCI_comp_type_t comp_type)
 Set the completion mechanism of the property list. More...
 
LCI_API LCI_error_t LCI_plist_set_default_comp (LCI_plist_t plist, LCI_comp_t comp)
 Set the default completion mechanism of the property list. The default completion mechanism will be triggered by a remote one-sided communication operation through LCI_DEFAULT_COMP_REMOTE. More...
 
LCI_API LCI_error_t LCI_endpoint_init (LCI_endpoint_t *ep_ptr, LCI_device_t device, LCI_plist_t plist)
 Create an endpoint according to a property list. More...
 
LCI_API LCI_error_t LCI_endpoint_free (LCI_endpoint_t *ep_ptr)
 Free an endpoint. More...
 
LCI_API LCI_error_t LCI_sends (LCI_endpoint_t ep, LCI_short_t src, int rank, LCI_tag_t tag)
 Send a short message (up to LCI_SHORT_SIZE bytes). The send buffer can be immediately reused. More...
 
LCI_API LCI_error_t LCI_sendm (LCI_endpoint_t ep, LCI_mbuffer_t buffer, int rank, LCI_tag_t tag)
 Send a medium message with a user-provided buffer (up to LCI_MEDIUM_SIZE bytes). The send buffer can be immediately reused. More...
 
LCI_API LCI_error_t LCI_sendmn (LCI_endpoint_t ep, LCI_mbuffer_t buffer, int rank, LCI_tag_t tag)
 Send a medium message with a LCI-provided buffer (allocated by LCI_mbuffer_alloc, up to LCI_MEDIUM_SIZE bytes). The send buffer will be directly returned to LCI if send succeeds so users should not use it anymore. More...
 
LCI_API LCI_error_t LCI_sendl (LCI_endpoint_t ep, LCI_lbuffer_t buffer, int rank, LCI_tag_t tag, LCI_comp_t completion, void *user_context)
 Send a long message with a user-provided buffer. The send buffer cannot be reused until the associated completion object marks this operation as completed. More...
 
LCI_API LCI_error_t LCI_recvs (LCI_endpoint_t ep, int rank, LCI_tag_t tag, LCI_comp_t completion, void *user_context)
 Receive a short message (up to LCI_SHORT_SIZE bytes). The received message will be delivered through the completion object. More...
 
LCI_API LCI_error_t LCI_recvm (LCI_endpoint_t ep, LCI_mbuffer_t buffer, int rank, LCI_tag_t tag, LCI_comp_t completion, void *user_context)
 Receive a medium message (up to LCI_MEDIUM_SIZE bytes) into a user-provided buffer. More...
 
LCI_API LCI_error_t LCI_recvmn (LCI_endpoint_t ep, int rank, LCI_tag_t tag, LCI_comp_t completion, void *user_context)
 Receive a medium message (up to LCI_MEDIUM_SIZE bytes) into a LCI-provided buffer. The receive buffer will be delivered to users through the completion object and should be returned to the runtime through LCI_mbuffer_free. More...
 
LCI_API LCI_error_t LCI_recvl (LCI_endpoint_t ep, LCI_lbuffer_t buffer, int rank, LCI_tag_t tag, LCI_comp_t completion, void *user_context)
 Receive a long message into a user-provided buffer. More...
 
LCI_API LCI_error_t LCI_puts (LCI_endpoint_t ep, LCI_short_t src, int rank, LCI_tag_t tag, uintptr_t remote_completion)
 Send a short message (up to LCI_SHORT_SIZE bytes). The send buffer can be immediately reused. On the receive side, No receive needs to be posted and the data will be delivered through the remote completion object. More...
 
LCI_API LCI_error_t LCI_putma (LCI_endpoint_t ep, LCI_mbuffer_t buffer, int rank, LCI_tag_t tag, uintptr_t remote_completion)
 Send a medium message with a user-provided buffer (up to LCI_MEDIUM_SIZE bytes). The send buffer can be immediately reused. On the receive side, No receive needs to be posted and the data will be delivered through the remote completion object. More...
 
LCI_API LCI_error_t LCI_putmna (LCI_endpoint_t ep, LCI_mbuffer_t buffer, int rank, LCI_tag_t tag, uintptr_t remote_completion)
 Send a medium message with a LCI-provided buffer (allocated by LCI_mbuffer_alloc, up to LCI_MEDIUM_SIZE bytes). The send buffer will be directly returned to LCI if send succeeds so users should not use it anymore. On the receive side, No receive needs to be posted and the data will be delivered through the remote completion object. More...
 
LCI_API LCI_error_t LCI_putla (LCI_endpoint_t ep, LCI_lbuffer_t buffer, LCI_comp_t completion, int rank, LCI_tag_t tag, uintptr_t remote_completion, void *user_context)
 Send a long message with a user-provided buffer. The send buffer cannot be reused until the associated completion object marks this operation as completed. On the receive side, No receive needs to be posted and the data will be delivered through the remote completion object. More...
 
LCI_API LCI_error_t LCI_putva (LCI_endpoint_t ep, LCI_iovec_t iovec, LCI_comp_t completion, int rank, LCI_tag_t tag, uintptr_t remote_completion, void *user_context)
 Send an iovec with user-provided buffers. The piggyback buffer can be immediately reused. The long buffers cannot be reused until the associated completion object marks this operation as completed. On the receive side, No receive needs to be posted and the data will be delivered through the remote completion object. More...
 
LCI_API size_t LCI_get_iovec_piggy_back_size (int count)
 Return the maximum size of the piggyback buffer in an iovec with given number of long buffers. More...
 
LCI_API LCI_error_t LCI_queue_create (LCI_device_t device, LCI_comp_t *cq)
 Create a completion queue. More...
 
LCI_API LCI_error_t LCI_queue_free (LCI_comp_t *cq)
 Free a completion queue. More...
 
LCI_API LCI_error_t LCI_queue_pop (LCI_comp_t cq, LCI_request_t *request)
 Pop one entry from the completion queue. This call is nonblocking. More...
 
LCI_API LCI_error_t LCI_queue_wait (LCI_comp_t cq, LCI_request_t *request)
 Pop one entry from the completion queue. This call will block the calling thread until there is an entry to be popped. More...
 
LCI_API LCI_error_t LCI_queue_pop_multiple (LCI_comp_t cq, size_t request_count, LCI_request_t *requests, size_t *return_count)
 Pop multiple entry from the completion queue. This call is nonblocking. More...
 
LCI_API LCI_error_t LCI_queue_wait_multiple (LCI_comp_t cq, size_t request_count, LCI_request_t *requests)
 Pop multiple entry from the completion queue.This call will block the calling thread until request_count entries has been popped. More...
 
LCI_API LCI_error_t LCI_queue_len (LCI_comp_t cq, size_t *len)
 Query the number of entries in a completion queue. More...
 
LCI_API LCI_error_t LCI_sync_create (LCI_device_t device, int threshold, LCI_comp_t *completion)
 Create a synchronizer. More...
 
LCI_API LCI_error_t LCI_sync_free (LCI_comp_t *completion)
 Free a synchronizer. More...
 
LCI_API LCI_error_t LCI_sync_signal (LCI_comp_t completion, LCI_request_t request)
 Signal a synchronizer once. A synchronizer needs to be signaled threshold time to be considered triggered. More...
 
LCI_API LCI_error_t LCI_sync_wait (LCI_comp_t completion, LCI_request_t request[])
 Wait for a synchronizer to be triggered. A synchronizer will be triggered if all the associated operations are completed. More...
 
LCI_API LCI_error_t LCI_sync_test (LCI_comp_t completion, LCI_request_t request[])
 Test whether a synchronizer has been triggered. A synchronizer will be triggered if all the associated operations are completed. More...
 
LCI_API LCI_error_t LCI_handler_create (LCI_device_t device, LCI_handler_t handler, LCI_comp_t *completion)
 Create an active message handler. More...
 
LCI_API LCI_error_t LCI_progress (LCI_device_t device)
 Make progress on the background works of a device. This function is not thread-safe. More...
 
LCI_API LCI_error_t LCI_memory_register (LCI_device_t device, void *address, size_t length, LCI_segment_t *segment)
 Register a memory region to a device. More...
 
LCI_API LCI_error_t LCI_memory_deregister (LCI_segment_t *segment)
 Deregister a memory region. More...
 
LCI_API LCI_error_t LCI_mbuffer_alloc (LCI_device_t device, LCI_mbuffer_t *mbuffer)
 Get a pre-registered memory buffer of size LCI_MEDIUM_SIZE. More...
 
LCI_API LCI_error_t LCI_mbuffer_free (LCI_mbuffer_t mbuffer)
 Return a pre-registered memory buffer to the LCI runtime. More...
 
LCI_API LCI_error_t LCI_lbuffer_alloc (LCI_device_t device, size_t size, LCI_lbuffer_t *lbuffer)
 Allocate a memory buffer of arbitrary size and register it. More...
 
LCI_API LCI_error_t LCI_lbuffer_memalign (LCI_device_t device, size_t size, size_t alignment, LCI_lbuffer_t *lbuffer)
 Allocate a memory buffer of arbitrary size with a specific alignment and register it. More...
 
LCI_API LCI_error_t LCI_lbuffer_free (LCI_lbuffer_t lbuffer)
 Deregister and free a memory buffer. More...
 

Variables

int LCI_NUM_PROCESSES
 The number of processes in this job. More...
 
int LCI_RANK
 The rank of the current process w.r.t the job. More...
 
int LCI_MAX_ENDPOINTS
 The maximum number of endpoints that can be created. More...
 
int LCI_MAX_TAG
 The largest allowed tag value. More...
 
int LCI_MEDIUM_SIZE
 The maximum size (in byte) of a buffer that can be used in medium messages. More...
 
int LCI_IOVEC_SIZE
 The maximum number of long buffers in an IO vector. More...
 
int LCI_DEFAULT_TABLE_LENGTH
 Initial number of entries in a default matching table. More...
 
int LCI_MAX_TABLE_LENGTH
 Maximum number of entries in a matching table. More...
 
int LCI_DEFAULT_QUEUE_LENGTH
 Initial number of entries in a default completion queue. More...
 
int LCI_MAX_QUEUE_LENGTH
 Maximum number of entries in a completion queue. More...
 
int LCI_MAX_SYNC_LENGTH
 Maximum number of request a synchronizer may be waiting for. More...
 
int LCI_PACKET_RETURN_THRESHOLD
 The packet returning threshold. More...
 
int LCI_IBV_USE_ODP
 Whether or what to use IBV on-demand paging. More...
 
int LCI_TOUCH_LBUFFER
 Whether touch every page of lbuffers allocated by LCI_lbuffer_alloc. More...
 
int LCI_USE_DREG
 Whether or what to use LCI-provided registration cache. More...
 
int LCI_IBV_USE_PREFETCH
 Whether or what to use IBV prefetch. More...
 
int LCI_PACKET_SIZE
 Size of each packet. More...
 
int LCI_SERVER_NUM_PKTS
 Total number of packets. More...
 
int LCI_SERVER_MAX_SENDS
 Server's send queue length. More...
 
int LCI_SERVER_MAX_RECVS
 Server's recv queue length. More...
 
int LCI_SERVER_MAX_CQES
 Server's completion queue length. More...
 
bool LCI_IBV_ENABLE_EVENT_POLLING_THREAD
 whether to enable ibv's event polling thread. More...
 
int LCI_SINGLE_THREAD_PROGRESS
 LCI_progress on the same device will not be called by multiple threads simultaneously. More...
 
int LCI_SEND_SLOW_DOWN_USEC
 Manually slow down LCI backend send function. More...
 
int LCI_RECV_SLOW_DOWN_USEC
 Manually slow down LCI backend recv function. More...
 
LCI_device_t LCI_UR_DEVICE
 Default device initialized by LCI_initialize. Just for convenience. More...
 
LCI_endpoint_t LCI_UR_ENDPOINT
 Default endpoint initialized by LCI_initialize. Just for convenience. More...
 
LCI_comp_t LCI_UR_CQ
 Default completion queue initialized by LCI_initialize. Just for convenience. More...
 

Detailed Description

Macro Definition Documentation

◆ LCI_API

#define LCI_API   __attribute__((visibility("default")))

◆ LCI_DEFAULT_COMP_REMOTE

#define LCI_DEFAULT_COMP_REMOTE   0

◆ LCI_RANK_ANY

#define LCI_RANK_ANY   (-1)

◆ LCI_SEGMENT_ALL

#define LCI_SEGMENT_ALL   NULL

Typedef Documentation

◆ LCI_iovec_t

typedef struct LCI_iovec_t LCI_iovec_t

◆ LCI_lbuffer_t

typedef struct LCI_lbuffer_t LCI_lbuffer_t

◆ LCI_mbuffer_t

typedef struct LCI_mbuffer_t LCI_mbuffer_t