(git:16f85b0)
Loading...
Searching...
No Matches
dbm_multiply_comm.c File Reference
#include "dbm_multiply_comm.h"
#include "../mpiwrap/cp_mpi.h"
#include "../offload/offload_mempool.h"
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

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

Macros

#define DBM_MULTIPLY_COMM_MEMPOOL

Functions

static int gcd (const int a, const int b)
 Private routine for computing greatest common divisor of two numbers.
static int lcm (const int a, const int b)
 Private routine for computing least common multiple of two numbers.
static int checked_byte_count (const int nelements, const size_t element_size)
 Private routine for converting element counts to byte counts.
static int isum (const int n, const int input[n])
 Private routine for computing the sum of the given integers.
static void icumsum (const int n, const int input[n], int output[n])
 Private routine for computing the cumulative sums of given numbers.
static void compute_data_recv_count (const int nranks, const int blks_recv_count[nranks], const int blks_recv_displ[nranks], const int free_index_sizes[], const int sum_index_sizes[], const dbm_pack_block_t blks_recv[], int data_recv_count[nranks])
 Private routine computing received data counts from block metadata.
static unsigned long long calculate_tick_index (int sum_index, int nticks)
 Private routine for calculating tick indices in pack plans.
static void create_pack_plans (const bool trans_matrix, const bool trans_dist, const dbm_matrix_t *matrix, const cp_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.
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.
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.
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.
static dbm_packed_matrix_t pack_matrix (const bool trans_matrix, const bool trans_dist, const dbm_matrix_t *restrict matrix, const dbm_distribution_t *restrict dist, const int nticks)
 Private routine for redistributing a matrix along selected dimensions.
static dbm_pack_t * sendrecv_pack (const int itick, const int nticks, dbm_packed_matrix_t *packed)
 Private routine for sending and receiving the pack for the given tick.
static void free_packed_matrix (dbm_packed_matrix_t *packed)
 Private routine for releasing a packed matrix.
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.
bool dbm_comm_iterator_next (dbm_comm_iterator_t *iter, dbm_pack_t **pack_a, dbm_pack_t **pack_b)
 Internal routine for retrieving next pair of packs of given iterator.
void dbm_comm_iterator_stop (dbm_comm_iterator_t *iter)
 Internal routine for releasing the given communication iterator.

Macro Definition Documentation

◆ DBM_MULTIPLY_COMM_MEMPOOL

#define DBM_MULTIPLY_COMM_MEMPOOL

Definition at line 17 of file dbm_multiply_comm.c.

Function Documentation

◆ gcd()

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 24 of file dbm_multiply_comm.c.

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

◆ lcm()

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 35 of file dbm_multiply_comm.c.

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

◆ checked_byte_count()

int checked_byte_count ( const int nelements,
const size_t element_size )
static

Private routine for converting element counts to byte counts.

Author
Hans Pabst

Definition at line 41 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ isum()

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 54 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ icumsum()

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 and Hans Pabst

Definition at line 66 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ compute_data_recv_count()

void compute_data_recv_count ( const int nranks,
const int blks_recv_count[nranks],
const int blks_recv_displ[nranks],
const int free_index_sizes[],
const int sum_index_sizes[],
const dbm_pack_block_t blks_recv[],
int data_recv_count[nranks] )
static

Private routine computing received data counts from block metadata.

Author
Hans Pabst

Definition at line 80 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ calculate_tick_index()

unsigned long long calculate_tick_index ( int sum_index,
int nticks )
inlinestatic

Private routine for calculating tick indices in pack plans.

Author
Maximilian Graml

Definition at line 118 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ create_pack_plans()

void create_pack_plans ( const bool trans_matrix,
const bool trans_dist,
const dbm_matrix_t * matrix,
const cp_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 128 of file dbm_multiply_comm.c.

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

◆ fill_send_buffers()

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 210 of file dbm_multiply_comm.c.

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

◆ compare_pack_blocks_by_sum_index()

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 306 of file dbm_multiply_comm.c.

Here is the caller graph for this function:

◆ postprocess_received_blocks()

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 316 of file dbm_multiply_comm.c.

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

◆ pack_matrix()

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

Private routine for redistributing a matrix along selected dimensions.

Author
Ole Schuett

Definition at line 379 of file dbm_multiply_comm.c.

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

◆ sendrecv_pack()

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 519 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()

void free_packed_matrix ( dbm_packed_matrix_t * packed)
static

Private routine for releasing a packed matrix.

Author
Ole Schuett

Definition at line 577 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 599 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_next()

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

Internal routine for retrieving next pair of packs of given iterator.

Internal routine for retrieving next pair of packs.

Author
Ole Schuett

Definition at line 627 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_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 647 of file dbm_multiply_comm.c.

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