~vcs-imports/escript-finley/trunk

« back to all changes in this revision

Viewing changes to paso/src/MKL.c

  • Committer: jfenwick
  • Date: 2010-10-11 01:48:14 UTC
  • Revision ID: svn-v4:77569008-7704-0410-b7a0-a92fef0b09fd:trunk:3259
Merging dudley and scons updates from branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
                   &n, A->mainBlock->val, A->mainBlock->pattern->ptr, A->mainBlock->pattern->index, &idum, &nrhs,
57
57
                   iparm, &msglvl,&ddum, &ddum, &error);
58
58
          MEMFREE(A->solver);
59
 
          if (error != MKL_ERROR_NO) Paso_setError(TYPE_ERROR,"memory release in paradiso library failed.");
 
59
          if (error != MKL_ERROR_NO) Esys_setError(TYPE_ERROR,"memory release in paradiso library failed.");
60
60
     }
61
61
#endif
62
62
}
72
72
     index_t i;
73
73
 
74
74
     if (! (A->type & (MATRIX_FORMAT_OFFSET1 + MATRIX_FORMAT_BLK1)) ) {
75
 
        Paso_setError(TYPE_ERROR,"Paso_MKL: MKL requires CSR format with index offset 1 and block size 1.");
 
75
        Esys_setError(TYPE_ERROR,"Paso_MKL: MKL requires CSR format with index offset 1 and block size 1.");
76
76
        return;
77
77
     }
78
78
     options->converged=FALSE;
117
117
     if (pt==NULL) {
118
118
        /* allocate address pointer */
119
119
        pt=MEMALLOC(64,_MKL_DSS_HANDLE_t);
120
 
        if (Paso_checkPtr(pt)) return;
 
120
        if (Esys_checkPtr(pt)) return;
121
121
        A->solver=(void*) pt;
122
122
        for (i=0;i<64;++i) pt[i]=NULL;
123
 
        time0=Paso_timer();
 
123
        time0=Esys_timer();
124
124
        /* symbolic factorization */
125
125
        phase = MKL_PHASE_SYMBOLIC_FACTORIZATION;
126
126
        PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
128
128
                 iparm, &msglvl, in, out, &error);
129
129
        if (error != MKL_ERROR_NO) {
130
130
             if (options->verbose) printf("MKL: symbolic factorization factorization failed.\n");
131
 
             Paso_setError(VALUE_ERROR,"symbolic factorization in paradiso library failed.");
 
131
             Esys_setError(VALUE_ERROR,"symbolic factorization in paradiso library failed.");
132
132
             Paso_MKL_free(A);
133
133
        } else {
134
134
           /* LDU factorization */
138
138
                iparm, &msglvl, in, out, &error);
139
139
           if (error != MKL_ERROR_NO) {
140
140
             if (options->verbose) printf("MKL: LDU factorization failed.\n");
141
 
             Paso_setError(ZERO_DIVISION_ERROR,"factorization in paradiso library failed. Most likely the matrix is singular.");
 
141
             Esys_setError(ZERO_DIVISION_ERROR,"factorization in paradiso library failed. Most likely the matrix is singular.");
142
142
             Paso_MKL_free(A);
143
143
           }
144
144
           if (options->verbose) printf("MKL: LDU factorization completed.\n");
145
145
        }
146
 
        options->set_up_time=Paso_timer()-time0;
 
146
        options->set_up_time=Esys_timer()-time0;
147
147
     } else {
148
148
        options->set_up_time=0;
149
149
     }
150
150
     /* forward backward substitution\ */
151
 
     if (Paso_noError())  {
152
 
        time0=Paso_timer();
 
151
     if (Esys_noError())  {
 
152
        time0=Esys_timer();
153
153
        phase = MKL_PHASE_SOLVE;
154
154
        PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
155
155
                 &n, A->mainBlock->val, A->mainBlock->pattern->ptr, A->mainBlock->pattern->index, &idum, &nrhs,
157
157
        if (options->verbose) printf("MKL: solve completed.\n");
158
158
        if (error != MKL_ERROR_NO) {
159
159
              if (options->verbose) printf("MKL: forward/backward substitution failed.\n");
160
 
              Paso_setError(VALUE_ERROR,"forward/backward substitution in paradiso library failed. Most likely the matrix is singular.");
 
160
              Esys_setError(VALUE_ERROR,"forward/backward substitution in paradiso library failed. Most likely the matrix is singular.");
161
161
        } else {
162
162
            if (options->verbose) printf("MKL: forward/backward substitution completed.\n");
163
163
            options->residual_norm=0.;
166
166
            options->num_inner_iter=0;
167
167
            options->converged=TRUE;
168
168
        }
169
 
        options->time=Paso_timer()-time0 + options->set_up_time;
 
169
        options->time=Esys_timer()-time0 + options->set_up_time;
170
170
     }
171
171
     Performance_stopMonitor(pp,PERFORMANCE_ALL);
172
172
#else
173
 
    Paso_setError(SYSTEM_ERROR,"Paso_MKL:MKL is not avialble.");
 
173
    Esys_setError(SYSTEM_ERROR,"Paso_MKL:MKL is not avialble.");
174
174
#endif
175
175
}
176
176
 
