#include <nm_public.h>
#include <nm_log.h>
#include <Padico/Puk.h>
#include <sys/uio.h>
#include <pthread.h>
Go to the source code of this file.
Data Structures | |
struct | nm_core_internal_s |
exposed here for inlining; do not use this value, use the accessor nm_core_get_singleton() More... | |
struct | nm_core_tag_s |
An internal tag. More... | |
struct | nm_core_event_s |
An event, generated by the NewMad core. More... | |
struct | nm_core_event_matching_s |
matching info for global monitors More... | |
struct | nm_monitor_s |
generic monitor, used for requests and for global events (with matching) More... | |
struct | nm_core_monitor_s |
global monitor for status transitions More... | |
struct | nm_chunk_s |
struct | nm_matching_container_s |
containers for matching info, used for caching More... | |
struct | nm_core_task_s |
asynchronous tasks for nmad core. More... | |
struct | nm_req_chunk_s |
a chunk of request More... | |
struct | nm_req_s |
a generic pack/unpack request More... | |
struct | nm_spinlock_s |
Macros | |
#define | NM_STATUS_NONE ((nm_status_t)0x00000000) |
empty request More... | |
#define | NM_STATUS_PACK_INIT ((nm_status_t)0x00000001) |
request initialized, not sent yet More... | |
#define | NM_STATUS_UNPACK_INIT ((nm_status_t)0x00000002) |
request initialized, not sent yet More... | |
#define | NM_STATUS_PACK_COMPLETED ((nm_status_t)0x00000004) |
sending operation has completed More... | |
#define | NM_STATUS_UNPACK_COMPLETED ((nm_status_t)0x00000008) |
unpack operation has completed More... | |
#define | NM_STATUS_UNEXPECTED ((nm_status_t)0x00000010) |
data or rdv has arrived, with no matching unpack More... | |
#define | NM_STATUS_UNPACK_CANCELLED ((nm_status_t)0x00000020) |
unpack operation has been cancelled More... | |
#define | NM_STATUS_PACK_POSTED ((nm_status_t)0x00000040) |
sending operation is in progress More... | |
#define | NM_STATUS_UNPACK_POSTED ((nm_status_t)0x00000080) |
unpack operation is in progress More... | |
#define | NM_STATUS_ACK_RECEIVED ((nm_status_t)0x00000100) |
ack received for the given pack More... | |
#define | NM_STATUS_UNPACK_DATA0 ((nm_status_t)0x00000200) |
first byte of data arrived, not unpacked yet- event triggered only if unpack is posted without data spec More... | |
#define | NM_STATUS_UNPACK_DATA_SIZE ((nm_status_t)0x00000400) |
size of data is known (last chunk of data arrived), not unpacked yet- event triggered only if unpack is posted without data spec More... | |
#define | NM_STATUS_FINALIZED ((nm_status_t)0x00000800) |
request is finalized, may be freed More... | |
#define | NM_STATUS_ERROR ((nm_status_t)0x00001000) |
request is in error; see error state in request More... | |
#define | NM_STATUS_PACK_MSG_SIZE ((nm_status_t)0x00002000) |
msg size already sent; used only if flag pack_partitioned is set More... | |
#define | NM_STATUS_UNPACK_PREFETCHED ((nm_status_t)0x00004000) |
flag unpack request as prefetched More... | |
#define | NM_STATUS_MASK_FULL ((nm_status_t)-1) |
mask to catch all bits of status More... | |
#define | NM_REQ_FLAG_NONE ((nm_req_flag_t)0x00000000) |
no flag set More... | |
#define | NM_REQ_FLAG_PACK_SYNCHRONOUS ((nm_req_flag_t)0x00001000) |
flag pack as synchronous (i.e. More... | |
#define | NM_REQ_FLAG_PACK ((nm_req_flag_t)0x00002000) |
request is a pack More... | |
#define | NM_REQ_FLAG_UNPACK ((nm_req_flag_t)0x00004000) |
request is an unpack More... | |
#define | NM_REQ_FLAG_UNPACK_DATA_INFO ((nm_req_flag_t)0x00008000) |
flag unpack request as data information present More... | |
#define | NM_REQ_FLAG_UNPACK_MATCHING_INFO ((nm_req_flag_t)0x00010000) |
flag unpack request as matching information present More... | |
#define | NM_REQ_FLAG_UNPACK_PREFETCHING ((nm_req_flag_t)0x00020000) |
flag unpack request needs prefetching More... | |
#define | NM_REQ_FLAG_MATCHING_WILDCARD ((nm_req_flag_t)0x00100000) |
request submited in wildcard queue More... | |
#define | NM_REQ_FLAG_MATCHING_GATE ((nm_req_flag_t)0x00200000) |
request matching performed by gate More... | |
#define | NM_REQ_FLAG_MATCHING_TAG ((nm_req_flag_t)0x00400000) |
request matching performed by tag More... | |
#define | NM_REQ_FLAG_MATCHING_FULL ((nm_req_flag_t)0x00800000) |
request matching by gate + tag More... | |
#define | NM_REQ_FLAG_FINALIZE_LATER ((nm_req_flag_t)0x01000000) |
statuses NM_STATUS_UNPACK_COMPLETED and NM_STATUS_FINALIZED will be set separately More... | |
#define | NM_REQ_FLAG_UNPACK_PARTITIONED ((nm_req_flag_t)0x02000000) |
unpack request is partitioned; each chunk whill be notified separately More... | |
#define | NM_REQ_FLAG_PACK_PARTITIONED ((nm_req_flag_t)0x04000000) |
pack request is partitioned; send a separate msg header before data chunks More... | |
#define | NM_REQ_CHUNK_FLAG_NONE ((nm_req_chunk_flag_t)0x00000000) |
no flag set More... | |
#define | NM_REQ_CHUNK_FLAG_SHORT ((nm_req_chunk_flag_t)0x00020000) |
flag req_chunk as short More... | |
#define | NM_REQ_CHUNK_FLAG_USE_COPY ((nm_req_chunk_flag_t)0x00080000) |
flatten data as contiguous block before send More... | |
#define | NM_REQ_CHUNK_FLAG_DATA_ITERATOR ((nm_req_chunk_flag_t)0x00100000) |
use iterator-based data description in pw More... | |
#define | NM_CORE_TAG_HASH_FULL ((nm_session_hash_t)0xFFFFFFFF) |
mask for all sessions More... | |
#define | NM_CORE_TAG_MASK_FULL ((nm_core_tag_t){ .tag = NM_TAG_MASK_FULL, .hashcode = NM_CORE_TAG_HASH_FULL }) |
#define | NM_CORE_TAG_NONE ((nm_core_tag_t){ .tag = 0, .hashcode = 0x0 }) |
#define | NM_EVENT_MATCHING_ANY ((struct nm_core_event_matching_s){ .p_gate = NM_ANY_GATE, .tag = NM_CORE_TAG_NONE, .tag_mask = NM_CORE_TAG_NONE }) |
matches any event More... | |
#define | NM_MONITOR_NULL ((struct nm_monitor_s){ .p_notifier = NULL, .event_mask = 0, .ref = NULL }) |
#define | NM_CORE_MONITOR_NULL ((struct nm_core_monitor_s){ .monitor = NM_MONITOR_NULL, .matching = NM_EVENT_MATCHING_ANY }) |
#define | NM_MATCHING_CONTAINER_NULL ((struct nm_matching_container_s) { NULL }) |
Typedefs | |
typedef struct nm_core * | nm_core_t |
typedef struct nm_drv_s * | nm_drv_t |
a nmad driver; opaque type for the user More... | |
typedef enum nm_thread_level_e | nm_thread_level_t |
typedef uint32_t | nm_status_t |
status bits of pack/unpack requests More... | |
typedef nm_status_t | nm_cond_status_t |
status with synchronization (wait/signal) More... | |
typedef uint32_t | nm_req_flag_t |
pack/unpack flags More... | |
typedef uint32_t | nm_req_chunk_flag_t |
flags for req_chunk More... | |
typedef uint32_t | nm_session_hash_t |
a session hashcode in tags, used to multiplex sessions More... | |
typedef struct nm_core_tag_s | nm_core_tag_t |
typedef void(* | nm_core_event_notifier_t) (const struct nm_core_event_s *const event, void *ref) |
an event notifier, fired upon status transition More... | |
typedef enum nm_core_task_kind_e | nm_core_task_kind_t |
typedef void(* | nm_injector_pull_data_t) (struct nm_req_s *p_req, const struct nm_data_s *p_data, nm_len_t chunk_offset, nm_len_t chunk_len, void *p_ref) |
user-supplied function called to pull data to posted request through nmad core p_req is the user request that matched this chunk p_data is the memory buffer where to copy the chunk (may be different from p_req->data in case we are actually peeking. More... | |
typedef struct nm_spinlock_s | nm_spinlock_t |
Enumerations | |
enum | nm_thread_level_e { NM_THREAD_SINGLE = 0 , NM_THREAD_FUNNELED = 1 , NM_THREAD_SERIALIZED = 2 , NM_THREAD_MULTIPLE = 3 } |
enum | nm_core_task_kind_e { NM_CORE_TASK_NONE = 0 , NM_CORE_TASK_UNPACK_NEXT = 1 , NM_CORE_TASK_COMPLETED_PW = 2 , NM_CORE_TASK_COMPLETED_PREFETCH = 3 , NM_CORE_TASK_PACK_SUBMISSION = 4 , NM_CORE_TASK_RTR_SEND = 5 , NM_CORE_TASK_HANDLER = 6 } |
Functions | |
puk_component_t | nm_core_component_load (const char *entity, const char *name) |
int | nm_core_init (nm_core_t *pp_core) |
int | nm_core_set_strategy (nm_core_t p_core, puk_component_t strategy) |
int | nm_core_exit (nm_core_t p_core) |
void | nm_core_schedopt_disable (nm_core_t p_core) |
disable schedopt for raw driver use More... | |
__attribute__ ((pure)) static inline nm_core_t nm_core_get_singleton(void) | |
PUK_VECT_TYPE (nm_drv, nm_drv_t) | |
int | nm_core_driver_load_init (nm_core_t p_core, puk_component_t driver, nm_trk_kind_t kind, nm_drv_t *pp_drv, const char **p_url) |
nm_gate_t | nm_core_gate_new (nm_core_t p_core, nm_drv_vect_t *p_drvs) |
Init a new gate, using the given set of drivers. More... | |
void | nm_core_gate_connect_async (nm_core_t p_core, nm_gate_t gate, nm_drv_t p_drv, nm_trk_id_t trk_id, const char *url) |
start connection process on given gate/trk More... | |
void | nm_core_gate_connect_wait (nm_core_t p_core, struct nm_trk_s *p_trk) |
wait for connection completion More... | |
nm_thread_level_t | nm_core_get_thread_level (nm_core_t) |
Get the current thread level. More... | |
void | nm_core_set_thread_level (nm_thread_level_t) |
Sets the thread level before nm core init. More... | |
int | nm_schedule (nm_core_t p_core) |
struct nm_core_tag_s | __attribute__ ((packed)) |
static nm_core_tag_t | nm_core_tag_build (nm_session_hash_t hashcode, nm_tag_t tag) |
static nm_tag_t | nm_core_tag_get_tag (nm_core_tag_t core_tag) |
static nm_session_hash_t | nm_core_tag_get_hashcode (nm_core_tag_t core_tag) |
void | nm_core_monitor_add (nm_core_t p_core, struct nm_core_monitor_s *m) |
Register an event monitor. More... | |
void | nm_core_monitor_remove (nm_core_t p_core, struct nm_core_monitor_s *m) |
Unregister an event monitor. More... | |
void | nm_core_req_monitor (struct nm_core *p_core, struct nm_req_s *p_req, struct nm_monitor_s monitor) |
set a per-request monitor. More... | |
PUK_LIST_DECLARE_TYPE (nm_req_chunk) | |
PUK_LIST_DECLARE_TYPE (nm_req) | |
void | nm_core_pack_init (struct nm_core *p_core, struct nm_req_s *p_pack) |
initializes an empty pack request More... | |
void | nm_core_pack_data (nm_core_t p_core, struct nm_req_s *p_pack, const struct nm_data_s *p_data) |
build a pack request from data descriptor More... | |
void | nm_core_pack_send (struct nm_core *p_core, struct nm_req_s *p_pack, nm_core_tag_t tag, nm_gate_t p_gate, nm_req_flag_t flags) |
set tag/gate/flags for pack request More... | |
void | nm_core_pack_submit (struct nm_core *p_core, struct nm_req_s *p_pack) |
post a pack request More... | |
void | nm_core_pack_set_priority (struct nm_core *p_core, struct nm_req_s *p_pack, nm_prio_t priority) |
set a priority for the given pack request More... | |
static void | nm_core_pack_set_hlen (struct nm_core *p_core __attribute__((unused)), struct nm_req_s *p_pack, nm_len_t hlen) |
set a header length for the given pack request More... | |
void | nm_core_pack_submit_chunks (struct nm_core *p_core, struct nm_req_s *p_pack, int n, const struct nm_chunk_s *p_chunks) |
void | nm_core_unpack_init (struct nm_core *p_core, struct nm_req_s *p_unpack) |
initializes an empty unpack request More... | |
void | nm_core_unpack_offset (struct nm_core *p_core, struct nm_req_s *p_unpack, nm_len_t offset) |
set an offset on data; data before offset will be discarded More... | |
void | nm_core_unpack_data (struct nm_core *p_core, struct nm_req_s *p_unpack, const struct nm_data_s *p_data) |
build an unpack request from data descriptor More... | |
void | nm_core_unpack_match_recv (struct nm_core *p_core, struct nm_req_s *p_unpack, nm_gate_t p_gate, nm_core_tag_t tag, nm_core_tag_t tag_mask) |
match an unpack request with given gate/tag, next sequence number assumed More... | |
void | nm_core_unpack_match_event (struct nm_core *p_core, struct nm_req_s *p_unpack, const struct nm_core_event_s *p_event) |
match an unpack request with a packet that triggered an event More... | |
void | nm_core_unpack_submit (struct nm_core *p_core, struct nm_req_s *p_unpack, nm_req_flag_t flags) |
submit an unpack request More... | |
int | nm_core_unpack_peek (struct nm_core *p_core, struct nm_req_s *p_unpack, const struct nm_data_s *p_data, nm_len_t peek_offset, nm_len_t peek_len) |
peeks unexpected data without consumming it. More... | |
int | nm_core_unpack_iprobe (struct nm_core *p_core, struct nm_req_s *p_unpack) |
probes whether an incoming packet matched this unposted request. More... | |
int | nm_core_unpack_cancel (struct nm_core *p_core, struct nm_req_s *p_unpack) |
cancel a pending unpack More... | |
int | nm_core_iprobe (struct nm_core *p_core, nm_gate_t p_gate, nm_core_tag_t tag, nm_core_tag_t tag_mask, nm_gate_t *pp_out_gate, nm_core_tag_t *p_out_tag, nm_len_t *p_out_size) |
probe unexpected packet, check matching for (packet_tag & tag_mask) == tag More... | |
void | nm_core_flush (struct nm_core *p_core) |
Flush pending packs (if supported by the strategy). More... | |
nm_seq_t | nm_core_send_seq_get (struct nm_core *p_core, nm_gate_t p_gate, nm_core_tag_t tag) |
get a seq number in the out stream, to route packet outside of nmad core More... | |
void | nm_core_inject_chunk (struct nm_core *p_core, nm_gate_t p_gate, nm_core_tag_t tag, nm_seq_t seq, nm_len_t chunk_offset, nm_len_t chunk_len, int is_last_chunk, nm_injector_pull_data_t p_pull_data, void *p_ref) |
inject a packet in nmad core as if it arrived from network. More... | |
void | nm_core_inject_complete (struct nm_core *p_core, struct nm_req_s *p_req, nm_len_t chunk_offset, nm_len_t chunk_len) |
notify data was injected in a matched request, but do not finalize the request (the status will be NM_STATUS_UNPACK_COMPLETED). More... | |
void | nm_core_inject_finalize (struct nm_core *p_core, struct nm_req_s *p_req) |
finalize an injected request that was only completed. More... | |
void | nm_core_inject_complete_finalize (struct nm_core *p_core, struct nm_req_s *p_req, nm_len_t chunk_offset, nm_len_t chunk_len) |
notify data was injected in a matched request and finalize this request. More... | |
void | nm_core_unpack_partition_set (struct nm_req_s *p_unpack, int n_partitions) |
void | nm_core_unpack_partition_free (struct nm_req_s *p_unpack) |
int | nm_core_unpack_partition_test (struct nm_req_s *p_unpack, int partition) |
void | nm_core_task_submit_locked (struct nm_core *p_core, void(*p_handler)(void)) |
lock then submit task to pending list More... | |
void | nm_core_task_submit_unlocked (struct nm_core *p_core, void(*p_handler)(void)) |
submit task lock-free to the submission list More... | |
static void | nm_cond_destroy (nm_cond_status_t *p_cond __attribute__((unused))) |
static void | nm_cond_mask (nm_cond_status_t *p_cond, nm_status_t bitmask) |
static void | nm_status_init (struct nm_req_s *p_req, nm_status_t bitmask) |
initialize cond status with given initial value More... | |
static void | nm_status_destroy (struct nm_req_s *p_req) |
static nm_status_t | nm_status_test (const struct nm_req_s *p_req, nm_status_t bitmask) |
query for given bits in req status; returns matched bits More... | |
static void | nm_status_add (struct nm_req_s *p_req, nm_status_t bitmask) |
static void | nm_status_unset (struct nm_req_s *p_req, nm_status_t bitmask) |
remove bits of bitmask from req status More... | |
static void | nm_status_wait (struct nm_req_s *p_req, nm_status_t bitmask, nm_core_t p_core) |
wait for any bit matching in req status More... | |
static void | nm_status_signal (struct nm_req_s *p_req, nm_status_t bitmask) |
static void | nm_status_wait_all (void **pp_reqs, int n, uintptr_t offset, nm_status_t bitmask, nm_core_t p_core) |
wait for all reqs, any bit in bitmask More... | |
static void | nm_status_assert (struct nm_req_s *p_req __attribute__((unused)), nm_status_t value __attribute__((unused))) |
static void | nm_status_spinwait (struct nm_req_s *p_req, nm_status_t status) |
static int | nm_status_test_allbits (struct nm_req_s *p_req, nm_status_t bitmask) |
tests for all given bits in status More... | |
static void | nm_mem_fence_always (void) |
memory fence, always More... | |
static void | nm_mem_fence (void) |
memory fence only when multithread More... | |
static int | nm_atomic_inc (int *v) |
increment int, atomic only when multithread More... | |
static int | nm_atomic_alway_inc (int *v) |
increment int, always atomic More... | |
static int | nm_atomic_dec (int *v) |
decrement int, atomic only when multithread More... | |
static int | nm_atomic_always_dec (int *v) |
decrement int, always atomic More... | |
static void | nm_atomic_add (int *v, int v2) |
int add, atomic only when multithread More... | |
static void | nm_atomic_always_add (int *v, int v2) |
int add, always atomic More... | |
static int | nm_atomic_compare_and_swap (int *v, int oldval, int newval) |
boolean int compare and swap, atomic only when multithread More... | |
static int | nm_atomic_always_compare_and_swap (int *v, int oldval, int newval) |
boolean int compare and swap, always atomic More... | |
static void | nm_spin_init (nm_spinlock_t *p_spin) |
init the spin lock More... | |
static void | nm_spin_destroy (nm_spinlock_t *p_spin) |
destroy the spin lock More... | |
static void | nm_spin_lock (nm_spinlock_t *p_spin) |
acquire the spin lock More... | |
static void | nm_spin_unlock (nm_spinlock_t *p_spin) |
release the spin lock More... | |
static int | nm_spin_trylock (nm_spinlock_t *p_spin) |
try to lock the spin lock return 1 if lock is successfully acquired, 0 otherwise More... | |
static void | nm_spin_assert_locked (nm_spinlock_t *p_spin) |
assert that current thread holds the lock More... | |
static void | nm_spin_assert_notlocked (nm_spinlock_t *p_spin) |
assert that current thread doesn't hold the lock More... | |
static void | nm_spin_check_nothread (nm_spinlock_t *p_spin __attribute__((unused))) |
check that we are always called from the same thread in case of non-threaded mode More... | |
static void | nm_spin_clear_nothread (nm_spinlock_t *p_spin __attribute__((unused))) |
clear the last_tid tracking for lock consistency checking More... | |
static void | nm_spin_init (nm_spinlock_t *p_spin __attribute__((unused))) |
static void | nm_spin_destroy (nm_spinlock_t *p_spin __attribute__((unused))) |
static void | nm_spin_lock (nm_spinlock_t *p_spin __attribute__((unused))) |
static void | nm_spin_unlock (nm_spinlock_t *p_spin __attribute__((unused))) |
static int | nm_spin_trylock (nm_spinlock_t *p_spin __attribute__((unused))) |
static void | nm_spin_assert_locked (nm_spinlock_t *p_spin __attribute__((unused))) |
static void | nm_spin_assert_notlocked (nm_spinlock_t *p_spin __attribute__((unused))) |
static void | nm_cond_init (nm_cond_status_t *p_cond, nm_status_t bitmask) |
initialize a nm_cond_status_t object More... | |
static void | nm_cond_destroy (nm_cond_status_t *p_cond) |
free resources associated with a nm_cond_status_t object More... | |
static nm_status_t | nm_cond_test (const nm_cond_status_t *p_cond, nm_status_t bitmask) |
test whether the given bit is set in the status; unlocked, weak consistency More... | |
static nm_status_t | nm_cond_test_locked (const nm_cond_status_t *p_cond, nm_status_t bitmask) |
test whether the given bit is set in the status; locked, guaranteed consistency, slower More... | |
static void | nm_cond_add (nm_cond_status_t *p_cond, nm_status_t bitmask) |
add a bit to the bitmask in the status, do not unlock waiters (for bits that will not be waited for) More... | |
static void | nm_cond_wait (nm_cond_status_t *p_cond, nm_status_t bitmask, nm_core_t p_core) |
wait for the given bit to be set in the status; do active polling while waiting More... | |
static void | nm_cond_signal (nm_cond_status_t *p_cond, nm_status_t bitmask) |
add a bit and wake up threads waiting for it More... | |
static void | nm_cond_wait_all (void **pp_conds, int n, uintptr_t offset, nm_status_t bitmask, nm_core_t p_core) |
wait on multiple statuses at the same time More... | |
Variables | |
struct nm_core_internal_s | nm_core_internal |
nm_tag_t | tag |
the user-supplied tag More... | |
nm_session_hash_t | hashcode |
the session hashcode More... | |
struct nm_core_event_s | __attribute__ |
nm_session_hash_t hashcode |
the session hashcode
Definition at line 1 of file nm_core_interface.h.
Referenced by nm_core_tag_build().
nm_tag_t tag |
the user-supplied tag
Definition at line 0 of file nm_core_interface.h.
Referenced by nm_coll_tree_status_init(), nm_core_post_ack(), nm_core_post_msg(), nm_core_post_rtr(), nm_core_tag_build(), nm_examples_barrier(), nm_header_init_ack(), nm_header_init_rtr(), nm_mpi_rma_tag_to_mpi_op(), nm_mpi_rma_tag_to_seq(), nm_mpi_rma_tag_to_win(), nm_rpc_get_tag(), nm_rpc_send(), nm_sr_irecv(), nm_sr_irecv_data(), nm_sr_irecv_iov(), nm_sr_irecv_iov_with_ref(), nm_sr_irecv_with_ref(), nm_sr_isend(), nm_sr_isend_data(), nm_sr_isend_iov(), nm_sr_isend_iov_with_ref(), nm_sr_isend_with_ref(), nm_sr_issend(), nm_sr_recv(), nm_sr_recv_irecv(), nm_sr_recv_match(), nm_sr_rsend(), nm_sr_send(), nm_sr_send_dest(), nm_sr_send_isend(), nm_sr_send_issend(), nm_sr_send_rsend(), nm_sync_clocks_bcast(), nm_sync_clocks_gather(), nm_sync_clocks_nm_barrier(), nm_sync_clocks_recv(), and nm_sync_clocks_send().