(git:5a3db73)
Loading...
Searching...
No Matches
dbm_shard.c File Reference
#include "dbm_shard.h"
#include "../offload/offload_mempool.h"
#include "dbm_hyperparams.h"
#include "../base/cp_assert.h"
#include <omp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

static int next_power2 (const int start)
 Internal routine for finding a power of two greater than given number.
static int next_prime (const int start)
 Internal routine for finding a prime greater equal than given number.
static void hashtable_init (dbm_shard_t *shard)
 Internal routine for initializing a shard's hashtable.
void dbm_shard_init (dbm_shard_t *shard)
 Internal routine for initializing a shard.
void dbm_shard_copy (dbm_shard_t *shard_a, const dbm_shard_t *shard_b)
 Internal routine for copying content of shard_b into shard_a.
void dbm_shard_release (dbm_shard_t *shard)
 Internal routine for releasing a shard.
static void hashtable_insert (dbm_shard_t *shard, const int block_idx)
 Private routine for inserting a block into a shard's hashtable.
dbm_block_t * dbm_shard_lookup (const dbm_shard_t *shard, const int row, const int col)
 Internal routine for looking up a block from a shard.
void dbm_shard_reserve (dbm_shard_t *shard, const int nblocks)
 Internal routine for growing the block metadata of a shard such that it holds nblocks blocks in total without growing again.
dbm_block_t * dbm_shard_promise_new_block (dbm_shard_t *shard, const int row, const int col, const int block_size)
 Internal routine for allocating the metadata of a new block.
void dbm_shard_allocate_promised_blocks (dbm_shard_t *shard)
 Internal routine for allocating and zeroing any promised block's data.
dbm_block_t * dbm_shard_get_or_promise_block (dbm_shard_t *shard, const int row, const int col, const int block_size)
 Internal routine for getting block or promising a new one.
dbm_block_t * dbm_shard_get_or_allocate_block (dbm_shard_t *shard, const int row, const int col, const int block_size)
 Internal routine for getting block or allocating a new one.

Function Documentation

◆ next_power2()

int next_power2 ( const int start)
static

Internal routine for finding a power of two greater than given number.

Author
Ole Schuett

Definition at line 22 of file dbm_shard.c.

Here is the caller graph for this function:

◆ next_prime()

int next_prime ( const int start)
static

Internal routine for finding a prime greater equal than given number.

Author
Ole Schuett

Definition at line 34 of file dbm_shard.c.

Here is the caller graph for this function:

◆ hashtable_init()

void hashtable_init ( dbm_shard_t * shard)
static

Internal routine for initializing a shard's hashtable.

Author
Ole Schuett

Definition at line 50 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_init()

void dbm_shard_init ( dbm_shard_t * shard)

Internal routine for initializing a shard.

Author
Ole Schuett

Definition at line 63 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_copy()

void dbm_shard_copy ( dbm_shard_t * shard_a,
const dbm_shard_t * shard_b )

Internal routine for copying content of shard_b into shard_a.

Author
Ole Schuett

Definition at line 79 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_release()

void dbm_shard_release ( dbm_shard_t * shard)

Internal routine for releasing a shard.

Author
Ole Schuett

Definition at line 128 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hashtable_insert()

void hashtable_insert ( dbm_shard_t * shard,
const int block_idx )
static

Private routine for inserting a block into a shard's hashtable.

Author
Ole Schuett

Definition at line 139 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_lookup()

dbm_block_t * dbm_shard_lookup ( const dbm_shard_t * shard,
const int row,
const int col )

Internal routine for looking up a block from a shard.

Author
Ole Schuett

Definition at line 160 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_reserve()

void dbm_shard_reserve ( dbm_shard_t * shard,
const int nblocks )

Internal routine for growing the block metadata of a shard such that it holds nblocks blocks in total without growing again.

Author
Ole Schuett and Hans Pabst

Definition at line 185 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_promise_new_block()

dbm_block_t * dbm_shard_promise_new_block ( dbm_shard_t * shard,
const int row,
const int col,
const int block_size )

Internal routine for allocating the metadata of a new block.

Author
Ole Schuett

Definition at line 209 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_allocate_promised_blocks()

void dbm_shard_allocate_promised_blocks ( dbm_shard_t * shard)

Internal routine for allocating and zeroing any promised block's data.

Author
Ole Schuett

Definition at line 229 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_get_or_promise_block()

dbm_block_t * dbm_shard_get_or_promise_block ( dbm_shard_t * shard,
const int row,
const int col,
const int block_size )

Internal routine for getting block or promising a new one.

Author
Ole Schuett

Definition at line 258 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dbm_shard_get_or_allocate_block()

dbm_block_t * dbm_shard_get_or_allocate_block ( dbm_shard_t * shard,
const int row,
const int col,
const int block_size )

Internal routine for getting block or allocating a new one.

Author
Ole Schuett

Definition at line 273 of file dbm_shard.c.

Here is the call graph for this function:
Here is the caller graph for this function: