(git:ccc2433)
dbm_multiply_comm.c File Reference
#include "dbm_multiply_comm.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "dbm_hyperparams.h"
#include "dbm_mempool.h"

Go to the source code of this file.

Data Structures

struct  plan_t
 Private struct used for planing during pack_matrix. More...
 

Functions

static int imax (int x, int y)
 Returns the larger of two given integer (missing from the C standard) More...
 
static int gcd (const int a, const int b)
 Private routine for computing greatest common divisor of two numbers. More...
 
static int lcm (const int a, const int b)
 Private routine for computing least common multiple of two numbers. More...
 
static int isum (const int n, const int input[n])
 Private routine for computing the sum of the given integers. More...
 
static void icumsum (const int n, const int input[n], int output[n])
 Private routine for computing the cumulative sums of given numbers. More...
 
static void create_pack_plans (const bool trans_matrix, const bool trans_dist, const dbm_matrix_t *matrix, const dbm_mpi_comm_t comm, const dbm_dist_1d_t *dist_indices, const dbm_dist_1d_t *dist_ticks, const int nticks, const int npacks, plan_t *plans_per_pack[npacks], int nblks_per_pack[npacks], int ndata_per_pack[npacks])
 Private routine for planing packs. More...
 
static void fill_send_buffers (const dbm_matrix_t *matrix, const bool trans_matrix, const int nblks_send, const int ndata_send, plan_t plans[nblks_send], const int nranks, int blks_send_count[nranks], int data_send_count[nranks], int blks_send_displ[nranks], int data_send_displ[nranks], dbm_pack_block_t blks_send[nblks_send], double data_send[ndata_send])
 Private routine for filling send buffers. More...
 
static int compare_pack_blocks_by_sum_index (const void *a, const void *b)
 Private comperator passed to qsort to compare two blocks by sum_index. More...
 
static void postprocess_received_blocks (const int nranks, const int nshards, const int nblocks_recv, const int blks_recv_count[nranks], const int blks_recv_displ[nranks], const int data_recv_displ[nranks], dbm_pack_block_t blks_recv[nblocks_recv])
 Private routine for post-processing received blocks. More...
 
static dbm_packed_matrix_t pack_matrix (const bool trans_matrix, const bool trans_dist, const dbm_matrix_t *matrix, const dbm_distribution_t *dist, const int nticks)
 Private routine for redistributing a matrix along selected dimensions. More...
 
static dbm_pack_tsendrecv_pack (const int itick, const int nticks, dbm_packed_matrix_t *packed)
 Private routine for sending and receiving the pack for the given tick. More...
 
static void free_packed_matrix (dbm_packed_matrix_t *packed)
 Private routine for releasing a packed matrix. More...
 
dbm_comm_iterator_tdbm_comm_iterator_start (const bool transa, const bool transb, const dbm_matrix_t *matrix_a, const dbm_matrix_t *matrix_b, const dbm_matrix_t *matrix_c)
 Internal routine for creating a communication iterator. More...
 
bool dbm_comm_iterator_next (dbm_comm_iterator_t *iter, dbm_pack_t **pack_a, dbm_pack_t **pack_b)
 Internal routine for retriving next pair of packs from given iterator. More...
 
void dbm_comm_iterator_stop (dbm_comm_iterator_t *iter)
 Internal routine for releasing the given communication iterator. More...
 

Function Documentation

◆ imax()

static int imax ( int  x,
int  y 
)
inlinestatic

Returns the larger of two given integer (missing from the C standard)

Author
Ole Schuett

Definition at line 21 of file dbm_multiply_comm.c.

◆ gcd()

static int gcd ( const int  a,
const int  b 
)
static

Private routine for computing greatest common divisor of two numbers.

Author
Ole Schuett

Definition at line 27 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ lcm()

static int lcm ( const int  a,
const int  b 
)
static

Private routine for computing least common multiple of two numbers.

Author
Ole Schuett

Definition at line 37 of file dbm_multiply_comm.c.

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

◆ isum()

static int isum ( const int  n,
const int  input[n] 
)
inlinestatic

Private routine for computing the sum of the given integers.

Author
Ole Schuett

Definition at line 43 of file dbm_multiply_comm.c.

◆ icumsum()

static void icumsum ( const int  n,
const int  input[n],
int  output[n] 
)
inlinestatic

Private routine for computing the cumulative sums of given numbers.

Author
Ole Schuett

Definition at line 55 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ create_pack_plans()

static void create_pack_plans ( const bool  trans_matrix,
const bool  trans_dist,
const dbm_matrix_t matrix,
const dbm_mpi_comm_t  comm,
const dbm_dist_1d_t dist_indices,
const dbm_dist_1d_t dist_ticks,
const int  nticks,
const int  npacks,
plan_t plans_per_pack[npacks],
int  nblks_per_pack[npacks],
int  ndata_per_pack[npacks] 
)
static

Private routine for planing packs.

Author
Ole Schuett

Definition at line 77 of file dbm_multiply_comm.c.

Here is the call graph for this function:

◆ fill_send_buffers()

static void fill_send_buffers ( const dbm_matrix_t matrix,
const bool  trans_matrix,
const int  nblks_send,
const int  ndata_send,
plan_t  plans[nblks_send],
const int  nranks,
int  blks_send_count[nranks],
int  data_send_count[nranks],
int  blks_send_displ[nranks],
int  data_send_displ[nranks],
dbm_pack_block_t  blks_send[nblks_send],
double  data_send[ndata_send] 
)
static

Private routine for filling send buffers.

Author
Ole Schuett

Definition at line 158 of file dbm_multiply_comm.c.

Here is the call graph for this function:

◆ compare_pack_blocks_by_sum_index()

static int compare_pack_blocks_by_sum_index ( const void *  a,
const void *  b 
)
static

Private comperator passed to qsort to compare two blocks by sum_index.

Author
Ole Schuett

Definition at line 254 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ postprocess_received_blocks()

static void postprocess_received_blocks ( const int  nranks,
const int  nshards,
const int  nblocks_recv,
const int  blks_recv_count[nranks],
const int  blks_recv_displ[nranks],
const int  data_recv_displ[nranks],
dbm_pack_block_t  blks_recv[nblocks_recv] 
)
static

Private routine for post-processing received blocks.

Author
Ole Schuett

Definition at line 264 of file dbm_multiply_comm.c.

Here is the call graph for this function:

◆ pack_matrix()

static dbm_packed_matrix_t pack_matrix ( const bool  trans_matrix,
const bool  trans_dist,
const dbm_matrix_t matrix,
const dbm_distribution_t dist,
const int  nticks 
)
static

Private routine for redistributing a matrix along selected dimensions.

Author
Ole Schuett

Definition at line 327 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ sendrecv_pack()

static dbm_pack_t* sendrecv_pack ( const int  itick,
const int  nticks,
dbm_packed_matrix_t packed 
)
static

Private routine for sending and receiving the pack for the given tick.

Author
Ole Schuett

Definition at line 442 of file dbm_multiply_comm.c.

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

◆ free_packed_matrix()

static void free_packed_matrix ( dbm_packed_matrix_t packed)
static

Private routine for releasing a packed matrix.

Author
Ole Schuett

Definition at line 499 of file dbm_multiply_comm.c.

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

◆ dbm_comm_iterator_start()

dbm_comm_iterator_t* dbm_comm_iterator_start ( const bool  transa,
const bool  transb,
const dbm_matrix_t matrix_a,
const dbm_matrix_t matrix_b,
const dbm_matrix_t matrix_c 
)

Internal routine for creating a communication iterator.

Author
Ole Schuett

Definition at line 513 of file dbm_multiply_comm.c.

Here is the call graph for this function:

◆ dbm_comm_iterator_next()

bool dbm_comm_iterator_next ( dbm_comm_iterator_t iter,
dbm_pack_t **  pack_a,
dbm_pack_t **  pack_b 
)

Internal routine for retriving next pair of packs from given iterator.

Author
Ole Schuett

Definition at line 541 of file dbm_multiply_comm.c.

Here is the call graph for this function:

◆ dbm_comm_iterator_stop()

void dbm_comm_iterator_stop ( dbm_comm_iterator_t iter)

Internal routine for releasing the given communication iterator.

Author
Ole Schuett

Definition at line 561 of file dbm_multiply_comm.c.

Here is the call graph for this function: