KMR
Classes | Macros | Functions | Variables
kmraltkvs.c File Reference

Other Key-Value Stream Implementations. More...

#include <mpi.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>
#include <ctype.h>
#include "../config.h"
#include "kmr.h"
#include "kmrimpl.h"

Go to the source code of this file.

Classes

struct  FJMPI_Rdma_cq
 

Macros

#define FAST_NOTICE   (kmr_pushoff_area[0])
 
#define FJMPI_RDMA_ERROR   (0)
 
#define FJMPI_RDMA_LOCAL_NIC0   0
 
#define FJMPI_RDMA_NIC0   0
 
#define FJMPI_RDMA_NOTICE   (1)
 
#define FJMPI_RDMA_PATH0   0
 
#define FJMPI_RDMA_REMOTE_NIC0   0
 
#define MAX(a, b)   (((a)>(b))?(a):(b))
 
#define MIN(a, b)   (((a)<(b))?(a):(b))
 
#define NEVERHERE   0
 
#define PUT_VALUE   (((int)'A'<<24)|((int)'H'<<16)|((int)'O'<<8)|((int)'%'))
 
#define STAT_RDMA_POLLCQ_CALLS   8
 
#define STAT_RECV_CALLS   0
 
#define STAT_SEND_CALLS   1
 
#define STAT_SEND_PEND_COUNT   7
 
#define STAT_TEST0_COUNT   4
 
#define STAT_TEST1_COUNT   5
 
#define STAT_TEST_CALLS   2
 
#define STAT_TEST_CLOCKS   9
 
#define STAT_TEST_TIME   0
 
#define STAT_WAIT_CALLS   3
 
#define STAT_WAIT_COUNT   6
 
#define STAT_WAIT_TIME   1
 

Functions

static int FJMPI_Rdma_dereg_mem (int m)
 
static int FJMPI_Rdma_finalize (void)
 
static uint64_t FJMPI_Rdma_get_remote_addr (int r, int m)
 
static int FJMPI_Rdma_init (void)
 
static int FJMPI_Rdma_poll_cq (int nic, struct FJMPI_Rdma_cq *cq)
 
static int FJMPI_Rdma_put (int r, int tag, uint64_t ra, uint64_t la, size_t sz, int f)
 
static uint64_t FJMPI_Rdma_reg_mem (int m, void *b, size_t l)
 
int kmr_add_kv_done_pushoff (KMR_KVS *kvs)
 Marks finished adding key-value pairs, called from kmr_add_kv_done(). More...
 
int kmr_add_kv_pushoff (KMR_KVS *kvs, const struct kmr_kv_box kv)
 Adds a key-value pair. More...
 
void kmr_check_pushoff_fast_notice_ (KMR *mr)
 Check if fast-notice works. More...
 
KMR_KVSkmr_create_pushoff_kvs (KMR *mr, enum kmr_kv_field kf, enum kmr_kv_field vf, struct kmr_option opt, const char *file, const int line, const char *func)
 Makes a new key-value stream with the specified field data-types. More...
 
void kmr_fin_pushoff_fast_notice_ (void)
 
int kmr_free_kvs_pushoff (KMR_KVS *kvs, _Bool deallocate)
 
void kmr_init_pushoff_fast_notice_ (MPI_Comm comm, _Bool verbose)
 Initializes RDMA for fast-notice. More...
 
void kmr_print_statistics_on_pushoff (KMR *mr, char *titlestring)
 
static int kmr_pushoff_do_recv (KMR_KVS *kvs, int peer)
 
static int kmr_pushoff_do_send (KMR_KVS *kvs, int peer, _Bool closing)
 Sends the first one in the list of buffered blocks, or it does nothing when the pipe is full. More...
 
static void kmr_pushoff_link_to_send (KMR_KVS *kvs, int peer, struct kmr_pushoff_buffers *po, struct kmr_kvs_block *b)
 Links a block for sending. More...
 
int kmr_pushoff_make_stationary (KMR_KVS *kvs)
 
