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 "pexsi/environment.hpp"
54 #include "pexsi/NumVec.hpp"
55 #include "pexsi/NumMat.hpp"
56 #include "pexsi/sparse_matrix.hpp"
57 
59 #include "pexsi/mpi_interf.hpp"
60 #include "pexsi/utility.hpp"
61 #include "pexsi/blas.hpp"
62 #include "pexsi/lapack.hpp"
63 #include "pexsi/TreeBcast.hpp"
64 
65 
66 #include <set>
67 
68 #define IDX_TO_TAG(lidx,tag) (SELINV_TAG_COUNT*(lidx)+(tag))
69 #define IDX_TO_TAG2(sidx,lidx,tag) (SELINV_TAG_COUNT*(sidx)+(tag))
70 #define TAG_TO_IDX(tag,typetag) (((tag)-(typetag))/SELINV_TAG_COUNT)
71 
72 
73 //#define LIST_BARRIER
74 //#define ALL_BARRIER
75 
76 
77 
78 namespace PEXSI{
79 
80  enum MSGTYPE {LSIZE=0,LROWSIZE,USIZE,UCOLSIZE,LCONTENT,LROWCONTENT,UCONTENT,UCOLCONTENT,MSGCOUNT};
81 
82  struct ULComparator {
83  IntNumVec & lookup;
84  ULComparator(IntNumVec & v):lookup(v){}
85  bool operator() (int i,int j) { return ((lookup)(i)<(lookup)(j));}
86  };
87 
88 
89 
90  typedef std::vector<bool> bitMask;
91  typedef std::map<bitMask , std::vector<Int> > bitMaskSet;
92 
93 
94  /**********************************************************************
95  * Basic PSelInv data structure
96  **********************************************************************/
97 
106  struct GridType{
107  // Data
108  MPI_Comm comm;
109  MPI_Comm rowComm;
110  MPI_Comm colComm;
111  Int mpirank;
112  Int mpisize;
113  Int numProcRow;
114  Int numProcCol;
115 
116  // Member function
117  GridType( MPI_Comm Bcomm, int nprow, int npcol );
118  ~GridType();
119  };
120 
144  IntNumVec perm;
145  IntNumVec permInv;
146  IntNumVec perm_r;
147  IntNumVec permInv_r;
148  IntNumVec superIdx;
149  IntNumVec superPtr;
150  IntNumVec etree;
151  };
152 
153 
158  template<typename T>
159  struct LBlock{
160  // Variables
162  Int blockIdx;
163 
165  Int numRow;
166 
168  Int numCol;
169 
172 
173 
176 
177  // Member functions;
178  LBlock() {
179  blockIdx = -1; numRow = 0; numCol =0;
180  nzval.Resize(0,0);
181  }
182  ~LBlock() {}
183  LBlock& operator = (const LBlock& LB) {
184  blockIdx = LB.blockIdx;
185  numRow = LB.numRow;
186  numCol = LB.numCol;
187  rows = LB.rows;
188  nzval = LB.nzval;
189  return *this;
190  }
191  friend std::ostream& operator<<(std::ostream& out, const LBlock& vec) // output
192  {
193  out << "(" << vec.blockIdx << ", " << vec.numRow << ", " << vec.numCol <<std::endl<< "rows " << vec.rows <<std::endl<< "nzval " <<std::endl<< vec.nzval << ")";
194  return out;
195  }
196 
197 
198  };
199 
210  template<typename T>
211  struct UBlock{
212  // Variables
214  Int blockIdx;
215 
217  Int numRow;
218 
220  Int numCol;
221 
224 
227 
228  // Member functions;
229  UBlock() {
230  blockIdx = -1; numRow = 0; numCol =0;
231  }
232  ~UBlock() {}
233  UBlock& operator = (const UBlock& UB) {
234  blockIdx = UB.blockIdx;
235  numRow = UB.numRow;
236  numCol = UB.numCol;
237  cols = UB.cols;
238  nzval = UB.nzval;
239  return *this;
240  }
241 
242  friend std::ostream& operator<<(std::ostream& out, const UBlock& vec) // output
243  {
244  out << "(" << vec.blockIdx << ", " << vec.numRow << ", " << vec.numCol <<std::endl<< "cols " << vec.cols <<std::endl<< "nzval " <<std::endl<< vec.nzval << ")";
245  return out;
246  }
247  };
248 
249  // *********************************************************************
250  // SuperLU style utility functions
251  //
252  // The SuperLU style macros are defined here as inline functions
253  // so that the code is more portable.
254  // *********************************************************************
255 
257  inline Int MYPROC( const GridType* g )
258  { return g->mpirank; }
259 
261  inline Int MYROW( const GridType* g )
262  { return g->mpirank / g->numProcCol; }
263 
265  inline Int MYCOL( const GridType* g )
266  { return g->mpirank % g->numProcCol; }
267 
270  inline Int PROW( Int bnum, const GridType* g )
271  { return bnum % g->numProcRow; }
272 
275  inline Int PCOL( Int bnum, const GridType* g )
276  { return bnum % g->numProcCol; }
277 
280  inline Int PNUM( Int i, Int j, const GridType* g )
281  { return (i%g->numProcRow) * g->numProcCol + j%g->numProcCol; }
282 
285  inline Int LBi( Int bnum, const GridType* g )
286  { return bnum / g->numProcRow; }
287 
290  inline Int LBj( Int bnum, const GridType* g)
291  { return bnum / g->numProcCol; }
292 
295  inline Int GBi( Int iLocal, const GridType* g )
296  { return iLocal * g->numProcRow + MYROW( g ); }
297 
300  inline Int GBj( Int jLocal, const GridType* g )
301  { return jLocal * g->numProcCol + MYCOL( g ); }
302 
305  inline Int CEILING( Int a, Int b )
306  { return (a%b) ? ( a/b + 1 ) : ( a/b ); }
307 
309  inline Int BlockIdx( Int i, const SuperNodeType *s )
310  { return s->superIdx[i]; }
311 
314  inline Int FirstBlockCol( Int bnum, const SuperNodeType *s )
315  { return s->superPtr[bnum]; }
316 
317 
321  inline Int FirstBlockRow( Int bnum, const SuperNodeType *s )
322  { return s->superPtr[bnum]; }
323 
324 
326  inline Int SuperSize( Int bnum, const SuperNodeType *s )
327  { return s->superPtr[bnum+1] - s->superPtr[bnum]; }
328 
330  inline Int NumSuper( const SuperNodeType *s )
331  { return s->superPtr.m() - 1; }
332 
335  inline Int NumCol( const SuperNodeType *s )
336  { return s->superIdx.m(); }
337 
338 
339  // *********************************************************************
340  // Serialize / Deserialize
341  // *********************************************************************
342 
343  // L part
344 
360  namespace LBlockMask{
361  enum {
362  BLOCKIDX,
363  NUMROW,
364  NUMCOL,
365  ROWS,
366  NZVAL,
367  TOTAL_NUMBER
368  };
369  }
370 
371 
372  template<typename T>
373  Int inline serialize(LBlock<T>& val, std::ostream& os, const std::vector<Int>& mask){
374  if(mask[LBlockMask::BLOCKIDX]==1) serialize(val.blockIdx, os, mask);
375  if(mask[LBlockMask::NUMROW ]==1) serialize(val.numRow, os, mask);
376  if(mask[LBlockMask::NUMCOL ]==1) serialize(val.numCol, os, mask);
377  if(mask[LBlockMask::ROWS ]==1) serialize(val.rows, os, mask);
378  if(mask[LBlockMask::NZVAL ]==1) serialize(val.nzval, os, mask);
379  return 0;
380  }
381 
382  template<typename T>
383  Int inline deserialize(LBlock<T>& val, std::istream& is, const std::vector<Int>& mask){
384  if(mask[LBlockMask::BLOCKIDX]==1) deserialize(val.blockIdx, is, mask);
385  if(mask[LBlockMask::NUMROW ]==1) deserialize(val.numRow, is, mask);
386  if(mask[LBlockMask::NUMCOL ]==1) deserialize(val.numCol, is, mask);
387  if(mask[LBlockMask::ROWS ]==1) deserialize(val.rows, is, mask);
388  if(mask[LBlockMask::NZVAL ]==1) deserialize(val.nzval, is, mask);
389  return 0;
390  }
391 
392  // U part
408  namespace UBlockMask{
409  enum {
410  BLOCKIDX,
411  NUMROW,
412  NUMCOL,
413  COLS,
414  NZVAL,
415  TOTAL_NUMBER
416  };
417  }
418 
419  template<typename T>
420  Int inline serialize(UBlock<T>& val, std::ostream& os, const std::vector<Int>& mask){
421  Int i = 0;
422  if(mask[i]==1) serialize(val.blockIdx, os, mask); i++;
423  if(mask[i]==1) serialize(val.numRow, os, mask); i++;
424  if(mask[i]==1) serialize(val.numCol, os, mask); i++;
425  if(mask[i]==1) serialize(val.cols, os, mask); i++;
426  if(mask[i]==1) serialize(val.nzval, os, mask); i++;
427  return 0;
428  }
429 
430  template<typename T>
431  Int inline deserialize(UBlock<T>& val, std::istream& is, const std::vector<Int>& mask){
432  Int i = 0;
433  if(mask[i]==1) deserialize(val.blockIdx, is, mask); i++;
434  if(mask[i]==1) deserialize(val.numRow, is, mask); i++;
435  if(mask[i]==1) deserialize(val.numCol, is, mask); i++;
436  if(mask[i]==1) deserialize(val.cols, is, mask); i++;
437  if(mask[i]==1) deserialize(val.nzval, is, mask); i++;
438  return 0;
439  }
440 
441  /**********************************************************************
442  * Main data structure in PSelInv: PMatrix
443  **********************************************************************/
444 
506 
507  template<typename T>
508  class PMatrix{
509  public:
511  static PMatrix<T> * Create(const GridType * pGridType, const SuperNodeType * pSuper, const SuperLUOptions * pLuOpt);
512  static PMatrix<T> * Create(const SuperLUOptions * pLuOpt);
513 
514  public:
515  // This is the tag used for mpi communication for selinv
516 
517  enum{
518  SELINV_TAG_U_SIZE,
519  SELINV_TAG_U_CONTENT,
520  SELINV_TAG_L_SIZE,
521  SELINV_TAG_L_CONTENT,
522  SELINV_TAG_L_REDUCE,
523  SELINV_TAG_D_SIZE,
524  SELINV_TAG_D_CONTENT,
525  SELINV_TAG_D_REDUCE,
526  SELINV_TAG_L_SIZE_CD,
527  SELINV_TAG_L_CONTENT_CD,
528  SELINV_TAG_COUNT
529  };
530 
531 
532  protected:
533  // *********************************************************************
534  // Variables
535  // *********************************************************************
536  // Data variables
537 
538  const GridType* grid_;
539 
540  const SuperNodeType* super_;
541 
542  const SuperLUOptions * options_;
543 
544  std::vector<std::vector<Int> > ColBlockIdx_;
545  std::vector<std::vector<Int> > RowBlockIdx_;
546  std::vector<std::vector<LBlock<T> > > L_;
547  std::vector<std::vector<UBlock<T> > > U_;
548 
549  std::vector<std::vector<Int> > workingSet_;
550 
551 
552  // Communication variables
553  BolNumMat isSendToBelow_;
554  BolNumMat isSendToRight_;
555  BolNumVec isSendToDiagonal_;
556  BolNumMat isSendToCrossDiagonal_;
557 
558  BolNumMat isRecvFromBelow_;
559  BolNumVec isRecvFromAbove_;
560  BolNumVec isRecvFromLeft_;
561  BolNumMat isRecvFromCrossDiagonal_;
562 
563 
564  std::vector<TreeBcast *> fwdToBelowTree_;
565  std::vector<TreeBcast *> fwdToRightTree_;
566  std::vector<TreeReduce<T> *> redToLeftTree_;
567  std::vector<TreeReduce<T> *> redToAboveTree_;
568 
570  NumMat<T> LUpdateBuf;
571  NumMat<T> DiagBuf;
572  std::vector<Int> RowLocalPtr;
573  std::vector<Int> BlockIdxLocal;
574  std::vector<char> SstrLcolSend;
575  std::vector<char> SstrUrowSend;
576  std::vector<char> SstrLcolRecv;
577  std::vector<char> SstrUrowRecv;
578  Int SizeSstrLcolSend;
579  Int SizeSstrUrowSend;
580  Int SizeSstrLcolRecv;
581  Int SizeSstrUrowRecv;
582  Int Index;
583  Int isReady;
584 
585 
587  SizeSstrLcolSend(0),
588  SizeSstrUrowSend(0),
589  SizeSstrLcolRecv(0),
590  SizeSstrUrowRecv(0),
591  Index(0),
592  isReady(0){}
593 
594  SuperNodeBufferType(Int &pIndex) :
595  SizeSstrLcolSend(0),
596  SizeSstrUrowSend(0),
597  SizeSstrLcolRecv(0),
598  SizeSstrUrowRecv(0),
599  Index(pIndex),
600  isReady(0) {}
601 
602  };
603 
604 
606  inline void SelInvIntra_P2p(Int lidx);
607 
609  inline void SelInv_lookup_indexes(SuperNodeBufferType & snode, std::vector<LBlock<T> > & LcolRecv, std::vector<UBlock<T> > & UrowRecv, NumMat<T> & AinvBuf,NumMat<T> & UBuf);
610 
612  inline void GetWorkSet(std::vector<Int> & snodeEtree, std::vector<std::vector<Int> > & WSet);
613 
615  inline void UnpackData(SuperNodeBufferType & snode, std::vector<LBlock<T> > & LcolRecv, std::vector<UBlock<T> > & UrowRecv);
616 
618  inline void ComputeDiagUpdate(SuperNodeBufferType & snode);
619 
621  inline void SendRecvCD_UpdateU(std::vector<SuperNodeBufferType > & arrSuperNodes, Int stepSuper);
622 
623  public:
624  // *********************************************************************
625  // Public member functions
626  // *********************************************************************
627 
628  PMatrix() {}
629 
630  PMatrix( const GridType* g, const SuperNodeType* s, const PEXSI::SuperLUOptions * o );
631 
632  void deallocate();
633  virtual ~PMatrix();
634  PMatrix( const PMatrix & C);
635  PMatrix & operator = ( const PMatrix & C);
636 
637  void Setup( const GridType* g, const SuperNodeType* s, const PEXSI::SuperLUOptions * o );
638 
639  Int NumCol() const { return super_ -> superIdx.m(); }
640 
641  Int NumSuper() const { return super_ ->superPtr.m() - 1; }
642 
644  Int NumLocalBlockCol() const { return CEILING( this->NumSuper(), grid_->numProcCol ); }
645 
647  Int NumLocalBlockRow() const { return CEILING( this->NumSuper(), grid_->numProcRow); }
648 
649 
650  std::vector< std::vector<Int> > & ColBlockIdx() { return ColBlockIdx_; }
651  std::vector< std::vector<Int> > & RowBlockIdx() { return RowBlockIdx_; }
652  std::vector<Int> & ColBlockIdx(Int jLocal) { return ColBlockIdx_[jLocal]; }
653  std::vector<Int> & RowBlockIdx(Int iLocal) { return RowBlockIdx_[iLocal]; }
654 
655 
658  Int NumBlockL( Int jLocal ) const { return L_[jLocal].size(); }
659 
662  Int NumBlockU( Int iLocal ) const { return U_[iLocal].size(); }
663 
665  const GridType* Grid() const { return grid_; }
666 
669  const SuperNodeType* SuperNode() const { return super_; }
670 
673  std::vector<LBlock<T> >& L( Int jLocal ) { return L_[jLocal]; }
674 
677  std::vector<UBlock<T> >& U( Int iLocal ) { return U_[iLocal]; }
678 
681  std::vector<std::vector<int> >& WorkingSet( ) { return workingSet_; }
682 
685  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); }
686 
689  Int CountSendToBelow(Int ksup) { Int count= std::count (isSendToBelow_.VecData(ksup), isSendToBelow_.VecData(ksup) + grid_->numProcRow, true); return (isSendToBelow_(MYROW(grid_),ksup)?count-1:count); }
690 
693  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); }
694 
697  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); }
698 
701  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); }
702 
703 
704 
705 
708  void GetEtree(std::vector<Int> & etree_supno );
709 
710 
715  virtual void ConstructCommunicationPattern( );
716 
717 
722 
723 
724 
753  virtual void PreSelInv( );
754 
879  virtual void SelInv( );
880 
882  void SelInv_P2p( );
883 
884 
891  void GetDiagonal( NumVec<T>& diag );
892  void GetColumn ( Int colIdx, NumVec<T>& col );
893 
894 
901 
912  const DistSparseMatrix<T>& A,
913  DistSparseMatrix<T>& B );
914 
915 
927  const DistSparseMatrix<T>& A,
928  DistSparseMatrix<T>& B );
929 
930 
933  Int NnzLocal();
934 
937  LongInt Nnz();
938 
942  void GetNegativeInertia ( Real& inertia );
943 
944  inline int IdxToTag(Int lidx, Int tag) { return SELINV_TAG_COUNT*(lidx)+(tag);}
945  };
946 
947 
948 
949 } // namespace PEXSI
950 
951 
952 #include "pexsi/pselinv_impl.hpp"
953 
954 
955 #endif //_PEXSI_PSELINV_HPP_
virtual void PreSelInv()
PreSelInv prepares the structure in L_ and U_ so that SelInv only involves matrix-matrix multiplicati...
Definition: pselinv_impl.hpp:2668
Environmental variables.
Int blockIdx
Block index (supernodal index)
Definition: pselinv.hpp:214
void PMatrixToDistSparseMatrix(DistSparseMatrix< T > &A)
PMatrixToDistSparseMatrix converts the PMatrix into a distributed compressed sparse column matrix for...
Definition: pselinv_impl.hpp:3129
void SelInvIntra_P2p(Int lidx)
SelInvIntra_P2p.
Definition: pselinv_impl.hpp:1202
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:673
SuperNodeType describes mapping between supernode and column, the permutation information, and potentially the elimination tree (not implemented here).
Definition: pselinv.hpp:143
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:270
Thin interface to LAPACK.
Int numRow
Number of nonzero rows.
Definition: pselinv.hpp:165
void UnpackData(SuperNodeBufferType &snode, std::vector< LBlock< T > > &LcolRecv, std::vector< UBlock< T > > &UrowRecv)
UnpackData.
Definition: pselinv_impl.hpp:965
Int MYPROC(const GridType *g)
MYPROC returns the current processor rank.
Definition: pselinv.hpp:257
Int NumLocalBlockCol() const
NumLocalBlockCol returns the total number of block columns.
Definition: pselinv.hpp:644
Int PCOL(Int bnum, const GridType *g)
PCOL returns the processor column that the bnum-th block (supernode) belongs to.
Definition: pselinv.hpp:275
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:285
Int SuperSize(Int bnum, const SuperNodeType *s)
SuperSize returns the size of the block bnum.
Definition: pselinv.hpp:326
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:290
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:300
Int numCol
Number of nonzero columns.
Definition: pselinv.hpp:168
Int NumCol(const SuperNodeType *s)
NumCol returns the total number of columns for a supernodal partiiton.
Definition: pselinv.hpp:335
Definition: pselinv.hpp:569
Int CountRecvFromCrossDiagonal(Int ksup)
CountRecvFromCrossDiagonal returns the number of cross diagonal processors with which current process...
Definition: pselinv.hpp:701
void GetDiagonal(NumVec< T > &diag)
GetDiagonal extracts the diagonal elements of the PMatrix.
Definition: pselinv_impl.hpp:3071
std::vector< std::vector< int > > & WorkingSet()
WorkingSet returns the ordered list of supernodes which could be done in parallel.
Definition: pselinv.hpp:681
Implementation of the parallel SelInv.
void GetWorkSet(std::vector< Int > &snodeEtree, std::vector< std::vector< Int > > &WSet)
GetWorkSet.
Definition: pselinv_impl.hpp:1125
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:321
Definition: pselinv.hpp:82
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:1058
const GridType * Grid() const
Grid returns the GridType structure of the current PMatrix.
Definition: pselinv.hpp:665
LBlock stores a nonzero block in the lower triangular part or the diagonal part in PSelInv...
Definition: pselinv.hpp:159
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:280
virtual void ConstructCommunicationPattern()
ConstructCommunicationPattern constructs the communication pattern to be used later in the selected i...
Definition: pselinv_impl.hpp:1942
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:1950
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:295
GridType is the PSelInv way of defining the grid.
Definition: pselinv.hpp:106
Numerical matrix.
Interface with MPI to facilitate communication.
Int MYCOL(const GridType *g)
MYCOL returns my processor column.
Definition: pselinv.hpp:265
Int CountSendToCrossDiagonal(Int ksup)
CountSendToCrossDiagonal returns the number of cross diagonal processors with which current processor...
Definition: pselinv.hpp:697
Int NumLocalBlockRow() const
NumLocalBlockRow returns the total number of block rows.
Definition: pselinv.hpp:647
Various utility subroutines.
const SuperNodeType * SuperNode() const
SuperNode returns the supernodal partition of the current PMatrix.
Definition: pselinv.hpp:669
static PMatrix< T > * Create(const GridType *pGridType, const SuperNodeType *pSuper, const SuperLUOptions *pLuOpt)
Create is a factory method which returns a pointer to a new PMatrix.
Definition: pselinv_impl.hpp:4158
IntNumVec rows
Dimension numRow * 1, index (0-based) for the number of nonzero rows.
Definition: pselinv.hpp:171
Int numCol
Number of nonzero columns.
Definition: pselinv.hpp:220
UBlock stores a nonzero block in the upper triangular part in PSelInv.
Definition: pselinv.hpp:211
std::vector< UBlock< T > > & U(Int iLocal)
U returns the vector of nonzero U blocks for the local block row iLocal.
Definition: pselinv.hpp:677
Int FirstBlockCol(Int bnum, const SuperNodeType *s)
FirstBlockCol returns the first column of a block bnum.
Definition: pselinv.hpp:314
Int NnzLocal()
NnzLocal computes the number of nonzero elements (L and U) saved locally.
Definition: pselinv_impl.hpp:4042
Int blockIdx
Block index (supernodal index)
Definition: pselinv.hpp:162
Thin interface to BLAS.
PMatrix contains the main data structure and the computational routine for the parallel selected inve...
Definition: ngchol_interf.hpp:57
void SendRecvCD_UpdateU(std::vector< SuperNodeBufferType > &arrSuperNodes, Int stepSuper)
SendRecvCD_UpdateU.
Definition: pselinv_impl.hpp:742
Int BlockIdx(Int i, const SuperNodeType *s)
BlockIdx returns the block index of a column i.
Definition: pselinv.hpp:309
Int numRow
Number of nonzero rows.
Definition: pselinv.hpp:217
Int CountSendToRight(Int ksup)
CountSendToRight returns the number of processors to the right of current processor with which it has...
Definition: pselinv.hpp:685
Int CountSendToBelow(Int ksup)
CountSendToBelow returns the number of processors below current processor with which it has to commun...
Definition: pselinv.hpp:689
Int CEILING(Int a, Int b)
CEILING is used for computing the storage space for local number of blocks.
Definition: pselinv.hpp:305
NumMat< T > nzval
Dimension numRow * numCol, nonzero elements.
Definition: pselinv.hpp:226
Int NumSuper(const SuperNodeType *s)
NumSuper returns the total number of supernodes.
Definition: pselinv.hpp:330
Numerical vector.
void SelInv_P2p()
Point-to-point version of the selected inversion.
Definition: pselinv_impl.hpp:2633
Int CountRecvFromBelow(Int ksup)
CountRecvFromBelow returns the number of processors below the current processor from which it receive...
Definition: pselinv.hpp:693
Int NumBlockL(Int jLocal) const
NumBlockL returns the number of nonzero L blocks for the local block column jLocal.
Definition: pselinv.hpp:658
NumMat< T > nzval
Dimension numRow * numCol, nonzero elements.
Definition: pselinv.hpp:175
IntNumVec cols
Dimension numRow * 1, index (0-based) for the number of nonzero rows.
Definition: pselinv.hpp:223
Int NumBlockU(Int iLocal) const
NumBlockU returns the number of nonzero U blocks for the local block row iLocal.
Definition: pselinv.hpp:662
virtual void SelInv()
SelInv is the main function for the selected inversion.
Definition: pselinv_impl.hpp:2608
LongInt Nnz()
Nnz computes the total number of nonzero elements in the PMatrix.
Definition: pselinv_impl.hpp:4073
void SelInv_lookup_indexes(SuperNodeBufferType &snode, std::vector< LBlock< T > > &LcolRecv, std::vector< UBlock< T > > &UrowRecv, NumMat< T > &AinvBuf, NumMat< T > &UBuf)
SelInv_lookup_indexes.
Definition: pselinv_impl.hpp:385
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:3732
void ComputeDiagUpdate(SuperNodeBufferType &snode)
ComputeDiagUpdate.
Definition: pselinv_impl.hpp:1019
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:261