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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3049 - (hide annotations)
Fri Jun 25 04:20:29 2010 UTC (8 years, 11 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 ksteube 1312
2     /*******************************************************
3 ksteube 1811 *
4 jfenwick 2881 * Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1811 * 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 dhawcroft 631
14 ksteube 1811
15 jgs 150 /**************************************************************/
16    
17     /* Paso: interface to the direct solvers */
18    
19     /**************************************************************/
20    
21     /* Copyrights by ACcESS Australia 2003 */
22 jfenwick 2608 /* Author: Lutz Gross, l.gross@uq.edu.au */
23 jgs 150
24     /**************************************************************/
25    
26     #include "Paso.h"
27 gross 584 #include "performance.h"
28 gross 700 #include "Solver.h"
29 jgs 150
30     #ifdef MKL
31 gross 411 #include "MKL.h"
32 jgs 150 #endif
33    
34     #ifdef UMFPACK
35 gross 411 #include "UMFPACK.h"
36 jgs 150 #endif
37    
38 lgao 3049 #ifdef PASTIX
39     #include "PASTIX.h"
40     #endif
41    
42 jgs 150 /**************************************************************/
43    
44     void Paso_solve(Paso_SystemMatrix* A,
45 gross 1361 double* out,
46     double* in,
47     Paso_Options* options) {
48 ksteube 1312
49 gross 584 Paso_Performance pp;
50 gross 1028 index_t package;
51 jgs 150 Paso_resetError();
52 ksteube 1312 if (Paso_SystemMatrix_getGlobalNumCols(A) != Paso_SystemMatrix_getGlobalNumRows(A)
53     || A->col_block_size!=A->row_block_size) {
54 gross 415 Paso_setError(VALUE_ERROR,"Paso_solve: matrix has to be a square matrix.");
55 jgs 150 return;
56     }
57 gross 2479 /* Paso_Options_show(options); */
58 gross 584 Performance_open(&pp,options->verbose);
59 gross 2315 package=Paso_Options_getPackage(options->method,options->package,options->symmetric, A->mpi_info);
60 jgs 150 if (Paso_noError()) {
61     switch(package) {
62    
63     case PASO_PASO:
64 gross 584 Paso_Solver(A,out,in,options,&pp);
65 gross 727 A->solver_package=PASO_PASO;
66 jgs 150 break;
67    
68 gross 425 #ifdef MKL
69 jgs 150 case PASO_MKL:
70 ksteube 1312 if (A->mpi_info->size>1) {
71     Paso_setError(VALUE_ERROR,"Paso_solve: MKL package does not support MPI.");
72     return;
73     }
74 gross 584 Paso_MKL(A,out,in,options,&pp);
75 gross 727 A->solver_package=PASO_MKL;
76 jgs 150 break;
77 gross 425 #endif
78 jgs 150
79 gross 805 #ifdef UMFPACK
80 jgs 150 case PASO_UMFPACK:
81 ksteube 1312 if (A->mpi_info->size>1) {
82     Paso_setError(VALUE_ERROR,"Paso_solve: UMFPACK package does not support MPI.");
83     return;
84     }
85 gross 806 Paso_UMFPACK(A,out,in,options,&pp);
86 gross 727 A->solver_package=PASO_UMFPACK;
87 jgs 150 break;
88 gross 805 #endif
89 jgs 150
90 lgao 3049 #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 jgs 150 default:
99 gross 415 Paso_setError(VALUE_ERROR,"Paso_solve: unknown package code");
100 gross 584 break;
101 jgs 150 }
102 gross 2484 }
103     /*
104     cancel divergence errors
105     */
106     if (options->accept_failed_convergence) {
107     if (Paso_getErrorType() == DIVERGED) {
108     Paso_resetError();
109 lgao 2527 if (options->verbose) printf("PASO: failed convergence error has been canceled requested.\n");
110 gross 2479 }
111 jgs 150 }
112 gross 584 Performance_close(&pp,options->verbose);
113 gross 2502 /* Paso_Options_showDiagnostics(options); */
114 jgs 150 return;
115     }
116    
117     /* free memory possibly resereved for a recall */
118    
119     void Paso_solve_free(Paso_SystemMatrix* in) {
120 gross 727
121 gross 1417 if (in==NULL) return;
122    
123 gross 425 switch(in->solver_package) {
124    
125     case PASO_PASO:
126 jgs 150 Paso_Solver_free(in);
127 gross 425 break;
128    
129     #ifdef MKL
130     case PASO_MKL:
131     Paso_MKL_free(in);
132     break;
133     #endif
134    
135 gross 806 #ifdef UMFPACK
136 gross 425 case PASO_UMFPACK:
137     Paso_UMFPACK_free(in);
138     break;
139 gross 806 #endif
140 ksteube 1312
141 lgao 3049 #ifdef PASTIX
142     case PASO_PASTIX:
143     Paso_PASTIX_free(in);
144     break;
145     #endif
146 gross 425 }
147 jgs 150 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26