PEXSI
 All Classes Namespaces Files Functions Variables Friends Pages
pselinv.hpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012 The Regents of the University of California,
3  through Lawrence Berkeley National Laboratory.
4 
5  Authors: Lin Lin and Mathias Jacquelin
6 
7  This file is part of PEXSI. All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions are met:
11 
12  (1) Redistributions of source code must retain the above copyright notice, this
13  list of conditions and the following disclaimer.
14  (2) Redistributions in binary form must reproduce the above copyright notice,
15  this list of conditions and the following disclaimer in the documentation
16  and/or other materials provided with the distribution.
17  (3) Neither the name of the University of California, Lawrence Berkeley
18  National Laboratory, U.S. Dept. of Energy nor the names of its contributors may
19  be used to endorse or promote products derived from this software without
20  specific prior written permission.
21 
22  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
26  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33  You are under no obligation whatsoever to provide any bug fixes, patches, or
34  upgrades to the features, functionality or performance of the source code
35  ("Enhancements") to anyone; however, if you choose to make your Enhancements
36  available either publicly, or directly to Lawrence Berkeley National
37  Laboratory, without imposing a separate written license agreement for such
38  Enhancements, then you hereby grant the following license: a non-exclusive,
39  royalty-free perpetual license to install, use, modify, prepare derivative
40  works, incorporate into other computer software, distribute, and sublicense
41  such enhancements or derivative works thereof, in binary and source code form.
42 */
46 #ifndef _PSELINV_HPP_
47 #define _PSELINV_HPP_
48 
49 // *********************************************************************
50 // Common utilities
51 // *********************************************************************
52 
53 #include "environment.hpp"
54 #include "numvec_impl.hpp"
55 #include "nummat_impl.hpp"
56 #include "sparse_matrix_impl.hpp"
57 #include "superlu_dist_interf.hpp"
58 #include "mpi_interf.hpp"
59 #include "utility.hpp"
60 #include "blas.hpp"
61 #include "lapack.hpp"
62 #include <set>
63 
64 namespace PEXSI{
65 
66  struct SuperLUOptions;
67 
68  typedef std::vector<bool> bitMask;
69  typedef std::map<bitMask , std::vector<Int> > bitMaskSet;
70 
71 
72  /**********************************************************************
73  * Basic PSelInv data structure
74  **********************************************************************/
75 
84  struct GridType{
85  // Data
86  MPI_Comm comm;
87  MPI_Comm rowComm;
88  MPI_Comm colComm;
89  Int mpirank;
90  Int mpisize;
91  Int numProcRow;
92  Int numProcCol;
93 
94  // Member function
95  GridType( MPI_Comm Bcomm, int nprow, int npcol );
96  ~GridType();
97  };
98 
122  IntNumVec perm;
123  IntNumVec permInv;
124  IntNumVec superIdx;
125  IntNumVec superPtr;
126  IntNumVec etree;
127  };
128 
129 
134  struct LBlock{
135  // Variables
137  Int blockIdx;
138 
140  Int numRow;
141 
143  Int numCol;
144 
147 
150 
151  // Member functions;
152  LBlock() {blockIdx = -1; numRow = 0; numCol =0;}
153  ~LBlock() {}
154  LBlock& operator = (const LBlock& LB) {
155  blockIdx = LB.blockIdx;
156  numRow = LB.numRow;
157  numCol = LB.numCol;
158  rows = LB.rows;
159  nzval = LB.nzval;
160  return *this;
161  }
162  friend std::ostream& operator<<(std::ostream& out, const LBlock& vec) // output
163  {
164  out << "(" << vec.blockIdx << ", " << vec.numRow << ", " << vec.numCol <<std::endl<< "rows " << vec.rows <<std::endl<< "nzval " <<std::endl<< vec.nzval << ")";
165  return out;
166  }
167 
168 
169  };
170 
181  struct UBlock{
182  // Variables
184  Int blockIdx;
185 
187  Int numRow;
188 
190  Int numCol;
191 
194 
197 
198  // Member functions;
199  UBlock() {blockIdx = -1; numRow = 0; numCol =0;}
200  ~UBlock() {}
201  UBlock& operator = (const UBlock& UB) {
202  blockIdx = UB.blockIdx;
203  numRow = UB.numRow;
204  numCol = UB.numCol;
205  cols = UB.cols;
206  nzval = UB.nzval;
207  return *this;
208  }
209 
210  friend std::ostream& operator<<(std::ostream& out, const UBlock& vec) // output
211  {
212  out << "(" << vec.blockIdx << ", " << vec.numRow << ", " << vec.numCol <<std::endl<< "cols " << vec.cols <<std::endl<< "nzval " <<std::endl<< vec.nzval << ")";
213  return out;
214  }
215 
216 
217  };
218 
219  // *********************************************************************
220  // SuperLU style utility functions
221  //
222  // The SuperLU style macros are defined here as inline functions
223  // so that the code is more portable.
224  // *********************************************************************
225 
227  inline Int MYPROC( const GridType* g )
228  { return g->mpirank; }
229 
231  inline Int MYROW( const GridType* g )
232  { return g->mpirank / g->numProcCol; }
233 
235  inline Int MYCOL( const GridType* g )
236  { return g->mpirank % g->numProcCol; }
237 
240  inline Int PROW( Int bnum, const GridType* g )
241  { return bnum % g->numProcRow; }
242 
245  inline Int PCOL( Int bnum, const GridType* g )
246  { return bnum % g->numProcCol; }
247 
250  inline Int PNUM( Int i, Int j, const GridType* g )
251  { return (i%g->numProcRow) * g->numProcCol + j%g->numProcCol; }
252 
255  inline Int LBi( Int bnum, const GridType* g )
256  { return bnum / g->numProcRow; }
257 
260  inline Int LBj( Int bnum, const GridType* g)
261  { return bnum / g->numProcCol; }
262 
265  inline Int GBi( Int iLocal, const GridType* g )
266  { return iLocal * g->numProcRow + MYROW( g ); }
267 
270  inline Int GBj( Int jLocal, const GridType* g )
271  { return jLocal * g->numProcCol + MYCOL( g ); }
272 
275  inline Int CEILING( Int a, Int b )
276  { return (a%b) ? ( a/b + 1 ) : ( a/b ); }
277 
279  inline Int BlockIdx( Int i, const SuperNodeType *s )
280  { return s->superIdx[i]; }
281 
284  inline Int FirstBlockCol( Int bnum, const SuperNodeType *s )
285  { return s->superPtr[bnum]; }
286 
287 
291  inline Int FirstBlockRow( Int bnum, const SuperNodeType *s )
292  { return s->superPtr[bnum]; }
293 
294 
296  inline Int SuperSize( Int bnum, const SuperNodeType *s )
297  { return s->superPtr[bnum+1] - s->superPtr[bnum]; }
298 
300  inline Int NumSuper( const SuperNodeType *s )
301  { return s->superPtr.m() - 1; }
302 
305  inline Int NumCol( const SuperNodeType *s )
306  { return s->superIdx.m(); }
307 
308 
309  // *********************************************************************
310  // Serialize / Deserialize
311  // *********************************************************************
312 
313  // L part
314 
330  namespace LBlockMask{
331  enum {
332  BLOCKIDX,
333  NUMROW,
334  NUMCOL,
335  ROWS,
336  NZVAL,
337  TOTAL_NUMBER
338  };
339  }
340 
341  Int inline serialize(LBlock& val, std::ostream& os, const std::vector<Int>& mask){
342  Int i = 0;
343  if(mask[i]==1) serialize(val.blockIdx, os, mask); i++;
344  if(mask[i]==1) serialize(val.numRow, os, mask); i++;
345  if(mask[i]==1) serialize(val.numCol, os, mask); i++;
346  if(mask[i]==1) serialize(val.rows, os, mask); i++;
347  if(mask[i]==1) serialize(val.nzval, os, mask); i++;
348  return 0;
349  }
350 
351  Int inline deserialize(LBlock& val, std::istream& is, const std::vector<Int>& mask){
352  Int i = 0;
353  if(mask[i]==1) deserialize(val.blockIdx, is, mask); i++;
354  if(mask[i]==1) deserialize(val.numRow, is, mask); i++;
355  if(mask[i]==1) deserialize(val.numCol, is, mask); i++;
356  if(mask[i]==1) deserialize(val.rows, is, mask); i++;
357  if(mask[i]==1) deserialize(val.nzval, is, mask); i++;
358  return 0;
359  }
360 
361  // U part
377  namespace UBlockMask{
378  enum {
379  BLOCKIDX,
380  NUMROW,
381  NUMCOL,
382  COLS,
383  NZVAL,
384  TOTAL_NUMBER
385  };
386  }
387 
388  Int inline serialize(UBlock& val, std::ostream& os, const std::vector<Int>& mask){
389  Int i = 0;
390  if(mask[i]==1) serialize(val.blockIdx, os, mask); i++;
391  if(mask[i]==1) serialize(val.numRow, os, mask); i++;
392  if(mask[i]==1) serialize(val.numCol, os, mask); i++;
393  if(mask[i]==1) serialize(val.cols, os, mask); i++;
394  if(mask[i]==1) serialize(val.nzval, os, mask); i++;
395  return 0;
396  }
397 
398  Int inline deserialize(UBlock& val, std::istream& is, const std::vector<Int>& mask){
399  Int i = 0;
400  if(mask[i]==1) deserialize(val.blockIdx, is, mask); i++;
401  if(mask[i]==1) deserialize(val.numRow, is, mask); i++;
402  if(mask[i]==1) deserialize(val.numCol, is, mask); i++;
403  if(mask[i]==1) deserialize(val.cols, is, mask); i++;
404  if(mask[i]==1) deserialize(val.nzval, is, mask); i++;
405  return 0;
406  }
407 
408 
409  /**********************************************************************
410  * Main data structure in PSelInv: PMatrix
411  **********************************************************************/
412 
472 
473  class PMatrix{
474 
475  private:
476  // *********************************************************************
477  // Variables
478  // *********************************************************************
479  // Data variables
480 
481  const GridType* grid_;
482 
483  const SuperNodeType* super_;
484 
485  const SuperLUOptions * options_;
486 
487  std::vector<std::vector<Int> > ColBlockIdx_;
488  std::vector<std::vector<Int> > RowBlockIdx_;
489  std::vector<std::vector<LBlock> > L_;
490  std::vector<std::vector<UBlock> > U_;
491 
492  std::vector<std::vector<Int> > workingSet_;
493 
494 
495  // Communication variables
496  BolNumMat isSendToBelow_;
497  BolNumMat isSendToRight_;
498  BolNumVec isSendToDiagonal_;
499  BolNumMat isSendToCrossDiagonal_;
500 
501  BolNumMat isRecvFromBelow_;
502  BolNumVec isRecvFromAbove_;
503  BolNumVec isRecvFromLeft_;
504  BolNumMat isRecvFromCrossDiagonal_;
505 
506  //Communicators for the Bcast variant
507 
508  IntNumVec maxCommSizes_;
509 
510  NumVec<Int> countSendToBelow_;
511  bitMaskSet maskSendToBelow_;
512  std::vector<MPI_Comm> commSendToBelow_;
513  std::vector<MPI_Comm*> commSendToBelowPtr_;
514  std::vector<Int> commSendToBelowRoot_;
515  std::vector<bitMask *> commSendToBelowMaskPtr_;
516  std::vector<bitMask> commSendToBelowMask_;
517 
518  NumVec<Int> countRecvFromBelow_;
519  bitMaskSet maskRecvFromBelow_;
520  std::vector<MPI_Comm> commRecvFromBelow_;
521  std::vector<MPI_Comm*> commRecvFromBelowPtr_;
522  std::vector<Int> commRecvFromBelowRoot_;
523 
524  std::vector<bitMask *> commRecvFromBelowMaskPtr_;
525  std::vector<bitMask> commRecvFromBelowMask_;
526 
527 
528  NumVec<Int> countSendToRight_;
529  bitMaskSet maskSendToRight_;
530  std::vector<MPI_Comm> commSendToRight_;
531  std::vector<MPI_Comm*> commSendToRightPtr_;
532  std::vector<Int> commSendToRightRoot_;
533  std::vector<bitMask *> commSendToRightMaskPtr_;
534  std::vector<bitMask> commSendToRightMask_;
535 
536  //NumVec<Int> countCrossDiag_;
537 
538  // This is the tag used for mpi communication for selinv
539 
540  enum{
541  SELINV_TAG_U_SIZE,
542  SELINV_TAG_U_CONTENT,
543  SELINV_TAG_L_SIZE,
544  SELINV_TAG_L_CONTENT,
545  SELINV_TAG_L_REDUCE,
546  SELINV_TAG_D_SIZE,
547  SELINV_TAG_D_CONTENT,
548  SELINV_TAG_D_REDUCE,
549  SELINV_TAG_COUNT
550  };
551 
552 
553 
554 
555  struct SuperNodeBufferType{
556  NumMat<Scalar> LUpdateBuf;
557  NumMat<Scalar> DiagBuf;
558  std::vector<Int> RowLocalPtr;
559  std::vector<Int> BlockIdxLocal;
560  std::vector<char> SstrLcolSend;
561  std::vector<char> SstrUrowSend;
562  std::vector<char> SstrLcolRecv;
563  std::vector<char> SstrUrowRecv;
564  Int SizeSstrLcolSend;
565  Int SizeSstrUrowSend;
566  Int SizeSstrLcolRecv;
567  Int SizeSstrUrowRecv;
568  Int Index;
569  Int isReady;
570 
571 
572  SuperNodeBufferType():
573  SizeSstrLcolSend(0),
574  SizeSstrUrowSend(0),
575  SizeSstrLcolRecv(0),
576  SizeSstrUrowRecv(0),
577  Index(0),
578  isReady(0){}
579 
580  SuperNodeBufferType(Int &pIndex) :
581  SizeSstrLcolSend(0),
582  SizeSstrUrowSend(0),
583  SizeSstrLcolRecv(0),
584  SizeSstrUrowRecv(0),
585  Index(pIndex),
586  isReady(0) {}
587 
588  };
589 
591  inline void SelInvIntra_Collectives(Int lidx);
592 
594  inline void SelInvIntra_P2p(Int lidx);
595 
596 
598  inline void SelInv_lookup_indexes(SuperNodeBufferType & snode, std::vector<LBlock> & LcolRecv, std::vector<UBlock> & UrowRecv, NumMat<Scalar> & AinvBuf,NumMat<Scalar> & UBuf);
599 
601  inline void GetWorkSet(std::vector<Int> & snodeEtree, std::vector<std::vector<Int> > & WSet);
602 
604  inline void UnpackData(SuperNodeBufferType & snode, std::vector<LBlock> & LcolRecv, std::vector<UBlock> & UrowRecv);
605 
607  inline void ComputeDiagUpdate(SuperNodeBufferType & snode);
608 
610  inline void SendRecvCD_UpdateU(std::vector<SuperNodeBufferType> & arrSuperNodes, Int stepSuper);
611 
613  void getMaxCommunicatorSizes();
614 
616  void ConstructCommunicators_Collectives(Int lidx);
617 
620  void DestructCommunicators_Collectives( );
621 
622 
623 
624 
625 
626 
627 
628 
629 
630 
631 
632 
633 
634  public:
635  // *********************************************************************
636  // Public member functions
637  // *********************************************************************
638 
639  PMatrix( const GridType* g, const SuperNodeType* s, const PEXSI::SuperLUOptions * o );
640 
641  ~PMatrix();
642 
643  Int NumCol() const { return super_ -> superIdx.m(); }
644 
645  Int NumSuper() const { return super_ ->superPtr.m() - 1; }
646 
648  Int NumLocalBlockCol() const { return CEILING( this->NumSuper(), grid_->numProcCol ); }
649 
651  Int NumLocalBlockRow() const { return CEILING( this->NumSuper(), grid_->numProcRow); }
652 
653 
654  std::vector<Int> & ColBlockIdx(Int jLocal) { return ColBlockIdx_[jLocal]; }
655  std::vector<Int> & RowBlockIdx(Int iLocal) { return RowBlockIdx_[iLocal]; }
656 
657 
660  Int NumBlockL( Int jLocal ) const { return L_[jLocal].size(); }
661 
664  Int NumBlockU( Int iLocal ) const { return U_[iLocal].size(); }
665 
667  const GridType* Grid() const { return grid_; }
668 
671  const SuperNodeType* SuperNode() const { return super_; }
672 
675  std::vector<LBlock>& L( Int jLocal ) { return L_[jLocal]; }
676 
679  std::vector<UBlock>& U( Int iLocal ) { return U_[iLocal]; }
680 
683  std::vector<std::vector<int> >& WorkingSet( ) { return workingSet_; }
684 
687  Int CountSendToRight(Int ksup) { Int count= std::count (isSendToRight_.VecData(ksup), isSendToRight_.VecData(ksup) + grid_->numProcCol, true); return (isSendToRight_(MYCOL(grid_),ksup)?count-1:count); }
688 
691  Int CountRecvFromBelow(Int ksup) { Int count= std::count (isRecvFromBelow_.VecData(ksup), isRecvFromBelow_.VecData(ksup) + grid_->numProcRow, true); return (isRecvFromBelow_(MYROW(grid_),ksup)?count-1:count); }
692 
695  Int CountSendToCrossDiagonal(Int ksup) { Int count= std::count (isSendToCrossDiagonal_.VecData(ksup), isSendToCrossDiagonal_.VecData(ksup) + grid_->numProcCol, true); return ((isSendToCrossDiagonal_(MYCOL(grid_),ksup) && MYROW(grid_)==PROW(ksup,grid_))?count-1:count); }
696 
699  Int CountRecvFromCrossDiagonal(Int ksup) { Int count= std::count (isRecvFromCrossDiagonal_.VecData(ksup), isRecvFromCrossDiagonal_.VecData(ksup) + grid_->numProcRow, true); return ((isRecvFromCrossDiagonal_(MYROW(grid_),ksup) && MYCOL(grid_)==PCOL(ksup,grid_))?count-1:count); }
700 
701 
702 
703 
706  void GetEtree(std::vector<Int> & etree_supno );
707 
708 
714 
715 
720 
725 
726 
731 
732 
761  void PreSelInv( );
762 
887  void SelInv( );
889  void SelInv_Collectives( );
891  void SelInv_P2p( );
894  void SelInv_Hybrid(Int threshold);
895 
896 
903  void GetDiagonal( NumVec<Scalar>& diag );
904  void GetColumn ( Int colIdx, NumVec<Scalar>& col );
905 
906 
913 
924  const DistSparseMatrix<Scalar>& A,
926 
927 
939  const DistSparseMatrix<Scalar>& A,
941 
942 
945  Int NnzLocal();
946 
949  LongInt Nnz();
950 
954  void GetNegativeInertia ( Real& inertia );
955 
956  };
957 
958 
959 
960 } // namespace PEXSI
961 
962 #endif // _PSELINV_HPP_
Int NumLocalBlockRow() const
NumLocalBlockRow returns the total number of block rows.
Definition: pselinv.hpp:651
Int numCol
Number of nonzero columns.
Definition: pselinv.hpp:143
void PMatrixToDistSparseMatrix(DistSparseMatrix< Scalar > &A)
PMatrixToDistSparseMatrix converts the PMatrix into a distributed compressed sparse column matrix for...
Definition: pselinv.cpp:4213
Environmental variables.
void GetDiagonal(NumVec< Scalar > &diag)
GetDiagonal extracts the diagonal elements of the PMatrix.
Definition: pselinv.cpp:4173
void ConstructCommunicationPattern_Collectives()
ConstructCommunicationPattern_Collectives constructs the communication pattern to be used later in th...
Definition: pselinv.cpp:2588
Int CountSendToCrossDiagonal(Int ksup)
CountSendToCrossDiagonal returns the number of cross diagonal processors with which current processor...
Definition: pselinv.hpp:695
A thin interface for passing parameters to set the SuperLU options.
Definition: superlu_dist_interf.hpp:82
std::vector< std::vector< int > > & WorkingSet()
WorkingSet returns the ordered list of supernodes which could be done in parallel.
Definition: pselinv.hpp:683
SuperNodeType describes mapping between supernode and column, the permutation information, and potentially the elimination tree (not implemented here).
Definition: pselinv.hpp:121
Inteface with SuperLU_Dist (version 3.0 and later)
NumMat< Scalar > nzval
Dimension numRow * numCol, nonzero elements.
Definition: pselinv.hpp:149
Int PROW(Int bnum, const GridType *g)
PROW returns the processor row that the bnum-th block (supernode) belongs to.
Definition: pselinv.hpp:240
Thin interface to LAPACK.
IntNumVec rows
Dimension numRow * 1, index (0-based) for the number of nonzero rows.
Definition: pselinv.hpp:146
Int numRow
Number of nonzero rows.
Definition: pselinv.hpp:140
const SuperNodeType * SuperNode() const
SuperNode returns the supernodal partition of the current PMatrix.
Definition: pselinv.hpp:671
void SelInv_P2p()
Point-to-point version of the selected inversion.
Definition: pselinv.cpp:3668
NumMat< Scalar > nzval
Dimension numRow * numCol, nonzero elements.
Definition: pselinv.hpp:196
Int MYPROC(const GridType *g)
MYPROC returns the current processor rank.
Definition: pselinv.hpp:227
void PreSelInv()
PreSelInv prepares the structure in L_ and U_ so that SelInv only involves matrix-matrix multiplicati...
Definition: pselinv.cpp:3787
Int PCOL(Int bnum, const GridType *g)
PCOL returns the processor column that the bnum-th block (supernode) belongs to.
Definition: pselinv.hpp:245
Int blockIdx
Block index (supernodal index)
Definition: pselinv.hpp:137
Int LBi(Int bnum, const GridType *g)
LBi returns the local block number on the processor at processor row PROW( bnum, g )...
Definition: pselinv.hpp:255
Int CountRecvFromBelow(Int ksup)
CountRecvFromBelow returns the number of processors below the current processor from which it receive...
Definition: pselinv.hpp:691
Implementation of Numerical Vector.
Int CountRecvFromCrossDiagonal(Int ksup)
CountRecvFromCrossDiagonal returns the number of cross diagonal processors with which current process...
Definition: pselinv.hpp:699
Int SuperSize(Int bnum, const SuperNodeType *s)
SuperSize returns the size of the block bnum.
Definition: pselinv.hpp:296
Int LBj(Int bnum, const GridType *g)
LBj returns the local block number on the processor at processor column PCOL( bnum, g ).
Definition: pselinv.hpp:260
Int GBj(Int jLocal, const GridType *g)
GBj returns the global block number from a local block number in the column direction.
Definition: pselinv.hpp:270
Int NnzLocal()
NnzLocal computes the number of nonzero elements (L and U) saved locally.
Definition: pselinv.cpp:5050
std::vector< UBlock > & U(Int iLocal)
U returns the vector of nonzero U blocks for the local block row iLocal.
Definition: pselinv.hpp:679
Int NumCol(const SuperNodeType *s)
NumCol returns the total number of columns for a supernodal partiiton.
Definition: pselinv.hpp:305
void PMatrixToDistSparseMatrix2(const DistSparseMatrix< Scalar > &A, DistSparseMatrix< Scalar > &B)
PMatrixToDistSparseMatrix2 is a more efficient version which performs the same job as PMatrixToDistSp...
Definition: pselinv.cpp:4766
void ConstructCommunicationPattern_P2p()
ConstructCommunicationPattern_P2p constructs the communication pattern to be used later in the select...
Definition: pselinv.cpp:2175
Int NumLocalBlockCol() const
NumLocalBlockCol returns the total number of block columns.
Definition: pselinv.hpp:648
Int FirstBlockRow(Int bnum, const SuperNodeType *s)
FirstBlockRow returns the first column of a block bnum. Note: the functionality of FirstBlockRow is e...
Definition: pselinv.hpp:291
LBlock stores a nonzero block in the lower triangular part or the diagonal part in PSelInv...
Definition: pselinv.hpp:134
Int PNUM(Int i, Int j, const GridType *g)
PNUM returns the processor rank that the bnum-th block (supernode) belongs to.
Definition: pselinv.hpp:250
void SelInv_Collectives()
Collective communication version of the selected inversion.
Definition: pselinv.cpp:3698
Int GBi(Int iLocal, const GridType *g)
GBi returns the global block number from a local block number in the row direction.
Definition: pselinv.hpp:265
GridType is the PSelInv way of defining the grid.
Definition: pselinv.hpp:84
Int numCol
Number of nonzero columns.
Definition: pselinv.hpp:190
Interface with MPI to facilitate communication.
IntNumVec cols
Dimension numRow * 1, index (0-based) for the number of nonzero rows.
Definition: pselinv.hpp:193
Int MYCOL(const GridType *g)
MYCOL returns my processor column.
Definition: pselinv.hpp:235
const GridType * Grid() const
Grid returns the GridType structure of the current PMatrix.
Definition: pselinv.hpp:667
Int blockIdx
Block index (supernodal index)
Definition: pselinv.hpp:184
void ConstructCommunicationPattern_Hybrid()
ConstructCommunicationPattern_Hybrid constructs the communication pattern to be used later in the sel...
Definition: pselinv.cpp:3122
Various utility subroutines.
Implementation of numerical matrix.
void SelInv_Hybrid(Int threshold)
Hybrid version of the selected inversion. This file is obsolete.
Definition: pselinv.cpp:3737
UBlock stores a nonzero block in the upper triangular part in PSelInv.
Definition: pselinv.hpp:181
Int numRow
Number of nonzero rows.
Definition: pselinv.hpp:187
Int FirstBlockCol(Int bnum, const SuperNodeType *s)
FirstBlockCol returns the first column of a block bnum.
Definition: pselinv.hpp:284
Int CountSendToRight(Int ksup)
CountSendToRight returns the number of processors to the right of current processor with which it has...
Definition: pselinv.hpp:687
void GetEtree(std::vector< Int > &etree_supno)
GetEtree computes the supernodal elimination tree to be used later in the pipelined selected inversio...
Definition: pselinv.cpp:844
Thin interface to BLAS.
Int NumBlockU(Int iLocal) const
NumBlockU returns the number of nonzero U blocks for the local block row iLocal.
Definition: pselinv.hpp:664
PMatrix contains the main data structure and the computational routine for the parallel selected inve...
Definition: pselinv.hpp:473
Int BlockIdx(Int i, const SuperNodeType *s)
BlockIdx returns the block index of a column i.
Definition: pselinv.hpp:279
Implementation of sparse matrices.
void ConstructCommunicationPattern()
ConstructCommunicationPattern constructs the communication pattern to be used later in the selected i...
Definition: pselinv.cpp:2168
Int CEILING(Int a, Int b)
CEILING is used for computing the storage space for local number of blocks.
Definition: pselinv.hpp:275
void GetNegativeInertia(Real &inertia)
GetNegativeInertia computes the negative inertia of a PMatrix. This can be used to estimate e...
Definition: pselinv.cpp:5097
std::vector< LBlock > & L(Int jLocal)
L returns the vector of nonzero L blocks for the local block column jLocal.
Definition: pselinv.hpp:675
Int NumSuper(const SuperNodeType *s)
NumSuper returns the total number of supernodes.
Definition: pselinv.hpp:300
void SelInv()
SelInv is the main function for the selected inversion.
Definition: pselinv.cpp:3661
LongInt Nnz()
Nnz computes the total number of nonzero elements in the PMatrix.
Definition: pselinv.cpp:5080
DistSparseMatrix describes a Sparse matrix in the compressed sparse column format (CSC) and distribut...
Definition: sparse_matrix_decl.hpp:91
Int NumBlockL(Int jLocal) const
NumBlockL returns the number of nonzero L blocks for the local block column jLocal.
Definition: pselinv.hpp:660
Int MYROW(const GridType *g)
MYROW returns my processor row.
Definition: pselinv.hpp:231