196
196
                   &n, A->val, A->pattern->ptr, A->pattern->index, &idum, &nrhs,
197
197
                   iparm, &msglvl,&ddum, &ddum, &error);
198
198
          MEMFREE(A->solver);
199
 
          if (error != MKL_ERROR_NO) Paso_setError(TYPE_ERROR,"memory release in paradiso library failed.");
 
199
          if (error != MKL_ERROR_NO) Esys_setError(TYPE_ERROR,"memory release in paradiso library failed.");
200
200
     }
201
201
#endif
202
202
}
210
210
     index_t i;
211
211
 
212
212
     if (! (A->type & (MATRIX_FORMAT_OFFSET1 + MATRIX_FORMAT_BLK1)) ) {
213
 
        Paso_setError(TYPE_ERROR,"Paso_MKL: MKL requires CSR format with index offset 1 and block size 1.");
 
213
        Esys_setError(TYPE_ERROR,"Paso_MKL: MKL requires CSR format with index offset 1 and block size 1.");
214
214
        return;
215
215
     }
216
216
     _INTEGER_t mtype = MKL_MTYPE_UNSYM;
248
248
     if (pt==NULL) {
249
249
        /* allocate address pointer */
250
250
        pt=MEMALLOC(64,_MKL_DSS_HANDLE_t);
251
 
        if (Paso_checkPtr(pt)) return;
 
251
        if (Esys_checkPtr(pt)) return;
252
252
        A->solver=(void*) pt;
253
253
        for (i=0;i<64;++i) pt[i]=NULL;
254
254
        /* symbolic factorization */
257
257
                 &n, A->val, A->pattern->ptr, A->pattern->index, &idum, &nrhs,
258
258
                 iparm, &msglvl, in, out, &error);
259
259
        if (error != MKL_ERROR_NO) {
260
 
             Paso_setError(VALUE_ERROR,"symbolic factorization in paradiso library failed.");
 
260
             Esys_setError(VALUE_ERROR,"symbolic factorization in paradiso library failed.");
261
261
             Paso_MKL_free1(A);
262
262
        } else {
263
263
           /* LDU factorization */
266
266
                &n, A->val, A->pattern->ptr, A->pattern->index, &idum, &nrhs,
267
267
                iparm, &msglvl, in, out, &error);
268
268
           if (error != MKL_ERROR_NO) {
269
 
             Paso_setError(ZERO_DIVISION_ERROR,"factorization in paradiso library failed. Most likely the matrix is singular.");
 
269
             Esys_setError(ZERO_DIVISION_ERROR,"factorization in paradiso library failed. Most likely the matrix is singular.");
270
270
             Paso_MKL_free1(A);
271
271
           }
272
272
           if (verbose) printf("MKL: LDU factorization completed.\n");
273
273
        }
274
274
     }
275
275
     /* forward backward substitution\ */
276
 
     if (Paso_noError())  {
 
276
     if (Esys_noError())  {
277
277
        phase = MKL_PHASE_SOLVE;
278
278
        PARDISO (pt, &maxfct, &mnum, &mtype, &phase,
279
279
                 &n, A->val, A->pattern->ptr, A->pattern->index, &idum, &nrhs,
280
280
                 iparm, &msglvl, in, out, &error);
281
281
        if (verbose) printf("MKL: solve completed.\n");
282
282
        if (error != MKL_ERROR_NO) {
283
 
              Paso_setError(VALUE_ERROR,"forward/backward substition in paradiso library failed. Most likely the matrix is singular.");
 
283
              Esys_setError(VALUE_ERROR,"forward/backward substition in paradiso library failed. Most likely the matrix is singular.");
284
284
        }
285
285
     }
286
286
#else
287
 
    Paso_setError(SYSTEM_ERROR,"Paso_MKL:MKL is not avialble.");
 
287
    Esys_setError(SYSTEM_ERROR,"Paso_MKL:MKL is not avialble.");
288
288
#endif
289
289
}
290
290
/*