/[escript]/branches/escript3047_with_pastix2995/paso/src/solve.c
ViewVC logotype

Contents of /branches/escript3047_with_pastix2995/paso/src/solve.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3049 - (show annotations)
Fri Jun 25 04:20:29 2010 UTC (8 years, 10 months ago) by lgao
File MIME type: text/plain
File size: 3716 byte(s)
Add direct solver pastix 2995. Currently works for single MPI rank only. For jobs with more than 1 MPI rank, the structure "coupleBlock" in "SystemMatrix" is not ready yet. 


1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 /**************************************************************/
16
17 /* Paso: interface to the direct solvers */
18
19 /**************************************************************/
20
21 /* Copyrights by ACcESS Australia 2003 */
22 /* Author: Lutz Gross, l.gross@uq.edu.au */
23
24 /**************************************************************/
25
26 #include "Paso.h"
27 #include "performance.h"
28 #include "Solver.h"
29
30 #ifdef MKL
31 #include "MKL.h"
32 #endif
33
34 #ifdef UMFPACK
35 #include "UMFPACK.h"
36 #endif
37
38 #ifdef PASTIX
39 #include "PASTIX.h"
40 #endif
41
42 /**************************************************************/
43
44 void Paso_solve(Paso_SystemMatrix* A,
45 double* out,
46 double* in,
47 Paso_Options* options) {
48
49 Paso_Performance pp;
50 index_t package;
51 Paso_resetError();
52 if (Paso_SystemMatrix_getGlobalNumCols(A) != Paso_SystemMatrix_getGlobalNumRows(A)
53 || A->col_block_size!=A->row_block_size) {
54 Paso_setError(VALUE_ERROR,"Paso_solve: matrix has to be a square matrix.");
55 return;
56 }
57 /* Paso_Options_show(options); */
58 Performance_open(&pp,options->verbose);
59 package=Paso_Options_getPackage(options->method,options->package,options->symmetric, A->mpi_info);
60 if (Paso_noError()) {
61 switch(package) {
62
63 case PASO_PASO:
64 Paso_Solver(A,out,in,options,&pp);
65 A->solver_package=PASO_PASO;
66 break;
67
68 #ifdef MKL
69 case PASO_MKL:
70 if (A->mpi_info->size>1) {
71 Paso_setError(VALUE_ERROR,"Paso_solve: MKL package does not support MPI.");
72 return;
73 }
74 Paso_MKL(A,out,in,options,&pp);
75 A->solver_package=PASO_MKL;
76 break;
77 #endif
78
79 #ifdef UMFPACK
80 case PASO_UMFPACK:
81 if (A->mpi_info->size>1) {
82 Paso_setError(VALUE_ERROR,"Paso_solve: UMFPACK package does not support MPI.");
83 return;
84 }
85 Paso_UMFPACK(A,out,in,options,&pp);
86 A->solver_package=PASO_UMFPACK;
87 break;
88 #endif
89
90 #ifdef PASTIX
91 case PASO_PASTIX:
92 Paso_PASTIX(A,out,in,options,&pp);
93 A->solver_package=PASO_PASTIX;
94 break;
95 #endif
96
97
98 default:
99 Paso_setError(VALUE_ERROR,"Paso_solve: unknown package code");
100 break;
101 }
102 }
103 /*
104 cancel divergence errors
105 */
106 if (options->accept_failed_convergence) {
107 if (Paso_getErrorType() == DIVERGED) {
108 Paso_resetError();
109 if (options->verbose) printf("PASO: failed convergence error has been canceled requested.\n");
110 }
111 }
112 Performance_close(&pp,options->verbose);
113 /* Paso_Options_showDiagnostics(options); */
114 return;
115 }
116
117 /* free memory possibly resereved for a recall */
118
119 void Paso_solve_free(Paso_SystemMatrix* in) {
120
121 if (in==NULL) return;
122
123 switch(in->solver_package) {
124
125 case PASO_PASO:
126 Paso_Solver_free(in);
127 break;
128
129 #ifdef MKL
130 case PASO_MKL:
131 Paso_MKL_free(in);
132 break;
133 #endif
134
135 #ifdef UMFPACK
136 case PASO_UMFPACK:
137 Paso_UMFPACK_free(in);
138 break;
139 #endif
140
141 #ifdef PASTIX
142 case PASO_PASTIX:
143 Paso_PASTIX_free(in);
144 break;
145 #endif
146 }
147 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26