xref: /petsc/src/mat/impls/dense/mpi/mpidense.h (revision 13f7495037498d59e0d9e83d0e810f28e283c435)
18965ea79SLois Curfman McInnes 
270f55243SBarry Smith #include "src/mat/impls/dense/seq/dense.h"
38965ea79SLois Curfman McInnes 
4052cd425SLois Curfman McInnes   /*  Data stuctures for basic parallel dense matrix  */
5052cd425SLois Curfman McInnes 
6052cd425SLois Curfman McInnes /* Structure to hold the information for factorization of a dense matrix */
726b0ef5dSLois Curfman McInnes /* Most of this info is used in the pipe send/recv routines */
8052cd425SLois Curfman McInnes typedef struct {
9*13f74950SBarry Smith   PetscInt    nlnr;        /* number of local rows downstream */
10*13f74950SBarry Smith   PetscInt    nrend;       /* rend for downstream processor */
11*13f74950SBarry Smith   PetscInt    nbr,pnbr;   /* Down and upstream neighbors */
12*13f74950SBarry Smith   PetscInt    *tag;        /* message tags */
13*13f74950SBarry Smith   PetscInt    currow;      /* current row number */
14*13f74950SBarry Smith   PetscInt    phase;       /* phase (used to indicate tag) */
15*13f74950SBarry Smith   PetscInt    up;          /* Are we moving up or down in row number? */
16*13f74950SBarry Smith   PetscInt    use_bcast;   /* Are we broadcasting max length? */
17*13f74950SBarry Smith   PetscInt    nsend;       /* number of sends */
18*13f74950SBarry Smith   PetscInt    nrecv;       /* number of receives */
1926b0ef5dSLois Curfman McInnes 
2026b0ef5dSLois Curfman McInnes   /* data initially in matrix context */
21*13f74950SBarry Smith   PetscInt    k;           /* Blocking factor (unused as yet) */
22*13f74950SBarry Smith   PetscInt    k2;          /* Blocking factor for solves */
23ea709b57SSatish Balay   PetscScalar *temp;
24*13f74950SBarry Smith   PetscInt    nlptr;
25*13f74950SBarry Smith   PetscInt    *lrows;
26*13f74950SBarry Smith   PetscInt    *nlrows;
27*13f74950SBarry Smith   PetscInt    *pivots;
2826b0ef5dSLois Curfman McInnes } FactorCtx;
29052cd425SLois Curfman McInnes 
30052cd425SLois Curfman McInnes #define PIPEPHASE (ctx->phase == 0)
3167e560aaSBarry Smith 
328965ea79SLois Curfman McInnes typedef struct {
33*13f74950SBarry Smith   PetscInt           *rowners,*cowners;     /* ranges owned by each processor */
34c6aed980SBarry Smith                                         /* note n == N */
35*13f74950SBarry Smith   PetscInt           nvec;                   /* this is the n size for the vector one multiplies with */
36*13f74950SBarry Smith   PetscInt           rstart,rend;           /* starting and ending owned rows */
37bad5519cSBarry Smith   Mat           A;                      /* local submatrix */
38*13f74950SBarry Smith   PetscMPIInt   size;                   /* size of communicator */
39*13f74950SBarry Smith   PetscMPIInt   rank;                   /* rank of proc in communicator */
408965ea79SLois Curfman McInnes   /* The following variables are used for matrix assembly */
41273d9f13SBarry Smith   PetscTruth    donotstash;             /* Flag indicationg if values should be stashed */
428965ea79SLois Curfman McInnes   MPI_Request   *send_waits;            /* array of send requests */
438965ea79SLois Curfman McInnes   MPI_Request   *recv_waits;            /* array of receive requests */
44*13f74950SBarry Smith   PetscInt           nsends,nrecvs;         /* numbers of sends and receives */
45ea709b57SSatish Balay   PetscScalar   *svalues,*rvalues;     /* sending and receiving data */
46*13f74950SBarry Smith   PetscInt           rmax;                   /* maximum message length */
478965ea79SLois Curfman McInnes 
488965ea79SLois Curfman McInnes   /* The following variables are used for matrix-vector products */
498965ea79SLois Curfman McInnes 
508965ea79SLois Curfman McInnes   Vec           lvec;                   /* local vector */
51bad5519cSBarry Smith   VecScatter    Mvctx;                  /* scatter context for vector */
52052cd425SLois Curfman McInnes 
53273d9f13SBarry Smith   PetscTruth    roworiented;            /* if true, row oriented input (default) */
54622d7880SLois Curfman McInnes   FactorCtx     *factor;                /* factorization context */
558965ea79SLois Curfman McInnes } Mat_MPIDense;
5697304618SKris Buschelman 
57dfbe8321SBarry Smith EXTERN PetscErrorCode MatLoad_MPIDense(PetscViewer,const MatType,Mat*);
58dfbe8321SBarry Smith EXTERN PetscErrorCode MatSetUpMultiply_MPIDense(Mat);
59*13f74950SBarry Smith EXTERN PetscErrorCode MatGetSubMatrices_MPIDense(Mat,PetscInt,const IS[],const IS[],MatReuse,Mat *[]);
60