Actual source code: matregis.c
1: /* Portions of this code are under:
2: Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
3: */
4: #include <petsc/private/matimpl.h>
6: PETSC_EXTERN PetscErrorCode MatCreate_MFFD(Mat);
7: PETSC_EXTERN PetscErrorCode MatCreate_MAIJ(Mat);
8: PETSC_EXTERN PetscErrorCode MatCreate_KAIJ(Mat);
9: PETSC_EXTERN PetscErrorCode MatCreate_IS(Mat);
10: PETSC_EXTERN PetscErrorCode MatCreate_LRC(Mat);
12: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJ(Mat);
13: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJ(Mat);
15: PETSC_EXTERN PetscErrorCode MatCreate_SeqBAIJ(Mat);
16: PETSC_EXTERN PetscErrorCode MatCreate_MPIBAIJ(Mat);
18: PETSC_EXTERN PetscErrorCode MatCreate_SeqSBAIJ(Mat);
19: PETSC_EXTERN PetscErrorCode MatCreate_MPISBAIJ(Mat);
21: PETSC_INTERN PetscErrorCode MatCreate_SeqDense(Mat);
22: PETSC_INTERN PetscErrorCode MatCreate_MPIDense(Mat);
23: #if defined(PETSC_HAVE_CUDA)
24: PETSC_INTERN PetscErrorCode MatCreate_SeqDenseCUDA(Mat);
25: PETSC_INTERN PetscErrorCode MatCreate_MPIDenseCUDA(Mat);
26: #endif
28: #if defined(PETSC_HAVE_HIP)
29: PETSC_INTERN PetscErrorCode MatCreate_SeqDenseHIP(Mat);
30: PETSC_INTERN PetscErrorCode MatCreate_MPIDenseHIP(Mat);
31: #endif
33: PETSC_EXTERN PetscErrorCode MatCreate_MPIAdj(Mat);
34: PETSC_EXTERN PetscErrorCode MatCreate_Shell(Mat);
35: PETSC_EXTERN PetscErrorCode MatCreate_Composite(Mat);
37: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJPERM(Mat);
38: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJPERM(Mat);
40: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJSELL(Mat);
41: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJSELL(Mat);
43: #if defined(PETSC_HAVE_MKL_SPARSE)
44: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJMKL(Mat);
45: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJMKL(Mat);
46: #endif
48: #if defined(PETSC_HAVE_MKL_SPARSE_OPTIMIZE)
49: PETSC_EXTERN PetscErrorCode MatCreate_SeqBAIJMKL(Mat);
50: PETSC_EXTERN PetscErrorCode MatCreate_MPIBAIJMKL(Mat);
51: #endif
53: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJCRL(Mat);
54: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJCRL(Mat);
56: PETSC_EXTERN PetscErrorCode MatCreate_Scatter(Mat);
57: PETSC_EXTERN PetscErrorCode MatCreate_BlockMat(Mat);
58: PETSC_EXTERN PetscErrorCode MatCreate_Nest(Mat);
60: PETSC_EXTERN PetscErrorCode MatCreate_SeqSELL(Mat);
61: PETSC_EXTERN PetscErrorCode MatCreate_MPISELL(Mat);
63: #if defined(PETSC_HAVE_CUDA)
64: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJCUSPARSE(Mat);
65: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJCUSPARSE(Mat);
66: PETSC_EXTERN PetscErrorCode MatCreate_SeqSELLCUDA(Mat);
67: PETSC_EXTERN PetscErrorCode MatCreate_MPISELLCUDA(Mat);
68: #endif
70: #if defined(PETSC_HAVE_HIP)
71: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJHIPSPARSE(Mat);
72: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJHIPSPARSE(Mat);
73: PETSC_EXTERN PetscErrorCode MatCreate_SeqSELLHIP(Mat);
74: PETSC_EXTERN PetscErrorCode MatCreate_MPISELLHIP(Mat);
75: #endif
77: #if defined(PETSC_HAVE_VIENNACL)
78: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJViennaCL(Mat);
79: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJViennaCL(Mat);
80: #endif
82: #if defined(PETSC_HAVE_KOKKOS_KERNELS)
83: PETSC_EXTERN PetscErrorCode MatCreate_SeqAIJKokkos(Mat);
84: PETSC_EXTERN PetscErrorCode MatCreate_MPIAIJKokkos(Mat);
85: #endif
87: #if defined(PETSC_HAVE_FFTW)
88: PETSC_EXTERN PetscErrorCode MatCreate_FFTW(Mat);
89: #endif
90: #if defined(PETSC_HAVE_ELEMENTAL)
91: PETSC_EXTERN PetscErrorCode MatCreate_Elemental(Mat);
92: #endif
93: #if defined(PETSC_HAVE_SCALAPACK)
94: PETSC_EXTERN PetscErrorCode MatCreate_ScaLAPACK(Mat);
95: #endif
97: PETSC_EXTERN PetscErrorCode MatCreate_Preallocator(Mat);
98: PETSC_EXTERN PetscErrorCode MatCreate_Dummy(Mat);
100: #if defined(PETSC_HAVE_HYPRE)
101: PETSC_EXTERN PetscErrorCode MatCreate_HYPRE(Mat);
102: #endif
104: PETSC_EXTERN PetscErrorCode MatCreate_ConstantDiagonal(Mat);
105: PETSC_INTERN PetscErrorCode MatCreate_Diagonal(Mat);
107: #if defined(PETSC_HAVE_H2OPUS)
108: PETSC_EXTERN PetscErrorCode MatCreate_H2OPUS(Mat);
109: #endif
111: #if defined(PETSC_HAVE_HTOOL)
112: PETSC_EXTERN PetscErrorCode MatCreate_Htool(Mat);
113: #endif
115: /*@C
116: MatRegisterAll - Registers all of the matrix types in PETSc
118: Not Collective
120: Level: advanced
122: .seealso: `MatType`, `MatSetType()`, `MatRegister()`
123: @*/
124: PetscErrorCode MatRegisterAll(void)
125: {
126: PetscFunctionBegin;
127: if (MatRegisterAllCalled) PetscFunctionReturn(PETSC_SUCCESS);
128: MatRegisterAllCalled = PETSC_TRUE;
130: PetscCall(MatRegister(MATMFFD, MatCreate_MFFD));
132: PetscCall(MatRegister(MATMPIMAIJ, MatCreate_MAIJ));
133: PetscCall(MatRegister(MATSEQMAIJ, MatCreate_MAIJ));
134: PetscCall(MatRegister(MATMAIJ, MatCreate_MAIJ));
136: PetscCall(MatRegister(MATMPIKAIJ, MatCreate_KAIJ));
137: PetscCall(MatRegister(MATSEQKAIJ, MatCreate_KAIJ));
138: PetscCall(MatRegister(MATKAIJ, MatCreate_KAIJ));
140: PetscCall(MatRegister(MATIS, MatCreate_IS));
141: PetscCall(MatRegister(MATSHELL, MatCreate_Shell));
142: PetscCall(MatRegister(MATCOMPOSITE, MatCreate_Composite));
143: PetscCall(MatRegister(MATLRC, MatCreate_LRC));
145: PetscCall(MatRegisterRootName(MATAIJ, MATSEQAIJ, MATMPIAIJ));
146: PetscCall(MatRegister(MATMPIAIJ, MatCreate_MPIAIJ));
147: PetscCall(MatRegister(MATSEQAIJ, MatCreate_SeqAIJ));
149: PetscCall(MatRegisterRootName(MATAIJPERM, MATSEQAIJPERM, MATMPIAIJPERM));
150: PetscCall(MatRegister(MATMPIAIJPERM, MatCreate_MPIAIJPERM));
151: PetscCall(MatRegister(MATSEQAIJPERM, MatCreate_SeqAIJPERM));
153: PetscCall(MatRegisterRootName(MATAIJSELL, MATSEQAIJSELL, MATMPIAIJSELL));
154: PetscCall(MatRegister(MATMPIAIJSELL, MatCreate_MPIAIJSELL));
155: PetscCall(MatRegister(MATSEQAIJSELL, MatCreate_SeqAIJSELL));
157: #if defined(PETSC_HAVE_MKL_SPARSE)
158: PetscCall(MatRegisterRootName(MATAIJMKL, MATSEQAIJMKL, MATMPIAIJMKL));
159: PetscCall(MatRegister(MATMPIAIJMKL, MatCreate_MPIAIJMKL));
160: PetscCall(MatRegister(MATSEQAIJMKL, MatCreate_SeqAIJMKL));
161: #endif
163: #if defined(PETSC_HAVE_MKL_SPARSE_OPTIMIZE)
164: PetscCall(MatRegisterRootName(MATBAIJMKL, MATSEQBAIJMKL, MATMPIBAIJMKL));
165: PetscCall(MatRegister(MATMPIBAIJMKL, MatCreate_MPIBAIJMKL));
166: PetscCall(MatRegister(MATSEQBAIJMKL, MatCreate_SeqBAIJMKL));
167: #endif
169: PetscCall(MatRegisterRootName(MATAIJCRL, MATSEQAIJCRL, MATMPIAIJCRL));
170: PetscCall(MatRegister(MATSEQAIJCRL, MatCreate_SeqAIJCRL));
171: PetscCall(MatRegister(MATMPIAIJCRL, MatCreate_MPIAIJCRL));
173: PetscCall(MatRegisterRootName(MATBAIJ, MATSEQBAIJ, MATMPIBAIJ));
174: PetscCall(MatRegister(MATMPIBAIJ, MatCreate_MPIBAIJ));
175: PetscCall(MatRegister(MATSEQBAIJ, MatCreate_SeqBAIJ));
177: PetscCall(MatRegisterRootName(MATSBAIJ, MATSEQSBAIJ, MATMPISBAIJ));
178: PetscCall(MatRegister(MATMPISBAIJ, MatCreate_MPISBAIJ));
179: PetscCall(MatRegister(MATSEQSBAIJ, MatCreate_SeqSBAIJ));
181: PetscCall(MatRegisterRootName(MATDENSE, MATSEQDENSE, MATMPIDENSE));
182: PetscCall(MatRegister(MATMPIDENSE, MatCreate_MPIDense));
183: PetscCall(MatRegister(MATSEQDENSE, MatCreate_SeqDense));
184: #if defined(PETSC_HAVE_CUDA)
185: PetscCall(MatRegisterRootName(MATDENSECUDA, MATSEQDENSECUDA, MATMPIDENSECUDA));
186: PetscCall(MatRegister(MATSEQDENSECUDA, MatCreate_SeqDenseCUDA));
187: PetscCall(MatRegister(MATMPIDENSECUDA, MatCreate_MPIDenseCUDA));
188: #endif
190: #if defined(PETSC_HAVE_HIP)
191: PetscCall(MatRegisterRootName(MATDENSEHIP, MATSEQDENSEHIP, MATMPIDENSEHIP));
192: PetscCall(MatRegister(MATSEQDENSEHIP, MatCreate_SeqDenseHIP));
193: PetscCall(MatRegister(MATMPIDENSEHIP, MatCreate_MPIDenseHIP));
194: #endif
196: PetscCall(MatRegister(MATMPIADJ, MatCreate_MPIAdj));
197: PetscCall(MatRegister(MATSCATTER, MatCreate_Scatter));
198: PetscCall(MatRegister(MATBLOCKMAT, MatCreate_BlockMat));
199: PetscCall(MatRegister(MATNEST, MatCreate_Nest));
201: PetscCall(MatRegisterRootName(MATSELL, MATSEQSELL, MATMPISELL));
202: PetscCall(MatRegister(MATMPISELL, MatCreate_MPISELL));
203: PetscCall(MatRegister(MATSEQSELL, MatCreate_SeqSELL));
205: #if defined(PETSC_HAVE_CUDA)
206: PetscCall(MatRegisterRootName(MATAIJCUSPARSE, MATSEQAIJCUSPARSE, MATMPIAIJCUSPARSE));
207: PetscCall(MatRegister(MATSEQAIJCUSPARSE, MatCreate_SeqAIJCUSPARSE));
208: PetscCall(MatRegister(MATMPIAIJCUSPARSE, MatCreate_MPIAIJCUSPARSE));
209: PetscCall(MatRegisterRootName(MATSELLCUDA, MATSEQSELLCUDA, MATMPISELLCUDA));
210: PetscCall(MatRegister(MATSEQSELLCUDA, MatCreate_SeqSELLCUDA));
211: PetscCall(MatRegister(MATMPISELLCUDA, MatCreate_MPISELLCUDA));
212: #endif
214: #if defined(PETSC_HAVE_HIP)
215: PetscCall(MatRegisterRootName(MATAIJHIPSPARSE, MATSEQAIJHIPSPARSE, MATMPIAIJHIPSPARSE));
216: PetscCall(MatRegister(MATSEQAIJHIPSPARSE, MatCreate_SeqAIJHIPSPARSE));
217: PetscCall(MatRegister(MATMPIAIJHIPSPARSE, MatCreate_MPIAIJHIPSPARSE));
218: PetscCall(MatRegisterRootName(MATSELLHIP, MATSEQSELLHIP, MATMPISELLHIP));
219: PetscCall(MatRegister(MATSEQSELLHIP, MatCreate_SeqSELLHIP));
220: PetscCall(MatRegister(MATMPISELLHIP, MatCreate_MPISELLHIP));
221: #endif
223: #if defined(PETSC_HAVE_VIENNACL)
224: PetscCall(MatRegisterRootName(MATAIJVIENNACL, MATSEQAIJVIENNACL, MATMPIAIJVIENNACL));
225: PetscCall(MatRegister(MATSEQAIJVIENNACL, MatCreate_SeqAIJViennaCL));
226: PetscCall(MatRegister(MATMPIAIJVIENNACL, MatCreate_MPIAIJViennaCL));
227: #endif
229: #if defined(PETSC_HAVE_KOKKOS_KERNELS)
230: PetscCall(MatRegisterRootName(MATAIJKOKKOS, MATSEQAIJKOKKOS, MATMPIAIJKOKKOS));
231: PetscCall(MatRegister(MATSEQAIJKOKKOS, MatCreate_SeqAIJKokkos));
232: PetscCall(MatRegister(MATMPIAIJKOKKOS, MatCreate_MPIAIJKokkos));
233: #endif
235: #if defined(PETSC_HAVE_FFTW)
236: PetscCall(MatRegister(MATFFTW, MatCreate_FFTW));
237: #endif
238: #if defined(PETSC_HAVE_ELEMENTAL)
239: PetscCall(MatRegister(MATELEMENTAL, MatCreate_Elemental));
240: #endif
241: #if defined(PETSC_HAVE_SCALAPACK)
242: PetscCall(MatRegister(MATSCALAPACK, MatCreate_ScaLAPACK));
243: #endif
245: PetscCall(MatRegister(MATPREALLOCATOR, MatCreate_Preallocator));
246: PetscCall(MatRegister(MATDUMMY, MatCreate_Dummy));
248: PetscCall(MatRegister(MATCONSTANTDIAGONAL, MatCreate_ConstantDiagonal));
249: PetscCall(MatRegister(MATDIAGONAL, MatCreate_Diagonal));
251: #if defined(PETSC_HAVE_HYPRE)
252: PetscCall(MatRegister(MATHYPRE, MatCreate_HYPRE));
253: #endif
255: #if defined(PETSC_HAVE_H2OPUS)
256: PetscCall(MatRegister(MATH2OPUS, MatCreate_H2OPUS));
257: #endif
259: #if defined(PETSC_HAVE_HTOOL)
260: PetscCall(MatRegister(MATHTOOL, MatCreate_Htool));
261: #endif
262: PetscFunctionReturn(PETSC_SUCCESS);
263: }