static void kmr_pushoff_notice (KMR *mr, int peer)
 
static int kmr_pushoff_poll (KMR_KVS *kvs, _Bool closing, _Bool block)
 
static int kmr_pushoff_poll_all (void)
 
static int kmr_replace_kvs_components (KMR_KVS *kvs0, KMR_KVS *kvs1)
 Replaces KVS0 with KVS1. More...
 
static int kmr_send_size_of_block (struct kmr_kvs_block *b)
 

Variables

static uint64_t * kmr_pushoff_addrs = 0
 
static volatile int * kmr_pushoff_area = 0
 
const size_t kmr_pushoff_area_size = (sizeof(int) * 1024)
 
const int kmr_pushoff_memid = 1
 
static KMR_KVSkmr_pushoff_movings [64]
 
static int kmr_pushoff_nprocs
 
static int kmr_pushoff_rank
 
static int kmr_pushoff_seqno = 0
 

Detailed Description

Other Key-Value Stream Implementations.

A "push-off" key-value stream performs shuffling at key-value addition. It aims at an overlap of communication and computation. It includes RDMA-based event notification to tell readiness of MPI messages.

Definition in file kmraltkvs.c.

Function Documentation

KMR_KVS* kmr_create_pushoff_kvs ( KMR mr,
enum kmr_kv_field  kf,
enum kmr_kv_field  vf,
struct kmr_option  opt,
const char *  file,
const int  line,
const char *  func 
)

Makes a new key-value stream with the specified field data-types.

It cannot be used with checkpointing. It allocates by the size of the union, which is larger than the necessary for replacement later by an on-core KVS at kmr_add_kv_done(). See kmr_add_kv_done_pushoff().

Definition at line 85 of file kmraltkvs.c.

static void kmr_pushoff_link_to_send ( KMR_KVS kvs,
int  peer,
struct kmr_pushoff_buffers po,
struct kmr_kvs_block b 
)
inlinestatic

Links a block for sending.

Calling kmr_pushoff_do_send() starts sending.

Definition at line 211 of file kmraltkvs.c.

static int kmr_pushoff_do_send ( KMR_KVS kvs,
int  peer,
_Bool  closing 
)
static

Sends the first one in the list of buffered blocks, or it does nothing when the pipe is full.

It sends a closing message when CLOSING is true and nothing remains to send. Note MPI operations are called inside a mutex (OMP critical).

Definition at line 240 of file kmraltkvs.c.

int kmr_add_kv_pushoff ( KMR_KVS kvs,
const struct kmr_kv_box  kv 
)

Adds a key-value pair.

It is called from inside a mutex (OMP critical). It first stores a KV into a buffer, and then sends the buffer when it gets full. It sends an empty message as an end-of-stream marker. IT POLLS MESSAGES TOO OFTEN OR TOO SELDOM.

Definition at line 460 of file kmraltkvs.c.

static int kmr_replace_kvs_components ( KMR_KVS kvs0,
KMR_KVS kvs1 
)
static

Replaces KVS0 with KVS1.

That is, it moves the structure slots from KVS1 to KVS0 and frees KVS1. (The first one be push-off, and the second one be on-core).

Definition at line 524 of file kmraltkvs.c.

int kmr_add_kv_done_pushoff ( KMR_KVS kvs)

Marks finished adding key-value pairs, called from kmr_add_kv_done().

It flushes pending buffers and it is a collective operation in effect.

Definition at line 555 of file kmraltkvs.c.

void kmr_init_pushoff_fast_notice_ ( MPI_Comm  comm,
_Bool  verbose 
)

Initializes RDMA for fast-notice.

Fast-notice is RDMA-based event notification to tell readiness of MPI messages. It is only usable with communicators having the same processes.

Definition at line 726 of file kmraltkvs.c.

void kmr_check_pushoff_fast_notice_ ( KMR mr)

Check if fast-notice works.

Check be at immediately after initialization.

Definition at line 808 of file kmraltkvs.c.