PEXSI
 All Classes Namespaces Files Functions Variables Friends Pages
superlu_dist_interf.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  Author: Lin Lin
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 _SUPERLU_DIST_INTERF_HPP_
47 #define _SUPERLU_DIST_INTERF_HPP_
48 
49 // Interface with PSelInv
50 #include "pselinv.hpp"
51 
52 // Interface with sparse matrix (CSC format)
53 #include "sparse_matrix_impl.hpp"
54 
55 // Interface with LAPACK
56 #include "lapack.hpp"
57 
58 namespace PEXSI{
59  struct SuperNodeType;
60  class PMatrix;
61 
64  class SuperLUGrid{
66  friend class SuperLUMatrix;
67  private:
68  struct GridData;
69  GridData* ptrData;
70  public:
71  SuperLUGrid( MPI_Comm comm, int nprow, int npcol );
72 
73  ~SuperLUGrid();
74 
75  };
76 
77 
94 
107  std::string ColPerm;
108 
109  // Member functions to setup the default value
110  SuperLUOptions(): numProcSymbFact(0), maxPipelineDepth(-1), ColPerm("MMD_AT_PLUS_A") {}
111  };
112 
118  private:
126  struct SuperLUData;
128  SuperLUData* ptrData;
129  public:
130 
131  SuperLUMatrix( const SuperLUGrid& g, const SuperLUOptions& opt = SuperLUOptions() );
132  ~SuperLUMatrix();
133 
134  Int m() const;
135 
136  Int n() const;
137 
157 
167  void DestroyAOnly();
168 
178  void SymbolicFactorize();
179 
185  void Distribute();
186 
193  void NumericalFactorize();
194 
199  void ConvertNRlocToNC( SuperLUMatrix& AGlobal );
200 
207  void MultiplyGlobalMultiVector( NumMat<Scalar>& xGlobal, NumMat<Scalar>& bGlobal );
208 
215 
216  void GatherDistributedMultiVector ( NumMat<Scalar>& xGlobal, NumMat<Scalar>& xLocal );
217 
223  void SolveDistMultiVector( NumMat<Scalar>& bLocal, DblNumVec& berr );
224 
225 
231  void CheckErrorDistMultiVector( NumMat<Scalar>& xLocal, NumMat<Scalar>& xTrueLocal );
232 
236  void LUstructToPMatrix( PMatrix& PMloc );
237 
242  void SymbolicToSuperNode( SuperNodeType& super );
243  };
244 
245 
246 
247 
248 
249 } // namespace PEXSI
250 
251 #endif // _SUPERLU_DIST_INTERF_HPP_
252 
void DestroyAOnly()
Releases the data in A but keeps other data, such as LUstruct.
Definition: superlu_dist_interf.cpp:341
A thin interface for passing parameters to set the SuperLU options.
Definition: superlu_dist_interf.hpp:82
SuperNodeType describes mapping between supernode and column, the permutation information, and potentially the elimination tree (not implemented here).
Definition: pselinv.hpp:121
Thin interface to LAPACK.
Definition: superlu_dist_interf.cpp:72
void ConvertNRlocToNC(SuperLUMatrix &AGlobal)
ConvertNRlocToNC converts a distributed compressed sparse row matrix to a global compressed sparse co...
Definition: superlu_dist_interf.cpp:496
void CheckErrorDistMultiVector(NumMat< Scalar > &xLocal, NumMat< Scalar > &xTrueLocal)
Prints out the error by direct comparison with the true solution in distributed format.
Definition: superlu_dist_interf.cpp:671
void DistSparseMatrixToSuperMatrixNRloc(DistSparseMatrix< Scalar > &sparseA)
Convert a distributed sparse matrix in compressed sparse column format into the SuperLU compressed ro...
Definition: superlu_dist_interf.cpp:283
void Distribute()
Distribute redistrbutes the SuperMatrix in parallel so that it is ready for the numerical factorizati...
Definition: superlu_dist_interf.cpp:425
Main file for parallel selected inversion.
An thin interface to keep the main code insulated from the source code of SuperLU.
Definition: superlu_dist_interf.hpp:117
Int maxPipelineDepth
The maximum pipeline depth.
Definition: superlu_dist_interf.hpp:93
void SymbolicFactorize()
Factorizes the superlu matrix symbolically.
Definition: superlu_dist_interf.cpp:371
void LUstructToPMatrix(PMatrix &PMloc)
LUstructToPMatrix converts the data in LUstruct to PMatrix.
Definition: superlu_dist_interf.cpp:693
Data of a matrix in the SuperLU format.
Definition: superlu_dist_interf.cpp:121
void NumericalFactorize()
Performs LU factorization numerically.
Definition: superlu_dist_interf.cpp:462
void MultiplyGlobalMultiVector(NumMat< Scalar > &xGlobal, NumMat< Scalar > &bGlobal)
MultiplyGlobalMultiVector computes b = A * x.
Definition: superlu_dist_interf.cpp:523
std::string ColPerm
Option of matrix permutation strategy.
Definition: superlu_dist_interf.hpp:107
void SymbolicToSuperNode(SuperNodeType &super)
SymbolicToSuperNode converts the symbolic information to SuperNode structure in SelInv.
Definition: superlu_dist_interf.cpp:869
PMatrix contains the main data structure and the computational routine for the parallel selected inve...
Definition: pselinv.hpp:473
Int numProcSymbFact
Number of processors for parallel symbolic factorization.
Definition: superlu_dist_interf.hpp:88
void DistributeGlobalMultiVector(NumMat< Scalar > &xGlobal, NumMat< Scalar > &xLocal)
DistributeGlobalMultiVector distributes a global multivector into a local multivector according to th...
Definition: superlu_dist_interf.cpp:551
Implementation of sparse matrices.
A thin interface for the gridinfo_t strucutre in SuperLU.
Definition: superlu_dist_interf.hpp:64
void SolveDistMultiVector(NumMat< Scalar > &bLocal, DblNumVec &berr)
Solve A x = b with b overwritten by x for distributed multivector.
Definition: superlu_dist_interf.cpp:628
DistSparseMatrix describes a Sparse matrix in the compressed sparse column format (CSC) and distribut...
Definition: sparse_matrix_decl.hpp:91