Program Listing for File mpi_spmv_mult.h

Return to documentation for file (rcsw/multiprocess/mpi_spmv_mult.h)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <mpi.h>
#include "rcsw/ds/csmatrix.h"

/*******************************************************************************
 * Constant Definitions
 ******************************************************************************/

/*******************************************************************************
 * Structure Definitions
 ******************************************************************************/
struct mpi_spmv_mult_params {
    int mpi_rank;
    int mpi_world_size;

    struct csmatrix *matrix;
};

struct mpi_spmv_mult {
    struct csmatrix *matrix;
    struct darray *vector_in;
    struct darray *vector_out;

    int* rank_alloc_elts;

    int* rank_alloc_rows;

    int* row_owners;

    int* rank_alloc_row_prefix_sums;

    int* rank_alloc_col_prefix_sums;

    int* row_sizes;

    int mpi_rank;
    int mpi_world_size;

    int n_rows_init;

    int n_cols_init;

    int n_rows_alloc;

    int n_elts_alloc;
    int row_alloc_start;

    int n_elts_alloc_init_transpose;

    MPI_Datatype spmv_comm_type;
};

/*******************************************************************************
 * Function Prototypes
 ******************************************************************************/
BEGIN_C_DECLS

struct mpi_spmv_mult* mpi_spmv_mult_init(
    const struct mpi_spmv_mult_params* const params);

void mpi_spmv_mult_destroy(struct mpi_spmv_mult* const mult);

status_t mpi_spmv_mult_ds_init(struct mpi_spmv_mult* const mult);

status_t mpi_spmv_mult_distribute(struct mpi_spmv_mult* const mult,
                                  struct darray* vector);

struct darray* mpi_spmv_mult_exec(struct mpi_spmv_mult* const mult);

END_C_DECLS