PEXSI
 All Classes Namespaces Files Functions Variables Typedefs 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 _PEXSI_PSELINV_HPP_
47 #define _PEXSI_PSELINV_HPP_
48 
49 // *********************************************************************
50 // Common utilities
51 // *********************************************************************
52 
53 #include "environment.hpp"
54 #include "NumVec.hpp"
55 #include "NumMat.hpp"
56 #include "sparse_matrix.hpp"
57 
58 #include "superlu_dist_interf.hpp"
59 #include "mpi_interf.hpp"
60 #include "utility.hpp"
61 #include "blas.hpp"
62 #include "lapack.hpp"
63 #include <set>
64 
65 
66 namespace PEXSI{
67 
68 
69  typedef std::vector<bool> bitMask;
70  typedef std::map<bitMask , std::vector<Int> > bitMaskSet;
71 
72 
73  /**********************************************************************
74  * Basic PSelInv data structure
75  **********************************************************************/
76 
85  struct GridType{
86  // Data
87  MPI_Comm comm;
88  MPI_Comm rowComm;
89  MPI_Comm colComm;
90  Int mpirank;
91  Int mpisize;
92  Int numProcRow;
93  Int numProcCol;
94 
95  // Member function
96  GridType( MPI_Comm Bcomm, int nprow, int npcol );
97  ~GridType();
98  };
99 
123  IntNumVec perm;
124  IntNumVec permInv;
125  IntNumVec superIdx;
126  IntNumVec superPtr;
127  IntNumVec etree;
128  };
129 
130 
135  template<typename T>
136  struct LBlock{
137  // Variables
139  Int blockIdx;
140 
142  Int numRow;
143 
145  Int numCol;
146 
149 
152 
153  // Member functions;
154  LBlock() {blockIdx = -1; numRow = 0; numCol =0;}
155  ~LBlock() {}
156  LBlock& operator = (const LBlock& LB) {
157  blockIdx = LB.blockIdx;
158  numRow = LB.numRow;
159  numCol = LB.numCol;
160  rows = LB.rows;
161  nzval = LB.nzval;
162  return *this;
163  }
164  friend std::ostream& operator<<(std::ostream& out, const LBlock& vec) // output
165  {
166  out << "(" << vec.blockIdx << ", " << vec.numRow << ", " << vec.numCol <<std::endl<< "rows " << vec.rows <<std::endl<< "nzval " <<std::endl<< vec.nzval << ")";
167  return out;
168  }
169 
170 
171  };
172 
183  template<typename T>
184  struct UBlock{
185  // Variables
187  Int blockIdx;
188 
190  Int numRow;
191 
193  Int numCol;
194 
197 
200 
201  // Member functions;
202  UBlock() {blockIdx = -1; numRow = 0; numCol =0;}
203  ~UBlock() {}
204  UBlock& operator = (const UBlock& UB) {
205  blockIdx = UB.blockIdx;
206  numRow = UB.numRow;
207  numCol = UB.numCol;
208  cols = UB.cols;
209  nzval = UB.nzval;
210  return *this;
211  }
212 
213  friend std::ostream& operator<<(std::ostream& out, const UBlock& vec) // output
214  {
215  out << "(" << vec.blockIdx << ", " << vec.numRow << ", " << vec.numCol <<std::endl<< "cols " << vec.cols <<std::endl<< "nzval " <<std::endl<< vec.nzval << ")";
216  return out;
217  }
218  };
219 
220  // *********************************************************************
221  // SuperLU style utility functions
222  //
223  // The SuperLU style macros are defined here as inline functions
224  // so that the code is more portable.
225  // *********************************************************************
226 
228  inline Int MYPROC( const GridType* g )
229  { return g->mpirank; }
230 
232  inline Int MYROW( const GridType* g )
233  { return g->mpirank / g->numProcCol; }
234 
236  inline Int MYCOL( const GridType* g )
237  { return g->mpirank % g->numProcCol; }
238 
241  inline Int PROW( Int bnum, const GridType* g )
242  { return bnum % g->numProcRow; }
243 
246  inline Int PCOL( Int bnum, const GridType* g )
247  { return bnum % g->numProcCol; }
248 
251  inline Int PNUM( Int i, Int j, const GridType* g )
252  { return (i%g->numProcRow) * g->numProcCol + j%g->numProcCol; }
253 
256  inline Int LBi( Int bnum, const GridType* g )
257  { return bnum / g->numProcRow; }
258 
261  inline Int LBj( Int bnum, const GridType* g)
262  { return bnum / g->numProcCol; }
263 
266  inline Int GBi( Int iLocal, const GridType* g )
267  { return iLocal * g->numProcRow + MYROW( g ); }
268 
271  inline Int GBj( Int jLocal, const GridType* g )
272  { return jLocal * g->numProcCol + MYCOL( g ); }
273 
276  inline Int CEILING( Int a, Int b )
277  { return (a%b) ? ( a/b + 1 ) : ( a/b ); }
278 
280  inline Int BlockIdx( Int i, const SuperNodeType *s )
281  { return s->superIdx[i]; }
282 
285  inline Int FirstBlockCol( Int bnum, const SuperNodeType *s )
286  { return s->superPtr[bnum]; }
287 
288 
292  inline Int FirstBlockRow( Int bnum, const SuperNodeType *s )
293  { return s->superPtr[bnum]; }
294 
295 
297  inline Int SuperSize( Int bnum, const SuperNodeType *s )
298  { return s->superPtr[bnum+1] - s->superPtr[bnum]; }
299 
301  inline Int NumSuper( const SuperNodeType *s )
302  { return s->superPtr.m() - 1; }
303 
306  inline Int NumCol( const SuperNodeType *s )
307  { return s->superIdx.m(); }
308 
309 
310  // *********************************************************************
311  // Serialize / Deserialize
312  // *********************************************************************
313 
314  // L part
315 
331  namespace LBlockMask{
332  enum {
333  BLOCKIDX,
334  NUMROW,
335  NUMCOL,
336  ROWS,
337  NZVAL,
338  TOTAL_NUMBER
339  };
340  }
341 
342 
343  template<typename T>
344  Int inline serialize(LBlock<T>& val, std::ostream& os, const std::vector<Int>& mask){
345  Int i = 0;
346  if(mask[i]==1) serialize(val.blockIdx, os, mask); i++;
347  if(mask[i]==1) serialize(val.numRow, os, mask); i++;
348  if(mask[i]==1) serialize(val.numCol, os, mask); i++;
349  if(mask[i]==1) serialize(val.rows, os, mask); i++;
350  if(mask[i]==1) serialize(val.nzval, os, mask); i++;
351  return 0;
352  }
353 
354  template<typename T>
355  Int inline deserialize(LBlock<T>& val, std::istream& is, const std::vector<Int>& mask){
356  Int i = 0;
357  if(mask[i]==1) deserialize(val.blockIdx, is, mask); i++;
358  if(mask[i]==1) deserialize(val.numRow, is, mask); i++;
359  if(mask[i]==1) deserialize(val.numCol, is, mask); i++;
360  if(mask[i]==1) deserialize(val.rows, is, mask); i++;
361  if(mask[i]==1) deserialize(val.nzval, is, mask); i++;
362  return 0;
363  }
364 
365  // U part
381  namespace UBlockMask{
382  enum {
383  BLOCKIDX,
384  NUMROW,
385  NUMCOL,
386  COLS,
387  NZVAL,
388  TOTAL_NUMBER
389  };
390  }
391 
392  template<typename T>
393  Int inline serialize(UBlock<T>& val, std::ostream& os, const std::vector<Int>& mask){
394  Int i = 0;
395  if(mask[i]==1) serialize(val.blockIdx, os, mask); i++;
396  if(mask[i]==1) serialize(val.numRow, os, mask); i++;
397  if(mask[i]==1) serialize(val.numCol, os, mask); i++;
398  if(mask[i]==1) serialize(val.cols, os, mask); i++;
399  if(mask[i]==1) serialize(val.nzval, os, mask); i++;
400  return 0;
401  }
402 
403  template<typename T>
404  Int inline deserialize(UBlock<T>& val, std::istream& is, const std::vector<Int>& mask){
405  Int i = 0;
406  if(mask[i]==1) deserialize(val.blockIdx, is, mask); i++;
407  if(mask[i]==1) deserialize(val.numRow, is, mask); i++;
408  if(mask[i]==1) deserialize(val.numCol, is, mask); i++;
409  if(mask[i]==1) deserialize(val.cols, is, mask); i++;
410  if(mask[i]==1) deserialize(val.nzval, is, mask); i++;
411  return 0;
412  }
413 
414 
415  /**********************************************************************
416  * Main data structure in PSelInv: PMatrix
417  **********************************************************************/
418 
480 
481  template<typename T>
482  class PMatrix{
483 
484  private:
485  // *********************************************************************
486  // Variables
487  // *********************************************************************
488  // Data variables
489 
490  const GridType* grid_;
491 
492  const SuperNodeType* super_;
493 
494  const SuperLUOptions * options_;
495 
496  std::vector<std::vector<Int> > ColBlockIdx_;
497  std::vector<std::vector<Int> > RowBlockIdx_;
498  std::vector<std::vector<LBlock<T> > > L_;
499  std::vector<std::vector<UBlock<T> > > U_;
500 
501  std::vector<std::vector<Int> > workingSet_;
502 
503 
504  // Communication variables
505  BolNumMat isSendToBelow_;
506  BolNumMat isSendToRight_;
507  BolNumVec isSendToDiagonal_;
508  BolNumMat isSendToCrossDiagonal_;
509 
510  BolNumMat isRecvFromBelow_;
511  BolNumVec isRecvFromAbove_;
512  BolNumVec isRecvFromLeft_;
513  BolNumMat isRecvFromCrossDiagonal_;
514 
515  //Communicators for the Bcast variant
516 
517  IntNumVec maxCommSizes_;
518 
519  NumVec<Int> countSendToBelow_;
520  bitMaskSet maskSendToBelow_;
521  std::vector<MPI_Comm> commSendToBelow_;
522  std::vector<MPI_Comm*> commSendToBelowPtr_;
523  std::vector<Int> commSendToBelowRoot_;
524  std::vector<bitMask *> commSendToBelowMaskPtr_;
525  std::vector<bitMask> commSendToBelowMask_;
526 
527  NumVec<Int> countRecvFromBelow_;
528  bitMaskSet maskRecvFromBelow_;
529  std::vector<MPI_Comm> commRecvFromBelow_;
530  std::vector<MPI_Comm*> commRecvFromBelowPtr_;
531  std::vector<Int> commRecvFromBelowRoot_;
532 
533  std::vector<bitMask *> commRecvFromBelowMaskPtr_;
534  std::vector<bitMask> commRecvFromBelowMask_;
535 
536 
537  NumVec<Int> countSendToRight_;
538  bitMaskSet maskSendToRight_;
539  std::vector<MPI_Comm> commSendToRight_;
540  std::vector<MPI_Comm*> commSendToRightPtr_;
541  std::vector<Int> commSendToRightRoot_;
542  std::vector<bitMask *> commSendToRightMaskPtr_;
543  std::vector<bitMask> commSendToRightMask_;
544 
545  //NumVec<Int> countCrossDiag_;
546 
547  // This is the tag used for mpi communication for selinv
548 
549  enum{
550  SELINV_TAG_U_SIZE,
551  SELINV_TAG_U_CONTENT,
552  SELINV_TAG_L_SIZE,
553  SELINV_TAG_L_CONTENT,
554  SELINV_TAG_L_REDUCE,
555  SELINV_TAG_D_SIZE,
556  SELINV_TAG_D_CONTENT,
557  SELINV_TAG_D_REDUCE,
558  SELINV_TAG_COUNT
559  };
560 
561 
562 
563 
564  struct SuperNodeBufferType{
565  NumMat<T> LUpdateBuf;
566  NumMat<T> DiagBuf;
567  std::vector<Int> RowLocalPtr;
568  std::vector<Int> BlockIdxLocal;
569  std::vector<char> SstrLcolSend;
570  std::vector<char> SstrUrowSend;
571  std::vector<char> SstrLcolRecv;
572  std::vector<char> SstrUrowRecv;
573  Int SizeSstrLcolSend;
574  Int SizeSstrUrowSend;
575  Int SizeSstrLcolRecv;
576  Int SizeSstrUrowRecv;
577  Int Index;
578  Int isReady;
579 
580 
581  SuperNodeBufferType():
582  SizeSstrLcolSend(0),
583  SizeSstrUrowSend(0),
584  SizeSstrLcolRecv(0),
585  SizeSstrUrowRecv(0),
586  Index(0),
587  isReady(0){}
588 
589  SuperNodeBufferType(Int &pIndex) :
590  SizeSstrLcolSend(0),
591  SizeSstrUrowSend(0),
592  SizeSstrLcolRecv(0),
593  SizeSstrUrowRecv(0),
594  Index(pIndex),
595  isReady(0) {}
596 
597  };
598 
600  inline void SelInvIntra_Collectives(Int lidx);
601 
603  inline void SelInvIntra_P2p(Int lidx);
604 
605 
607  inline void SelInv_lookup_indexes(SuperNodeBufferType & snode, std::vector<LBlock<T> > & LcolRecv, std::vector<UBlock<T> > & UrowRecv, NumMat<T> & AinvBuf,NumMat<T> & UBuf);
608 
610  inline void GetWorkSet(std::vector<Int> & snodeEtree, std::vector<std::vector<Int> > & WSet);
611 
613  inline void UnpackData(SuperNodeBufferType & snode, std::vector<LBlock<T> > & LcolRecv, std::vector<UBlock<T> > & UrowRecv);
614 
616  inline void ComputeDiagUpdate(SuperNodeBufferType & snode);
617 
619  inline void SendRecvCD_UpdateU(std::vector<SuperNodeBufferType > & arrSuperNodes, Int stepSuper);
620 
622  void getMaxCommunicatorSizes();
623 
625  void ConstructCommunicators_Collectives(Int lidx);
626 
629  void DestructCommunicators_Collectives( );
630 
631  public:
632  // *********************************************************************
633  // Public member functions
634  // *********************************************************************
635 
636  PMatrix() {}
637 
638  PMatrix( const GridType* g, const SuperNodeType* s, const PEXSI::SuperLUOptions * o );
639 
640  ~PMatrix() {}
641 
642  void Setup( const GridType* g, const SuperNodeType* s, const PEXSI::SuperLUOptions * o );
643 
644  Int NumCol() const { return super_ -> superIdx.m(); }
645 
646  Int NumSuper() const { return super_ ->superPtr.m() - 1; }
647 
649  Int NumLocalBlockCol() const { return CEILING( this->NumSuper(), grid_->numProcCol ); }
650 
652  Int NumLocalBlockRow() const { return CEILING( this->NumSuper(), grid_->numProcRow); }
653 
654 
655  std::vector< std::vector<Int> > & ColBlockIdx() { return ColBlockIdx_; }
656  std::vector< std::vector<Int> > & RowBlockIdx() { return RowBlockIdx_; }
657  std::vector<Int> & ColBlockIdx(Int jLocal) { return ColBlockIdx_[jLocal]; }
658  std::vector<Int> & RowBlockIdx(Int iLocal) { return RowBlockIdx_[iLocal]; }
659 
660 
663  Int NumBlockL( Int jLocal ) const { return L_[jLocal].size(); }
664 
667  Int NumBlockU( Int iLocal ) const { return U_[iLocal].size(); }
668 
670  const GridType* Grid() const { return grid_; }
671 
674  const SuperNodeType* SuperNode() const { return super_; }
675 
678  std::vector<LBlock<T> >& L( Int jLocal ) { return L_[jLocal]; }
679 
682  std::vector<UBlock<T> >& U( Int iLocal ) { return U_[iLocal]; }
683 
686  std::vector<std::vector<int> >& WorkingSet( ) { return workingSet_; }
687 
690  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); }
691 
694  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); }
695 
698  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); }
699 
702  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); }
703 
704 
705 
706 
709  void GetEtree(std::vector<Int> & etree_supno );
710 
711 
717 
718 
723 
728 
729 
734 
735 
764  void PreSelInv( );
765 
890  void SelInv( );
892  void SelInv_Collectives( );
894  void SelInv_P2p( );
897  void SelInv_Hybrid(Int threshold);
898 
899 
906  void GetDiagonal( NumVec<T>& diag );
907  void GetColumn ( Int colIdx, NumVec<T>& col );
908 
909 
916 
927  const DistSparseMatrix<T>& A,
928  DistSparseMatrix<T>& B );
929 
930 
942  const DistSparseMatrix<T>& A,
943  DistSparseMatrix<T>& B );
944 
945 
948  Int NnzLocal();
949 
952  LongInt Nnz();
953 
957  void GetNegativeInertia ( Real& inertia );
958 
959  };
960 
961 
962 
963 } // namespace PEXSI
964 
965 
966 #include "pselinv_impl.hpp"
967 
968 #endif //_PEXSI_PSELINV_HPP_
void PreSelInv()
PreSelInv prepares the structure in L_ and U_ so that SelInv only involves matrix-matrix multiplicati...
Definition: pselinv_impl.hpp:3819
Environmental variables.
Int blockIdx
Block index (supernodal index)
Definition: pselinv.hpp:187
void PMatrixToDistSparseMatrix(DistSparseMatrix< T > &A)
PMatrixToDistSparseMatrix converts the PMatrix into a distributed compressed sparse column matrix for...
Definition: pselinv_impl.hpp:4245
A thin interface for passing parameters to set the SuperLU options.
Definition: superlu_dist_internal.hpp:62
std::vector< LBlock< T > > & L(Int jLocal)
L returns the vector of nonzero L blocks for the local block column jLocal.
Definition: pselinv.hpp:678
SuperNodeType describes mapping between supernode and column, the permutation information, and potentially the elimination tree (not implemented here).
Definition: pselinv.hpp:122
Interface with SuperLU_Dist (version 3.0 and later)
void GetNegativeInertia(Real &inertia)
GetNegativeInertia computes the negative inertia of a PMatrix. This can be used to estimate e...
Int PROW(Int bnum, const GridType *g)
PROW returns the processor row that the bnum-th block (supernode) belongs to.
Definition: pselinv.hpp:241
Thin interface to LAPACK.
Int numRow
Number of nonzero rows.
Definition: pselinv.hpp:142
Int MYPROC(const GridType *g)
MYPROC returns the current processor rank.
Definition: pselinv.hpp:228
Int NumLocalBlockCol() const
NumLocalBlockCol returns the total number of block columns.
Definition: pselinv.hpp:649
Int PCOL(Int bnum, const GridType *g)
PCOL returns the processor column that the bnum-th block (supernode) belongs to.
Definition: pselinv.hpp:246
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:256
void SelInv_Hybrid(Int threshold)
Hybrid version of the selected inversion. This file is obsolete.
Int SuperSize(Int bnum, const SuperNodeType *s)
SuperSize returns the size of the block bnum.
Definition: pselinv.hpp:297
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:261
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:271
void ConstructCommunicationPattern_Hybrid()
ConstructCommunicationPattern_Hybrid constructs the communication pattern to be used later in the sel...
Int numCol
Number of nonzero columns.
Definition: pselinv.hpp:145
Int NumCol(const SuperNodeType *s)
NumCol returns the total number of columns for a supernodal partiiton.
Definition: pselinv.hpp:306
Int CountRecvFromCrossDiagonal(Int ksup)
CountRecvFromCrossDiagonal returns the number of cross diagonal processors with which current process...
Definition: pselinv.hpp:702
void GetDiagonal(NumVec< T > &diag)
GetDiagonal extracts the diagonal elements of the PMatrix.
Definition: pselinv_impl.hpp:4204
std::vector< std::vector< int > > & WorkingSet()
WorkingSet returns the ordered list of supernodes which could be done in parallel.
Definition: pselinv.hpp:686
Implementation of the parallel SelInv.
void SelInv_Collectives()
Collective communication version of the selected inversion.
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:292
void GetEtree(std::vector< Int > &etree_supno)
GetEtree computes the supernodal elimination tree to be used later in the pipelined selected inversio...
Definition: pselinv_impl.hpp:875
const GridType * Grid() const
Grid returns the GridType structure of the current PMatrix.
Definition: pselinv.hpp:670
LBlock stores a nonzero block in the lower triangular part or the diagonal part in PSelInv...
Definition: pselinv.hpp:136
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:251
void ConstructCommunicationPattern()
ConstructCommunicationPattern constructs the communication pattern to be used later in the selected i...
Definition: pselinv_impl.hpp:3356
Sparse matrix and Distributed sparse matrix in compressed column format.
void ConstructCommunicationPattern_P2p()
ConstructCommunicationPattern_P2p constructs the communication pattern to be used later in the select...
Definition: pselinv_impl.hpp:3364
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:266
GridType is the PSelInv way of defining the grid.
Definition: pselinv.hpp:85
Numerical matrix.
Interface with MPI to facilitate communication.
Int MYCOL(const GridType *g)
MYCOL returns my processor column.
Definition: pselinv.hpp:236
Int CountSendToCrossDiagonal(Int ksup)
CountSendToCrossDiagonal returns the number of cross diagonal processors with which current processor...
Definition: pselinv.hpp:698
Int NumLocalBlockRow() const
NumLocalBlockRow returns the total number of block rows.
Definition: pselinv.hpp:652
Various utility subroutines.
const SuperNodeType * SuperNode() const
SuperNode returns the supernodal partition of the current PMatrix.
Definition: pselinv.hpp:674
IntNumVec rows
Dimension numRow * 1, index (0-based) for the number of nonzero rows.
Definition: pselinv.hpp:148
Int numCol
Number of nonzero columns.
Definition: pselinv.hpp:193
UBlock stores a nonzero block in the upper triangular part in PSelInv.
Definition: pselinv.hpp:184
std::vector< UBlock< T > > & U(Int iLocal)
U returns the vector of nonzero U blocks for the local block row iLocal.
Definition: pselinv.hpp:682
Int FirstBlockCol(Int bnum, const SuperNodeType *s)
FirstBlockCol returns the first column of a block bnum.
Definition: pselinv.hpp:285
Int NnzLocal()
NnzLocal computes the number of nonzero elements (L and U) saved locally.
Definition: pselinv_impl.hpp:5086
Int blockIdx
Block index (supernodal index)
Definition: pselinv.hpp:139
Thin interface to BLAS.
PMatrix contains the main data structure and the computational routine for the parallel selected inve...
Definition: pselinv.hpp:482
Int BlockIdx(Int i, const SuperNodeType *s)
BlockIdx returns the block index of a column i.
Definition: pselinv.hpp:280
Int numRow
Number of nonzero rows.
Definition: pselinv.hpp:190
Int CountSendToRight(Int ksup)
CountSendToRight returns the number of processors to the right of current processor with which it has...
Definition: pselinv.hpp:690
Int CEILING(Int a, Int b)
CEILING is used for computing the storage space for local number of blocks.
Definition: pselinv.hpp:276
NumMat< T > nzval
Dimension numRow * numCol, nonzero elements.
Definition: pselinv.hpp:199
void ConstructCommunicationPattern_Collectives()
ConstructCommunicationPattern_Collectives constructs the communication pattern to be used later in th...
Int NumSuper(const SuperNodeType *s)
NumSuper returns the total number of supernodes.
Definition: pselinv.hpp:301
Numerical vector.
void SelInv_P2p()
Point-to-point version of the selected inversion.
Definition: pselinv_impl.hpp:3786
Int CountRecvFromBelow(Int ksup)
CountRecvFromBelow returns the number of processors below the current processor from which it receive...
Definition: pselinv.hpp:694
Int NumBlockL(Int jLocal) const
NumBlockL returns the number of nonzero L blocks for the local block column jLocal.
Definition: pselinv.hpp:663
NumMat< T > nzval
Dimension numRow * numCol, nonzero elements.
Definition: pselinv.hpp:151
IntNumVec cols
Dimension numRow * 1, index (0-based) for the number of nonzero rows.
Definition: pselinv.hpp:196
Int NumBlockU(Int iLocal) const
NumBlockU returns the number of nonzero U blocks for the local block row iLocal.
Definition: pselinv.hpp:667
void SelInv()
SelInv is the main function for the selected inversion.
Definition: pselinv_impl.hpp:3778
LongInt Nnz()
Nnz computes the total number of nonzero elements in the PMatrix.
Definition: pselinv_impl.hpp:5117
void PMatrixToDistSparseMatrix2(const DistSparseMatrix< T > &A, DistSparseMatrix< T > &B)
PMatrixToDistSparseMatrix2 is a more efficient version which performs the same job as PMatrixToDistSp...
Definition: pselinv_impl.hpp:4801
DistSparseMatrix describes a Sparse matrix in the compressed sparse column format (CSC) and distribut...
Definition: sparse_matrix.hpp:91
Int MYROW(const GridType *g)
MYROW returns my processor row.
Definition: pselinv.hpp:232