Debian Codegraph @

3rdparty/dissection/src/Driver/C_threads_tasks.hpp

raw
1 /*! \file C_threads_tasks.hpp
2 \brief tasks executed asynchronously with threads
3 \author Atsushi Suzuki, Laboratoire Jacques-Louis Lions
4 \date Apr. 22th 2013
5 \date Jul. 12th 2015
6 \date Nov. 30th 2016
7 */
8
9 // This file is part of Dissection
10 //
11 // Dissection is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // Linking Dissection statically or dynamically with other modules is making
17 // a combined work based on Disssection. Thus, the terms and conditions of
18 // the GNU General Public License cover the whole combination.
19 //
20 // As a special exception, the copyright holders of Dissection give you
21 // permission to combine Dissection program with free software programs or
22 // libraries that are released under the GNU LGPL and with independent modules
23 // that communicate with Dissection solely through the Dissection-fortran
24 // interface. You may copy and distribute such a system following the terms of
25 // the GNU GPL for Dissection and the licenses of the other code concerned,
26 // provided that you include the source code of that other code when and as
27 // the GNU GPL requires distribution of source code and provided that you do
28 // not modify the Dissection-fortran interface.
29 //
30 // Note that people who make modified versions of Dissection are not obligated
31 // to grant this special exception for their modified versions; it is their
32 // choice whether to do so. The GNU General Public License gives permission to
33 // release a modified version without this exception; this exception also makes
34 // it possible to release a modified version which carries forward this
35 // exception. If you modify the Dissection-fortran interface, this exception
36 // does not apply to your modified version of Dissection, and you must remove
37 // this exception when you distribute your modified version.
38 //
39 // This exception is an additional permission under section 7 of the GNU
40 // General Public License, version 3 ("GPLv3")
41 //
42 // Dissection is distributed in the hope that it will be useful,
43 // but WITHOUT ANY WARRANTY; without even the implied warranty of
44 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 // GNU General Public License for more details.
46 //
47 // You should have received a copy of the GNU General Public License
48 // along with Dissection. If not, see <http://www.gnu.org/licenses/>.
49 //
50
51 #ifndef _C_THREADS_TASKS_
52 #define _C_THREADS_TASKS_
53 #include <sys/types.h>
54 #include <stdint.h>
55 # include "Compiler/blas.hpp"
56 # include "Compiler/OptionCompiler.hpp"
57 #include <vector>
58 #include <list>
59 #include <algorithm>
60 #include <string>
61 #include <cstring>
62 #include "Compiler/elapsed_time.hpp"
63 # include "Algebra/SquareMatrix.hpp"
64 # include "Algebra/SquareBlockMatrix.hpp"
65 # include "Algebra/RectBlockMatrix.hpp"
66 # include "Algebra/ColumnMatrix.hpp"
67 # include "Splitters/BisectionTree.hpp"
68 # include "Algebra/CSR_matrix.hpp"
69 # include "Driver/TridiagBlockMatrix.hpp"
70
71 using namespace std;
72
73 // set manually the same value defined in Moudels/blak_blocksize.f90
74
75 #define SIZE_B1 240
76 #define SIZE_DGEMM_SYMM_DTRSV 40
77 //#define SIZE_B1 600
78 //#define SIZE_DGEMM_SYMM_DTRSV 100
79
80 #define C_DHALF_SCHUR_BLOCK_GEMM 1.0
81 #define C_DHALF_SCHUR_BLOCK_GEMV 2.0
82 #define FW_SOLVESCLAE_DTRSM 3.0
83
84 #define BLAS3_GEMM_OPT 0.5
85
86 // #define TASK_NAME_SIZE 256
87
88 const string _null_name;
89
90 struct source_dist_index {
91 int source;
92 int dist;
93 int global_i;
94 int global_j;
95 ~source_dist_index() {}
96 source_dist_index() {}
97 source_dist_index(int source_, int dist_, int global_i_, int global_j_) :
98 source(source_), dist(dist_), global_i(global_i_), global_j(global_j_) {}
99 source_dist_index(const source_dist_index &im)
100 {
101 // if (&im != this) { : no need to be declared
102 source = im.source;
103 dist = im.dist;
104 global_i = im.global_i;
105 global_j = im.global_j;
106 // }
107 }
108 };
109
110 template<typename T>
111 struct C_Dsub_task {
112 int ir_bgn;
113 int ir_end;
114 int jc_bgn;
115 int jc_end;
116 int ir_bgn_src;
117 int ir_bgn_src2;
118 int jc_bgn_src;
119 int jc_bgn_src2;
120 int dst_row;
121 SquareBlockMatrix<T> *dst_mtrx;
122 RectBlockMatrix<T> *dst_pt;
123 int ir_block;
124 int jc_block;
125 RectBlockMatrix<T> *dst_pt2;
126 int ir2_block;
127 int jc2_block;
128 SquareBlockMatrix<T> *src_pt;
129 SquareBlockMatrix<T> *src_pt2;
130 void (*func)(C_Dsub_task<T> *);
131 bool isSkip;
132 int atomic_size;
133 int atomic_id;
134 int parallel_max;
135 int parallel_id;
136 long *ops_complexity;
137 int father_id;
138 int child0_id;
139 int child1_id;
140 int level;
141 bool verbose;
142 bool debug;
143 int child_id;
144 FILE *fp;
145
146 ~C_Dsub_task() {
147 delete ops_complexity;
148 }
149 C_Dsub_task() {}
150 C_Dsub_task(int atomic_size_,
151 int atomic_id_,
152 int ir_bgn_,
153 int ir_end_,
154 int jc_bgn_,
155 int jc_end_,
156 int ir_bgn_src_,
157 int ir_bgn_src2_,
158 int jc_bgn_src_,
159 int jc_bgn_src2_,
160 int dst_row_,
161 SquareBlockMatrix<T>* dst_mtrx_,
162 RectBlockMatrix<T> *dst_pt_,
163 int ir_block_,
164 int jc_block_,
165 RectBlockMatrix<T> *dst_pt2_,
166 int ir2_block_,
167 int jc2_block_,
168 SquareBlockMatrix<T> *src_pt_,
169 SquareBlockMatrix<T> *src_pt2_,
170 void (*func_)(C_Dsub_task<T> *),
171 bool isSkip_,
172 long ops_complexity_,
173 int father_id_,
174 int level_,
175 bool verbose_,
176 FILE *fp_) :
177 ir_bgn(ir_bgn_),
178 ir_end(ir_end_),
179 jc_bgn(jc_bgn_),
180 jc_end(jc_end_),
181 ir_bgn_src(ir_bgn_src_),
182 ir_bgn_src2(ir_bgn_src2_),
183 jc_bgn_src(jc_bgn_src_),
184 jc_bgn_src2(jc_bgn_src2_),
185 dst_row(dst_row_),
186 dst_mtrx(dst_mtrx_),
187 dst_pt(dst_pt_),
188 ir_block(ir_block_),
189 jc_block(jc_block_),
190 dst_pt2(dst_pt2_),
191 ir2_block(ir2_block_),
192 jc2_block(jc2_block_),
193 src_pt(src_pt_),
194 src_pt2(src_pt2_),
195 func(func_),
196 isSkip(isSkip_),
197 atomic_size(atomic_size_),
198 atomic_id(atomic_id_),
199 father_id(father_id_),
200 level(level_),
201 verbose(verbose_),
202 fp(fp_)
203 {
204 debug = false;
205 child_id = 0;
206 ops_complexity = new long;
207 *ops_complexity = ops_complexity_;
208 }
209
210 C_Dsub_task(const C_Dsub_task &im)
211 {
212 atomic_size = im.atomic_size;
213 atomic_id = im.atomic_id;
214 ir_bgn = im.ir_bgn;
215 ir_end = im.ir_end;
216 jc_bgn = im.jc_bgn;
217 jc_end = im.jc_end;
218 ir_bgn_src = im.ir_bgn_src;
219 ir_bgn_src2 = im.ir_bgn_src2;
220 jc_bgn_src = im.jc_bgn_src;
221 jc_bgn_src2 = im.jc_bgn_src2;
222 dst_row = im.dst_row;
223 dst_mtrx = im.dst_mtrx;
224 dst_pt = im.dst_pt;
225 ir_block = im.ir_block;
226 jc_block = im.jc_block;
227 dst_pt2 = im.dst_pt2;
228 ir2_block = im.ir2_block;
229 jc2_block = im.jc2_block;
230 src_pt = im.src_pt;
231 src_pt2 = im.src_pt2;
232 func = im.func;
233 isSkip = im.isSkip;
234 father_id = im.father_id;
235 level = im.level;
236 verbose = im.verbose;
237 debug = im.debug;
238 child_id = im.child_id;
239 fp = im.fp;
240 ops_complexity = new long;
241 *ops_complexity = *(im.ops_complexity); // copy value
242 }
243 };
244
245 typedef struct {
246 double pivot;
247 double w;
248 double eps;
249 double delta;
250 } pivot_param;
251
252 #define DIST_TASK_CRITICAL 20
253
254 #define TASK_WAITING 0
255 #define TASK_WORKING 1
256 #define TASK_DONE 2
257
258 #define TASK_SINGLE 8
259 #define TASK_PARALLEL 9
260
261 #define C_DUMMY 1
262 #define C_DIAG_START 2
263
264 #define C_DFULL 4
265 #define C_DFULL_SYM_GAUSS 5
266 #define C_DINV_DL_TIMESU 6
267 #define C_DHALF_SCHUR_B 70
268 #define C_DHALF_SCHUR_BT 71
269
270 #define C_DTRSM 8
271 #define C_DTRSM1 9
272 #define C_DTRSMSCALE 10
273
274 #define C_DGEMM 16
275 #define C_DGEMM1 17
276 #define C_DGEMM_LOCAL_MULT 18
277 #define C_DGEMM_LOCAL_TWO 19
278 #define C_DGEMM_DIRECT_TWO 20
279
280
281 #define C_DSUB 32
282 #define C_DSUB1 33
283 #define C_DEALLOCATE 34
284 #define C_DEALLOCATE1 35
285 #define C_DEALLOCLOCALSCHUR 36
286 #define C_DEALLOCLOWER 40
287
288 #define C_FILLMATRIX 64
289 #define C_FILLMATRIX1 65
290
291 #define C_SPARSESYMBFACT 128
292 #define C_SPARSENUMFACT 256
293 #define C_SPARSESCHUR 257
294 #define C_SPARSELOCALSCHUR 512
295 #define C_SPARSELOCALSCHUR1 513
296 #define C_SPARSESOLVER 384
297
298 #define C_FWBW 1024
299 #define C_SPARSESYMFW 1025
300 #define C_SPARSESYMBW 1026
301 #define C_DSUB_FWBW 1027
302 #define C_DENSE_SYMFW_DIAG 1028
303 #define C_DENSE_SYMFW_OFFDIAG 1029
304 #define C_STRIPS_SYMFW_OFFDIAG 1030
305 #define C_DENSE_SYMSCALE 1031
306 #define C_DENSE_SYMFILL 1032
307
308 template<typename T, typename U>
309 struct C_SparseSymbFact_arg {
310 TridiagBlockMatrix<T, U> **tridiag;
311 int nrow;
312 int colors;
313 int *color_mask;
314 const CSR_indirect* csr_diag;
315 long *ops_complexity;
316 long *nopd;
317 long *nops;
318 bool verbose;
319 FILE **fp;
320
321
322 ~C_SparseSymbFact_arg() {
323 delete ops_complexity;
324 delete nopd;
325 delete nops;
326 }
327 C_SparseSymbFact_arg() {}
328 C_SparseSymbFact_arg (TridiagBlockMatrix<T, U> **tridiag_,
329 int colors_,
330 int *color_mask_,
331 int nrow_,
332 const CSR_indirect* csr_diag_,
333 bool verbose_,
334 FILE **fp_
335 ) :
336 tridiag(tridiag_),
337 nrow(nrow_),
338 colors(colors_),
339 color_mask(color_mask_),
340 csr_diag(csr_diag_),
341 verbose(verbose_),
342 fp(fp_) {
343 ops_complexity = new long;
344 nopd = new long;
345 nops = new long;
346 }
347
348 C_SparseSymbFact_arg(const C_SparseSymbFact_arg &im)
349 {
350 tridiag = im.tridiag;
351 colors = im.colors;
352 color_mask = im.color_mask;
353 nrow = im.nrow;
354 csr_diag = im.csr_diag;
355 ops_complexity = new long;
356 *ops_complexity = *(im.ops_complexity);
357 nopd = new long;
358 *nopd = *(im.nopd);
359 nops = new long;
360 *nops = *(im.nops);
361 verbose = im.verbose;
362 fp = im.fp;
363 }
364 };
365
366 template<typename T, typename U>
367 struct C_SparseNumFact_arg {
368 TridiagBlockMatrix<T, U> **tridiag;
369 bool isSym;
370 int colors;
371 int *color_mask;
372 int nnz;
373 T *coefs;
374 int nrow;
375 int ncol;
376 const CSR_indirect* csr_diag;
377 const CSR_indirect* csr_offdiag;
378 SquareBlockMatrix<T>* D; // to store pivot information
379 double *eps_pivot;
380 double *pivot;
381 bool *kernel_detection;
382 bool *higher_precision;
383 int *dim_aug_kern;
384 U *eps_machine;
385 SquareBlockMatrix<T>* localSchur;
386 long *ops_complexity;
387 long *nopd;
388 long *nops;
389 bool verbose;
390 elapsed_t *tt;
391 FILE **fp;
392 int nb;
393
394 ~C_SparseNumFact_arg() {
395 delete ops_complexity;
396 delete nopd;
397 delete nops;
398 delete [] tt;
399 }
400 C_SparseNumFact_arg() {}
401 C_SparseNumFact_arg (TridiagBlockMatrix<T, U> **tridiag_,
402 bool isSym_,
403 int colors_,
404 int *color_mask_,
405 int nnz_,
406 T *coefs_,
407 int nrow_,
408 int ncol_,
409 const CSR_indirect* csr_diag_,
410 const CSR_indirect* csr_offdiag_,
411 SquareBlockMatrix<T>* D_,
412 double *eps_pivot_,
413 double *pivot_,
414 bool *kernel_detection_,
415 bool *higher_precision_,
416 int *dim_aug_kern_,
417 U *eps_machine_,
418 SquareBlockMatrix<T>* localSchur_,
419 bool verbose_,
420 FILE **fp_,
421 int nb_) :
422 tridiag(tridiag_),
423 isSym(isSym_),
424 colors(colors_),
425 color_mask(color_mask_),
426 nnz(nnz_),
427 coefs(coefs_),
428 nrow(nrow_),
429 ncol(ncol_),
430 csr_diag(csr_diag_),
431 csr_offdiag(csr_offdiag_),
432 D(D_),
433 eps_pivot(eps_pivot_),
434 pivot(pivot_),
435 kernel_detection(kernel_detection_),
436 higher_precision(higher_precision_),
437 dim_aug_kern(dim_aug_kern_),
438 eps_machine(eps_machine_),
439 localSchur(localSchur_),
440 verbose(verbose_),
441 fp(fp_),
442 nb(nb_)
443 {
444 ops_complexity = new long;
445 nopd = new long;
446 nops = new long;
447 tt = new elapsed_t[5];
448 }
449
450 C_SparseNumFact_arg(const C_SparseNumFact_arg &im)
451 {
452 tridiag = im.tridiag;
453 isSym = im.isSym;
454 colors = im.colors;
455 color_mask = im.color_mask;
456 nnz = im.nnz;
457 coefs = im.coefs;
458 nrow = im.nrow;
459 ncol = im.ncol;
460 csr_diag = im.csr_diag;
461 csr_offdiag = im.csr_offdiag;
462 D = im.D;
463 eps_pivot = im.eps_pivot;
464 pivot = im.pivot;
465 kernel_detection = im.kernel_detection;
466 higher_precision = im.higher_precision;
467 dim_aug_kern = im.dim_aug_kern;
468 eps_machine = im.eps_machine;
469 localSchur = im.localSchur;
470 ops_complexity = new long;
471 *ops_complexity = *(im.ops_complexity);
472 nopd = new long;
473 *nopd = *(im.nopd);
474 nops = new long;
475 *nops = *(im.nops);
476 verbose = im.verbose;
477 tt = im.tt;
478 fp = im.fp;
479 nb = im.nb;
480 }
481 };
482
483 template<typename T>
484 struct C_FillMatrix_arg {
485 bool isSym;
486 SquareBlockMatrix<T>* D;
487 RectBlockMatrix<T>* upper;
488 RectBlockMatrix<T>* lower;
489 const CSR_indirect *csr_diag;
490 const CSR_indirect *csr_offdiag;
491 T *coefs;
492 long *ops_complexity;
493 bool verbose;
494 FILE **fp;
495 int nb;
496
497 ~C_FillMatrix_arg() {
498 delete ops_complexity;
499 }
500 C_FillMatrix_arg() {}
501 C_FillMatrix_arg (bool isSym_,
502 SquareBlockMatrix<T>* D_,
503 RectBlockMatrix<T>* upper_,
504 RectBlockMatrix<T>* lower_,
505 const CSR_indirect *csr_diag_,
506 const CSR_indirect *csr_offdiag_,
507 T *coefs_,
508 bool verbose_,
509 FILE **fp_,
510 int nb_) :
511 isSym(isSym_),
512 D(D_),
513 upper(upper_),
514 lower(lower_),
515 csr_diag(csr_diag_),
516 csr_offdiag(csr_offdiag_),
517 coefs(coefs_),
518 verbose(verbose_),
519 fp(fp_),
520 nb(nb_)
521 {
522 ops_complexity = new long;
523 }
524
525 C_FillMatrix_arg(const C_FillMatrix_arg &im)
526 {
527 isSym = im.isSym;
528 D = im.D;
529 upper = im.upper;
530 lower = im.lower;
531 csr_diag = im.csr_diag;
532 csr_offdiag = im.csr_offdiag;
533 coefs =im.coefs;
534 ops_complexity = new long;
535 *ops_complexity = *(im.ops_complexity);
536 verbose = im.verbose;
537 fp = im.fp;
538 nb = im.nb;
539 }
540 };
541
542 template<typename T, typename U>
543 struct C_dfull_gauss_arg {
544 int task_position;
545 int id_level;
546 int num_block;
547 int id_block;
548 SquareBlockMatrix<T>* D;
549 SquareBlockMatrix<T>* localSchur;
550 ColumnMatrix<T> *a;
551 // ColumnMatrix<T> *diag; // T **diag;
552 int *permute_block;
553 int n;
554 int upper_ncol;
555 int nrow;
556 int i1_block;
557 double *eps_piv;
558 double *pivot;
559 double *pivot0;
560 double *pivot1;
561 bool isSym;
562 long *ops_complexity;
563 bool *kernel_detection;
564 int *aug_dim;
565 U *eps_machine;
566 bool *quit;
567 int to_next_task;
568 bool verbose;
569 FILE **fp;
570 int nb;
571
572 ~C_dfull_gauss_arg() {
573 delete ops_complexity;
574 }
575 C_dfull_gauss_arg() {}
576 C_dfull_gauss_arg(bool isSym_,
577 int task_position_,
578 int id_level_,
579 int num_block_,
580 int id_block_,
581 SquareBlockMatrix<T>* D_,
582 SquareBlockMatrix<T>* localSchur_,
583 ColumnMatrix<T> *a_, //T **a_,
584 // ColumnMatrix<T> *diag_, //T **diag_,
585 int *permute_block_,
586 int n_,
587 int upper_ncol_,
588 int nrow_,
589 int i1_block_,
590 double *eps_piv_,
591 double *pivot_,
592 double *pivot0_,
593 double *pivot1_,
594 bool *kernel_detection_,
595 int *aug_dim_,
596 U *eps_machine_,
597 bool verbose_,
598 FILE **fp_,
599 int nb_) :
600 task_position(task_position_),
601 id_level(id_level_),
602 num_block(num_block_),
603 id_block(id_block_),
604 D(D_),
605 // lower(lower_),
606 localSchur(localSchur_),
607 a(a_),
608 // diag(diag_),
609 permute_block(permute_block_),
610 n(n_),
611 upper_ncol(upper_ncol_),
612 nrow(nrow_),
613 i1_block(i1_block_),
614 eps_piv(eps_piv_),
615 pivot(pivot_),
616 pivot0(pivot0_),
617 pivot1(pivot1_),
618 isSym(isSym_),
619 kernel_detection(kernel_detection_),
620 aug_dim(aug_dim_),
621 eps_machine(eps_machine_),
622 to_next_task(0),
623 verbose(verbose_),
624 fp(fp_),
625 nb(nb_) {
626 ops_complexity = new long;
627 }
628
629 C_dfull_gauss_arg(const C_dfull_gauss_arg &im)
630 {
631 isSym = im.isSym;
632 task_position = im.task_position;
633 id_level = im.id_level;
634 num_block = im.num_block;
635 id_block = im.id_block;
636 D = im.D;
637 localSchur = im.localSchur;
638 a = im.a;
639 // diag = im.diag;
640 permute_block = im.permute_block;
641 n = im.n;
642 upper_ncol = im.upper_ncol;
643 nrow = im.nrow;
644 i1_block = im.i1_block;
645 eps_piv = im.eps_piv;
646 pivot = im.pivot;
647 pivot0 = im.pivot0;
648 pivot1 = im.pivot1;
649 ops_complexity = new long;
650 *ops_complexity = *(im.ops_complexity);
651 kernel_detection = im.kernel_detection;
652 aug_dim = im.aug_dim;
653 eps_machine = im.eps_machine;
654 fp = im.fp;
655 nb = im.nb;
656 quit = im.quit;
657 to_next_task = im.to_next_task;
658 }
659 };
660
661 template<typename T>
662 struct C_dinvDL_timesU_arg{
663 bool isSym;
664 int task_position;
665 int id_level;
666 int num_block;
667 int id_block;
668 SquareBlockMatrix<T>* D;
669 ColumnMatrix<T>* a; // T **a;
670 int n;
671 int nrow;
672 int ncol;
673 int i1_block;
674 int jj_block;
675 long *ops_complexity;
676 bool verbose;
677 FILE **fp;
678 int nb;
679
680 ~C_dinvDL_timesU_arg() {
681 delete ops_complexity;
682 }
683 C_dinvDL_timesU_arg() {}
684 C_dinvDL_timesU_arg(bool isSym_,
685 int task_position_,
686 int id_level_,
687 int num_block_,
688 int id_block_,
689 SquareBlockMatrix<T>* D_,
690 ColumnMatrix<T> *a_,
691 int n_,
692 int nrow_,
693 int ncol_,
694 int i1_block_,
695 int jj_block_,
696 bool verbose_,
697 FILE **fp_,
698 int nb_) :
699 isSym(isSym_),
700 task_position(task_position_),
701 id_level(id_level_),
702 num_block(num_block_),
703 id_block(id_block_),
704 D(D_),
705 a(a_),
706 n(n_),
707 nrow(nrow_),
708 ncol(ncol_),
709 i1_block(i1_block_),
710 jj_block(jj_block_),
711 verbose(verbose_),
712 fp(fp_),
713 nb(nb_) {
714 ops_complexity = new long;
715 }
716
717 C_dinvDL_timesU_arg(const C_dinvDL_timesU_arg &im)
718 {
719 isSym = im.isSym;
720 task_position = im.task_position;
721 id_level = im.id_level;
722 num_block = im.num_block;
723 id_block = im.id_block;
724 D = im.D;
725 a = im.a;
726 n = im.n;
727 nrow = im.nrow;
728 ncol = im.ncol;
729 i1_block = im.i1_block;
730 jj_block = im.jj_block;
731 ops_complexity = new long;
732 *ops_complexity = *(im.ops_complexity);
733 verbose = im.verbose;
734 fp = im.fp;
735 nb = im.nb;
736 }
737 };
738
739 template<typename T>
740 struct C_dupdateb_Schur_arg{
741 bool isSym;
742 int task_position;
743 int id_level;
744 int num_block;
745 int id_block;
746 SquareBlockMatrix<T>* D;
747 ColumnMatrix<T> *a; // T **a;
748 int n;
749 int nrow;
750 int ncol;
751 int b_size;
752 int i1_block;
753 int ii_block;
754 int jj_block;
755 long *ops_complexity;
756 bool verbose;
757 FILE **fp;
758 int nb;
759
760 ~C_dupdateb_Schur_arg() {
761 delete ops_complexity;
762 }
763 C_dupdateb_Schur_arg() {}
764 C_dupdateb_Schur_arg(int isSym_,
765 int task_position_,
766 int id_level_,
767 int num_block_,
768 int id_block_,
769 SquareBlockMatrix<T>* D_,
770 ColumnMatrix<T> *a_, // T **a_,
771 int n_,
772 int nrow_,
773 int ncol_,
774 int b_size_,
775 int i1_block_,
776 int ii_block_,
777 int jj_block_,
778 bool verbose_,
779 FILE **fp_,
780 int nb_) :
781 isSym(isSym_),
782 task_position(task_position_),
783 id_level(id_level_),
784 num_block(num_block_),
785 id_block(id_block_),
786 D(D_),
787 a(a_),
788 n(n_),
789 nrow(nrow_),
790 ncol(ncol_),
791 b_size(b_size_),
792 i1_block(i1_block_),
793 ii_block(ii_block_),
794 jj_block(jj_block_),
795 verbose(verbose_),
796 fp(fp_),
797 nb(nb_) {
798 ops_complexity = new long;
799 }
800
801 C_dupdateb_Schur_arg(const C_dupdateb_Schur_arg &im)
802 {
803 isSym = im.isSym;
804 task_position = im.task_position;
805 id_level = im.id_level;
806 num_block = im.num_block;
807 id_block = im.id_block;
808 D = im.D;
809 a = im.a;
810 n = im.n;
811 nrow = im.nrow;
812 ncol = im.ncol;
813 b_size = im.b_size;
814 i1_block = im.i1_block;
815 ii_block = im.ii_block;
816 jj_block = im.jj_block;
817 ops_complexity = new long;
818 *ops_complexity = *(im.ops_complexity);
819 verbose = im.verbose;
820 fp = im.fp;
821 nb = im.nb;
822 }
823 };
824
825 template<typename T>
826 struct DTRSMScale_arg {
827 SquareBlockMatrix<T>* LDLt;
828 RectBlockMatrix<T>* upper; // double *x;
829 RectBlockMatrix<T>* lower; // double *z;
830 int nrow;
831 int ncol;
832 int kblock;
833 int lblock;
834 int mblock;
835 vector<int>* singLocNodes0;
836 bool localPermute;
837 bool isSym;
838 long *ops_complexity;
839 bool verbose;
840 FILE **fp;
841 int nb;
842 bool debug;
843
844 ~DTRSMScale_arg() {
845 delete ops_complexity;
846 }
847 DTRSMScale_arg() {}
848 DTRSMScale_arg(bool isSym_,
849 SquareBlockMatrix<T> *LDLt_,
850 RectBlockMatrix<T>* upper_, // double *x_;
851 RectBlockMatrix<T>* lower_, // double *z_;
852 int nrow_,
853 int ncol_,
854 int kblock_,
855 int lblock_,
856 int mblock_,
857 vector<int>* singLocNodes0_,
858 bool localPermute_,
859 bool verbose_,
860 FILE **fp_,
861 int nb_) :
862 LDLt(LDLt_),
863 upper(upper_),
864 lower(lower_),
865 nrow(nrow_),
866 ncol(ncol_),
867 kblock(kblock_),
868 lblock(lblock_),
869 mblock(mblock_),
870 singLocNodes0(singLocNodes0_),
871 localPermute(localPermute_),
872 isSym(isSym_),
873 verbose(verbose_),
874 fp(fp_),
875 nb(nb_)
876 {
877 debug = false;
878 ops_complexity = new long;
879 }
880
881 DTRSMScale_arg(const DTRSMScale_arg &im)
882 {
883 LDLt = im.LDLt;
884 upper = im.upper;
885 lower = im.lower;
886 // offset = im.offset;
887 nrow = im.nrow;
888 ncol = im.ncol;
889 kblock = im.kblock;
890 lblock = im.lblock;
891 mblock = im.mblock;
892 singLocNodes0 = im.singLocNodes0;
893 ops_complexity = new long;
894 *ops_complexity = *(im.ops_complexity);
895 localPermute = im.localPermute;
896 isSym = im.isSym;
897 verbose = im.verbose;
898 fp = im.fp;
899 nb = im.nb;
900 debug = im.debug;
901 }
902 };
903
904 template<typename T>
905 struct DSchurGEMM_arg {
906 bool isSym;
907 bool isTrans;
908 RectBlockMatrix<T>* lower;
909 RectBlockMatrix<T>* upper;
910 int nrow;
911 int i_block; // row block index
912 int j_block; // column block index
913 SquareBlockMatrix<T> *localSchur;
914 long *ops_complexity;
915 bool verbose;
916 FILE **fp;
917 int nb;
918
919 ~DSchurGEMM_arg() {
920 delete ops_complexity;
921 }
922 DSchurGEMM_arg() {}
923 DSchurGEMM_arg(bool isSym_,
924 bool isTrans_,
925 RectBlockMatrix<T>* lower_,
926 RectBlockMatrix<T>* upper_,
927 int nrow_,
928 int i_block_,
929 int j_block_,
930 SquareBlockMatrix<T> *localSchur_,
931 bool verbose_,
932 FILE **fp_,
933 int nb_) :
934 isSym(isSym_),
935 isTrans(isTrans_),
936 lower(lower_),
937 upper(upper_),
938 nrow(nrow_),
939 i_block(i_block_),
940 j_block(j_block_),
941 localSchur(localSchur_),
942 verbose(verbose_),
943 fp(fp_),
944 nb(nb_)
945 {
946 ops_complexity = new long;
947 }
948
949 DSchurGEMM_arg(const DSchurGEMM_arg &im)
950 {
951 isSym = im.isSym;
952 isTrans = im.isTrans;
953 lower = im.lower;
954 upper = im.upper;
955 nrow = im.nrow;
956 i_block = im.i_block;
957 j_block = im.j_block;
958 localSchur = im.localSchur;
959 *ops_complexity = *(im.ops_complexity);
960 verbose = im.verbose;
961 fp = im.fp;
962 nb = im.nb;
963 }
964 };
965
966 template<typename T>
967 struct DSchurGEMM_two_arg {
968 bool isSym;
969 bool isTrans;
970 RectBlockMatrix<T>* lower0;
971 RectBlockMatrix<T>* upper0;
972 int nrow0;
973 RectBlockMatrix<T>* lower1;
974 RectBlockMatrix<T>* upper1;
975 int nrow1;
976 int i_block; // row block index
977 int j_block; // column block index
978 SquareBlockMatrix<T> *localSchur;
979 long *ops_complexity;
980 bool isSkip;
981 bool verbose;
982 FILE **fp;
983 int nb;
984
985 ~DSchurGEMM_two_arg() {
986 delete ops_complexity;
987 }
988 DSchurGEMM_two_arg() {}
989 DSchurGEMM_two_arg(bool isSym_,
990 bool isTrans_,
991 RectBlockMatrix<T>* lower0_,
992 RectBlockMatrix<T>* upper0_,
993 int nrow0_,
994 RectBlockMatrix<T>* lower1_,
995 RectBlockMatrix<T>* upper1_,
996 int nrow1_,
997 int i_block_,
998 int j_block_,
999 SquareBlockMatrix<T> *localSchur_,
1000 bool isSkip_,
1001 bool verbose_,
1002 FILE **fp_,
1003 int nb_) :
1004 isSym(isSym_),
1005 isTrans(isTrans_),
1006 lower0(lower0_),
1007 upper0(upper0_),
1008 nrow0(nrow0_),
1009 lower1(lower1_),
1010 upper1(upper1_),
1011 nrow1(nrow1_),
1012 i_block(i_block_),
1013 j_block(j_block_),
1014 localSchur(localSchur_),
1015 isSkip(isSkip_),
1016 verbose(verbose_),
1017 fp(fp_),
1018 nb(nb_)
1019 {
1020 ops_complexity = new long;
1021 }
1022
1023 DSchurGEMM_two_arg(const DSchurGEMM_two_arg &im)
1024 {
1025 isSym = im.isSym;
1026 isTrans = im.isTrans;
1027 lower0 = im.lower0;
1028 upper0 = im.upper0;
1029 nrow0 = im.nrow0;
1030 lower1 = im.lower1;
1031 upper1 = im.upper1;
1032 nrow1 = im.nrow1;
1033 i_block = im.i_block;
1034 j_block = im.j_block;
1035 localSchur = im.localSchur;
1036 *ops_complexity = *(im.ops_complexity);
1037 isSkip = im.isSkip;
1038 verbose = im.verbose;
1039 fp = im.fp;
1040 nb = im.nb;
1041 }
1042 };
1043
1044 template<typename T>
1045 struct C_deallocLower_arg {
1046 bool isSym;
1047 RectBlockMatrix<T>* lower;
1048 long *ops_complexity;
1049 ~C_deallocLower_arg() {
1050 delete ops_complexity;
1051 }
1052 C_deallocLower_arg() {}
1053 C_deallocLower_arg(bool isSym_,
1054 RectBlockMatrix<T>* lower_,
1055 long ops_complexity_) :
1056 isSym(isSym_),
1057 lower(lower_)
1058 {
1059 ops_complexity = new long;
1060 *ops_complexity = ops_complexity_;
1061 }
1062 C_deallocLower_arg(const C_deallocLower_arg &im)
1063 {
1064 isSym = im.isSym;
1065 lower = im.lower;
1066 ops_complexity = new long;
1067 *ops_complexity = *(im.ops_complexity);
1068 }
1069 };
1070
1071 template<typename T>
1072 struct C_deallocLocalSchur_arg {
1073 bool isSym;
1074 SquareBlockMatrix<T>* localSchur;
1075 int i_block;
1076 int j_block;
1077 long *ops_complexity;
1078 bool verbose;
1079 FILE **fp;
1080 int nb;
1081 ~C_deallocLocalSchur_arg() {
1082 delete ops_complexity;
1083 }
1084 C_deallocLocalSchur_arg() {}
1085 C_deallocLocalSchur_arg(bool isSym_,
1086 SquareBlockMatrix<T> *localSchur_,
1087 int i_block_,
1088 int j_block_,
1089 bool verbose_,
1090 FILE **fp_,
1091 int nb_) :
1092 isSym(isSym_),
1093 localSchur(localSchur_),
1094 i_block(i_block_),
1095 j_block(j_block_),
1096 verbose(verbose_),
1097 fp(fp_),
1098 nb(nb_) {
1099 ops_complexity = new long;
1100 }
1101 C_deallocLocalSchur_arg(const C_deallocLocalSchur_arg &im)
1102 {
1103 isSym = im.isSym;
1104 i_block = im.i_block;
1105 j_block = im.j_block;
1106 localSchur = im.localSchur;
1107 ops_complexity = im.ops_complexity;
1108 verbose = im.verbose;
1109 fp = im.fp;
1110 nb = im.nb;
1111 }
1112 };
1113
1114 struct C_dummy_arg {
1115 long *ops_complexity;
1116 bool verbose;
1117 FILE **fp;
1118 int nb;
1119 ~C_dummy_arg() {
1120 delete ops_complexity;
1121 }
1122 C_dummy_arg() {}
1123 C_dummy_arg(bool verbose_,
1124 FILE **fp_,
1125 int nb_) :
1126 verbose(verbose_),
1127 fp(fp_),
1128 nb(nb_) {
1129 ops_complexity = new long;
1130 *ops_complexity = (-1L);
1131 }
1132 C_dummy_arg(const C_dummy_arg & im)
1133 {
1134 ops_complexity = im.ops_complexity;
1135 fp = im.fp;
1136 nb = im.nb;
1137 }
1138 };
1139
1140 template<typename T, typename U>
1141 struct C_SparseFw_arg {
1142 int colors;
1143 int nb;
1144 bool isSym;
1145 int dim;
1146 bool **isTrans;
1147 int **nrhs;
1148 // void* diag_sparse;
1149 TridiagBlockMatrix<T, U> **tridiag;
1150 T **x;
1151 T **yi;
1152 T **zi;
1153 T *coef; // SparseMatrix<double>* ptDA; //
1154 int n_diag;
1155 int n_offdiag;
1156 int *ptRows;
1157 int *indCols;
1158 int *indVals;
1159 int *indVals_unsym;
1160 int *loc2glob_diag;
1161 long *ops_complexity;
1162 ~C_SparseFw_arg() {
1163 delete ops_complexity;
1164 }
1165 C_SparseFw_arg() {}
1166 C_SparseFw_arg(int colors_,
1167 int nb_,
1168 bool isSym_,
1169 int dim_,
1170 bool **isTrans_,
1171 int **nrhs_,
1172 TridiagBlockMatrix<T, U> **tridiag_,
1173 T **x_,
1174 T **yi_,
1175 T **zi_,
1176 T *coef_, // SparseMatrix<double>* ptDA_, //
1177 int n_diag_,
1178 int n_offdiag_,
1179 int *ptRows_,
1180 int *indCols_,
1181 int *indVals_,
1182 int *indVals_unsym_,
1183 int *loc2glob_diag_) :
1184 colors(colors_),
1185 nb(nb_),
1186 isSym(isSym_),
1187 dim(dim_),
1188 isTrans(isTrans_),
1189 nrhs(nrhs_),
1190 tridiag(tridiag_),
1191 x(x_),
1192 yi(yi_),
1193 zi(zi_),
1194 coef(coef_), // ptDA(ptDA_), //
1195 n_diag(n_diag_),
1196 n_offdiag(n_offdiag_),
1197 ptRows(ptRows_),
1198 indCols(indCols_),
1199 indVals(indVals_),
1200 indVals_unsym(indVals_unsym_),
1201 loc2glob_diag(loc2glob_diag_) {
1202 ops_complexity = new long;
1203 }
1204 C_SparseFw_arg(const C_SparseFw_arg &im)
1205 {
1206 colors = im.colors;
1207 nb = im.nb;
1208 isSym = im.isSym;
1209 dim = im.dim;
1210 isTrans = im.isTrans;
1211 nrhs = im.nrhs;
1212 tridiag = im.tridiag;
1213 x = im.x;
1214 yi = im.yi;
1215 zi = im.zi;
1216 coef = im.coef; // ptDA = im.ptDA; //
1217 n_diag = im.n_diag;
1218 n_offdiag = im.n_offdiag;
1219 ptRows = im.ptRows;
1220 indCols = im.indCols;
1221 indVals = im.indVals;
1222 indVals_unsym = im.indVals_unsym;
1223 loc2glob_diag = im.loc2glob_diag;
1224 }
1225 };
1226
1227 template<typename T, typename U>
1228 struct C_SparseBw_arg {
1229 int colors;
1230 int nb;
1231 bool isSym; // not used, for debugging
1232 int dim;
1233 bool **isTrans;
1234 int **nrhs;
1235 Dissection::Tree *btree;
1236 int level_last;
1237 TridiagBlockMatrix<T, U> **tridiag;
1238 T **x;
1239 T ***yy;
1240 T **xi;
1241 T **yi;
1242 T **zi;
1243 T *coef; // SparseMatrix<double>* ptDA; //
1244 int *ptRows;
1245 int *indCols;
1246 int *indVals;
1247 int *indVals_unsym;
1248 long *ops_complexity;
1249 ~C_SparseBw_arg() {
1250 delete ops_complexity;
1251 }
1252 C_SparseBw_arg() {}
1253 C_SparseBw_arg(int colors_,
1254 int nb_,
1255 bool isSym_,
1256 int dim_,
1257 bool **isTrans_,
1258 int **nrhs_,
1259 Dissection::Tree *btree_,
1260 int level_last_,
1261 TridiagBlockMatrix<T, U> **tridiag_,
1262 T **x_,
1263 T ***yy_,
1264 T **xi_,
1265 T **yi_,
1266 T **zi_,
1267 T *coef_, // SparseMatrix<double>* ptDA_, //
1268 int *ptRows_,
1269 int *indCols_,
1270 int *indVals_,
1271 int *indVals_unsym_) :
1272 colors(colors_),
1273 nb(nb_),
1274 isSym(isSym_),
1275 dim(dim_),
1276 isTrans(isTrans_),
1277 nrhs(nrhs_),
1278 btree(btree_),
1279 level_last(level_last_),
1280 // diag_sparse(diag_sparse_),
1281 tridiag(tridiag_),
1282 x(x_),
1283 yy(yy_),
1284 xi(xi_),
1285 yi(yi_),
1286 zi(zi_),
1287 coef(coef_), // ptDA(ptDA_), //
1288 ptRows(ptRows_),
1289 indCols(indCols_),
1290 indVals(indVals_),
1291 indVals_unsym(indVals_unsym_) {
1292 ops_complexity = new long;
1293 }
1294
1295 C_SparseBw_arg(const C_SparseBw_arg &im)
1296 {
1297 colors = im.colors;
1298 nb = im.nb;
1299 isSym = im.isSym;
1300 dim = im.dim;
1301 isTrans = im.isTrans;
1302 nrhs = im.nrhs;
1303 btree = im.btree;
1304 level_last = im.level_last;
1305 tridiag = im.tridiag;
1306 x = im.x;
1307 yy = im.yy;
1308 xi = im.xi;
1309 yi = im.yi;
1310 zi = im.zi;
1311 coef = im.coef; // ptDA = im.ptDA; //
1312 ptRows = im.ptRows;
1313 indCols = im.indCols;
1314 indVals = im.indVals;
1315 indVals_unsym = im.indVals_unsym;
1316 }
1317 };
1318
1319 struct C_task {
1320 int task_id;
1321 int referred;
1322 char *task_name; // is allocated by char [] when structure is constructed
1323 bool task_name_allocated;
1324 void *func_arg;
1325 void (*func)(void *);
1326 int atomic_size;
1327 int atomic_id;
1328 unsigned char status;
1329 list<C_task*>* parents;
1330 list<C_task*>* parents_work;
1331 int parallel_max;
1332 int parallel_id;
1333 long *ops_complexity; // value is assigned in func_arg->ops_complexity
1334 long flop;
1335 elapsed_t t0, t1;
1336 int thread_id;
1337 int broadcast_deadlock;
1338 bool quit_queue;
1339 int to_next_task;
1340 bool verbose;
1341 FILE ***fp;
1342
1343 ~C_task() {
1344 if (task_name_allocated) {
1345 delete [] task_name;
1346 }
1347 delete parents;
1348 delete parents_work;
1349 }
1350 C_task() {}
1351 C_task(int task_id_,
1352 string task_name_,
1353 void *func_arg_,
1354 void (*func_)(void *),
1355 int atomic_size_,
1356 int atomic_id_,
1357 long *ops_complexity_ ) :
1358 task_id(task_id_),
1359 referred(0),
1360 func_arg(func_arg_),
1361 func(func_),
1362 atomic_size(atomic_size_),
1363 atomic_id(atomic_id_),
1364 status(TASK_WAITING),
1365 parallel_max(1),
1366 parallel_id(0),
1367 ops_complexity(ops_complexity_),
1368 broadcast_deadlock(0),
1369 quit_queue(false),
1370 to_next_task(0) {
1371 if (!task_name_.empty()) {
1372 task_name = new char[task_name_.length() + 1];
1373 strcpy(task_name, task_name_.c_str());
1374 task_name_allocated = true;
1375 }
1376 else {
1377 task_name_allocated = false;
1378 }
1379 parents = new list<C_task*>;
1380 parents_work = new list<C_task*>;
1381 get_realtime(&t0); // reset time as created one
1382 COPYTIME(t1, t0);
1383 thread_id = (-1); // not executed yet
1384 }
1385
1386 C_task(const C_task &im)
1387 {
1388 task_id = im.task_id;
1389 referred = im.referred;
1390 if (im.task_name_allocated) {
1391 task_name = new char[strlen(im.task_name) + 1];
1392 strcpy(task_name, im.task_name);
1393 task_name_allocated = true;
1394 }
1395 else {
1396 task_name_allocated = false;
1397 }
1398 func_arg = im.func_arg;
1399 func = im.func;
1400 atomic_size = im.atomic_size;
1401 atomic_id = im.atomic_id;
1402 status = im.status;
1403 parents = im.parents;
1404 parents_work = im.parents_work;
1405 parallel_max = im.parallel_max;
1406 parallel_id = im.parallel_id;
1407 ops_complexity = im.ops_complexity; // copy pointer
1408 // nops = im.nops;
1409 flop = im.flop;
1410 t0 = im.t0;
1411 t1 = im.t1;
1412 thread_id = im.thread_id;
1413 quit_queue = im.quit_queue;
1414 to_next_task = im.to_next_task;
1415 verbose = im.verbose;
1416 fp = im.fp;
1417 }
1418 };
1419
1420 struct C_task_seq {
1421 int task_id;
1422 int referred;
1423 char *task_name; // is allocated by char [] when structure is constructed
1424 bool task_name_allocated;
1425 int mutex_id;
1426 int parallel_single; // TASK_PARALLEL/TASK_SINGLE
1427 int num_threads;
1428 // how to describe some (DFullLDLt)s which are shared
1429 // assignment of processor group for DFullLDLt is done by statically
1430 // 5 processors is assigned to 2 + 1 + 1 + 1 / 3 + 2 / 5
1431 // with concerning task size
1432 int level;
1433 int phase;
1434 vector <C_task *> *queue;
1435 int begin;
1436 int end;
1437 unsigned char status;
1438 int pos;
1439 long ops_complexity;
1440
1441 ~C_task_seq() {
1442 if (task_name_allocated) {
1443 delete [] task_name;
1444 }
1445 }
1446 C_task_seq() {}
1447 C_task_seq(int task_id_,
1448 string task_name_,
1449 int mutex_id_,
1450 int parallel_single_,
1451 int num_threads_,
1452 int level_,
1453 int phase_,
1454 vector <C_task *> *queue_,
1455 int begin_,
1456 int end_,
1457 long ops_complexity_) :
1458 task_id(task_id_),
1459 referred(0),
1460 // task_name(task_name_),
1461 mutex_id(mutex_id_),
1462 parallel_single(parallel_single_),
1463 num_threads(num_threads_),
1464 level(level_),
1465 phase(phase_),
1466 queue(queue_),
1467 begin(begin_),
1468 end(end_),
1469 status(TASK_WAITING),
1470 pos(begin_),
1471 ops_complexity(ops_complexity_) {
1472 if (!task_name_.empty()) {
1473 task_name = new char[task_name_.length() + 1];
1474 strcpy(task_name, task_name_.c_str());
1475 task_name_allocated = true;
1476 }
1477 else {
1478 task_name_allocated = false;
1479 }
1480 } ;
1481
1482 C_task_seq(const C_task_seq &im)
1483 {
1484 task_id = im.task_id;
1485 referred = im.referred;
1486 if (im.task_name_allocated) {
1487 task_name = new char[strlen(im.task_name) + 1];
1488 strcpy(task_name, im.task_name);
1489 task_name_allocated = true;
1490 }
1491 else {
1492 task_name_allocated = false;
1493 }
1494 mutex_id = im.mutex_id;
1495 parallel_single = im.parallel_single;
1496 num_threads = im.num_threads;
1497 level = im.level;
1498 phase = im.phase;
1499 queue = im.queue; // copy pointer
1500 begin = im.begin;
1501 end = im.end;
1502 status = im.status;
1503 pos = im.pos;
1504 ops_complexity = im.ops_complexity;
1505 }
1506 };
1507
1508
1509
1510 bool C_task_seq_complexity_smaller(C_task_seq *a, C_task_seq *b);
1511 bool C_task_seq_complexity_greater(C_task_seq *a, C_task_seq *b);
1512 bool C_task_seq_beginidx_smaller(C_task_seq *a, C_task_seq *b);
1513
1514 struct index_strip {
1515 int begin_dst;
1516 int begin_src;
1517 int width;
1518 ~index_strip() {}
1519 index_strip() {}
1520 index_strip(int begin_dst_, int begin_src_, int width_) :
1521 begin_dst(begin_dst_),
1522 begin_src(begin_src_),
1523 width(width_) {}
1524 index_strip(const index_strip &im)
1525 {
1526 begin_dst = im.begin_dst;
1527 begin_src = im.begin_src;
1528 width = im.width;
1529 }
1530 };
1531
1532 struct index_strip2 {
1533 int begin_dst;
1534 int begin_src0;
1535 int begin_src1;
1536 int width;
1537 ~index_strip2() {}
1538 index_strip2() {}
1539 index_strip2(int begin_dst_, int begin_src0_, int begin_src1_, int width_) :
1540 begin_dst(begin_dst_),
1541 begin_src0(begin_src0_),
1542 begin_src1(begin_src1_),
1543 width(width_) {}
1544 index_strip2(const index_strip2 &im)
1545 {
1546 begin_dst = im.begin_dst;
1547 begin_src0 = im.begin_src0;
1548 begin_src1 = im.begin_src1;
1549 width = im.width;
1550 }
1551 };
1552
1553 template<typename T>
1554 struct child_contribution {
1555 int child_id;
1556 int diag_size;
1557 int offdiag_size;
1558 list <index_strip> diag_strip;
1559 list <index_strip> offdiag_strip;
1560 int father_row;
1561 SquareBlockMatrix<T> *father_diag_pt;
1562 RectBlockMatrix<T> *father_offdiag_pt;
1563 RectBlockMatrix<T> *father_offdiag_unsym_pt;
1564 int child_row;
1565 SquareBlockMatrix<T>* child_pt;
1566 // double **child_pt;
1567 ~child_contribution() {}
1568 child_contribution() {}
1569 child_contribution(int child_id_,
1570 int diag_size_,
1571 int offdiag_size_,
1572 list <index_strip> diag_strip_,
1573 list <index_strip> offdiag_strip_,
1574 SquareBlockMatrix<T> *father_diag_pt_,
1575 RectBlockMatrix<T> *father_offdiag_pt_,
1576 RectBlockMatrix<T> *father_offdiag_unsym_pt_,
1577 int child_row_,
1578 SquareBlockMatrix<T>* child_pt_ ) :
1579 child_id(child_id_),
1580 diag_size(diag_size_),
1581 offdiag_size(offdiag_size_),
1582 diag_strip(diag_strip_),
1583 offdiag_strip(offdiag_strip_),
1584 father_row(diag_size_), // father_row(father_row_),
1585 father_diag_pt(father_diag_pt_),
1586 father_offdiag_pt(father_offdiag_pt_),
1587 father_offdiag_unsym_pt(father_offdiag_unsym_pt_),
1588 child_row(child_row_),
1589 child_pt(child_pt_) {}
1590
1591 child_contribution(const child_contribution &im)
1592 {
1593 child_id = im.child_id;
1594 diag_size = im.diag_size;
1595 offdiag_size = im.offdiag_size;
1596 diag_strip = im.diag_strip;
1597 offdiag_strip = im.offdiag_strip;
1598 father_row = im.father_row;
1599 father_diag_pt = im.father_diag_pt;
1600 father_offdiag_pt = im.father_offdiag_pt;
1601 father_offdiag_unsym_pt = im.father_offdiag_unsym_pt;
1602 child_row = im.child_row;
1603 child_pt = im.child_pt;
1604 }
1605 };
1606
1607 struct diag_contribution {
1608 int child_id;
1609 int child_row;
1610 int child_column;
1611 int father_row;
1612 list <index_strip> diag_strip;
1613 ~diag_contribution() {}
1614 diag_contribution() {}
1615 diag_contribution(int child_id_,
1616 int child_row_,
1617 int child_column_,
1618 int father_row_,
1619 list <index_strip> diag_strip_) :
1620 child_id(child_id_),
1621 child_row(child_row_),
1622 child_column(child_column_),
1623 father_row(father_row_),
1624 diag_strip(diag_strip_) {}
1625
1626 diag_contribution(const diag_contribution &im)
1627 {
1628 child_id = im.child_id;
1629 child_row = im.child_row;
1630 child_column = im.child_column;
1631 father_row = im.father_row;
1632 diag_strip = im.diag_strip;
1633 }
1634 };
1635
1636 template<typename T>
1637 struct C_Dsub_FwBw_arg {
1638 int dim;
1639 int **nrhs;
1640 int n_diag;
1641 bool access_global;
1642 int level;
1643 Dissection::Tree *btree;
1644 list<diag_contribution>* diag_contribs;
1645 T **x;
1646 T **yi;
1647 T ***zi;
1648 int *loc2glob_diag;
1649 long *ops_complexity;
1650 ~C_Dsub_FwBw_arg() {
1651 delete ops_complexity;
1652 }
1653 C_Dsub_FwBw_arg() {}
1654 C_Dsub_FwBw_arg(int dim_,
1655 int **nrhs_,
1656 int n_diag_,
1657 bool access_global_,
1658 int level_,
1659 Dissection::Tree *btree_,
1660 list<diag_contribution>* diag_contribs_,
1661 T **x_,
1662 T **yi_,
1663 T ***zi_,
1664 int *loc2glob_diag_) :
1665 dim(dim_),
1666 nrhs(nrhs_),
1667 n_diag(n_diag_),
1668 access_global(access_global_),
1669 level(level_),
1670 btree(btree_),
1671 diag_contribs(diag_contribs_),
1672 x(x_),
1673 yi(yi_),
1674 zi(zi_),
1675 loc2glob_diag(loc2glob_diag_) {
1676 ops_complexity = new long;
1677 }
1678 C_Dsub_FwBw_arg(const C_Dsub_FwBw_arg &im)
1679 {
1680 dim = im.dim;
1681 nrhs = im.nrhs;
1682 n_diag = im.n_diag;
1683 level = im.level;
1684 access_global = im.access_global;
1685 btree = im.btree;
1686 diag_contribs = im.diag_contribs;
1687 x = im.x;
1688 yi = im.yi;
1689 zi = im.zi;
1690 loc2glob_diag = im.loc2glob_diag;
1691 ops_complexity = im.ops_complexity;
1692 }
1693 };
1694
1695 template<typename T>
1696 struct C_Dfill_FwBw_arg {
1697 int **nrhs;
1698 int d;
1699 int level;
1700 Dissection::Tree *btree;
1701 int n_offdiag;
1702 T ***yi;
1703 T **zi;
1704 long *ops_complexity;
1705 ~C_Dfill_FwBw_arg() {
1706 delete ops_complexity;
1707 }
1708 C_Dfill_FwBw_arg() {}
1709 C_Dfill_FwBw_arg(int **nrhs_,
1710 int d_,
1711 int level_,
1712 Dissection::Tree *btree_,
1713 int n_offdiag_,
1714 T ***yi_,
1715 T **zi_) :
1716 nrhs(nrhs_),
1717 d(d_),
1718 level(level_),
1719 btree(btree_),
1720 n_offdiag(n_offdiag_),
1721 yi(yi_),
1722 zi(zi_) {
1723 ops_complexity = new long;
1724 }
1725 C_Dfill_FwBw_arg(const C_Dfill_FwBw_arg &im)
1726 {
1727 nrhs = im.nrhs;
1728 d = im.d;
1729 level = im.level;
1730 btree = im.btree;
1731 n_offdiag = im.n_offdiag;
1732 yi = im.yi;
1733 zi = im.zi;
1734 ops_complexity = im.ops_complexity;
1735 }
1736 };
1737
1738 template<typename T>
1739 struct C_DenseFwBw_arg
1740 {
1741 bool isSym;
1742 bool isBackward;
1743 int dim;
1744 bool **isTrans;
1745 int **nrhs;
1746 int n_diag;
1747 int nrow;
1748 int k_block;
1749 int kk;
1750 T **xi;
1751 T **wi;
1752 T **yi;
1753 T **x;
1754 SquareBlockMatrix<T> *LDLt;
1755 bool isFirstBlock;
1756 bool isLastBlock;
1757 int *loc2glob;
1758 long *ops_complexity;
1759 bool verbose;
1760 FILE **fp;
1761 ~C_DenseFwBw_arg() {
1762 delete ops_complexity;
1763 }
1764 C_DenseFwBw_arg() {}
1765
1766 C_DenseFwBw_arg(bool isSym_,
1767 bool isBackward_,
1768 int dim_,
1769 bool **isTrans_,
1770 int **nrhs_,
1771 int n_diag_,
1772 int nrow_,
1773 int k_block_,
1774 int kk_,
1775 T **xi_,
1776 T **wi_,
1777 T **yi_,
1778 T **x_,
1779 SquareBlockMatrix<T> *LDLt_,
1780 bool isFirstBlock_,
1781 bool isLastBlock_,
1782 int *loc2glob_,
1783 bool verbose_,
1784 FILE **fp_) :
1785 isSym(isSym_),
1786 isBackward(isBackward_),
1787 dim(dim_),
1788 isTrans(isTrans_),
1789 nrhs(nrhs_),
1790 n_diag(n_diag_),
1791 nrow(nrow_),
1792 k_block(k_block_),
1793 kk(kk_),
1794 xi(xi_),
1795 wi(wi_),
1796 yi(yi_),
1797 x(x_),
1798 LDLt(LDLt_),
1799 isFirstBlock(isFirstBlock_),
1800 isLastBlock(isLastBlock_),
1801 loc2glob(loc2glob_),
1802 verbose(verbose_),
1803 fp(fp_)
1804 {
1805 ops_complexity = new long;
1806 }
1807 C_DenseFwBw_arg(C_DenseFwBw_arg &im)
1808 {
1809 isSym = im.isSym;
1810 isBackward = im.isBackward;
1811 dim = im.dim;
1812 isTrans = im.isTrans;
1813 nrhs = im.nrhs;
1814 n_diag = im.n_diag;
1815 nrow = im.nrow;
1816 k_block = im.k_block;
1817 kk = im.kk;
1818 xi = im.xi;
1819 wi = im.wi;
1820 yi = im.yi;
1821 x = im.x;
1822 LDLt = im.LDLt;
1823 isFirstBlock = im.isFirstBlock;
1824 isLastBlock = im.isLastBlock;
1825 loc2glob = im.loc2glob;
1826 verbose = im.verbose;
1827 fp = im.fp;
1828 }
1829 };
1830
1831 template<typename T>
1832 struct C_DenseFwBwOffdiag_arg
1833 {
1834 bool trans;
1835 bool isLower;
1836 int dim;
1837 bool **isTrans;
1838 int **nrhs;
1839 int lda;
1840 int ldb;
1841 int ldc;
1842 int nrow;
1843 int ncol;
1844 T **xi;
1845 int ii;
1846 T **yi;
1847 T **zi;
1848 int jj;
1849 SquareBlockMatrix<T> *LDLt;
1850 int i_block;
1851 int j_block;
1852 T alpha;
1853 T beta;
1854 long *ops_complexity;
1855
1856 ~C_DenseFwBwOffdiag_arg() {
1857 delete ops_complexity;
1858 }
1859 C_DenseFwBwOffdiag_arg() {}
1860
1861 C_DenseFwBwOffdiag_arg(bool trans_,
1862 bool isLower_,
1863 int dim_,
1864 bool **isTrans_,
1865 int **nrhs_,
1866 int lda_,
1867 int ldb_,
1868 int ldc_,
1869 int nrow_,
1870 int ncol_,
1871 T **xi_,
1872 int ii_,
1873 T **yi_,
1874 T **zi_,
1875 int jj_,
1876 SquareBlockMatrix<T> *LDLt_,
1877 int i_block_,
1878 int j_block_,
1879 T alpha_,
1880 T beta_) :
1881 trans(trans_),
1882 isLower(isLower_),
1883 dim(dim_),
1884 isTrans(isTrans_),
1885 nrhs(nrhs_),
1886 lda(lda_),
1887 ldb(ldb_),
1888 ldc(ldc_),
1889 nrow(nrow_),
1890 ncol(ncol_),
1891 xi(xi_),
1892 ii(ii_),
1893 yi(yi_),
1894 zi(zi_),
1895 jj(jj_),
1896 LDLt(LDLt_),
1897 i_block(i_block_),
1898 j_block(j_block_),
1899 alpha(alpha_),
1900 beta(beta_)
1901 {
1902 ops_complexity = new long;
1903 }
1904 C_DenseFwBwOffdiag_arg(C_DenseFwBwOffdiag_arg &im)
1905 {
1906 trans = im.trans;
1907 isLower = im.isLower;
1908 dim = im.dim;
1909 isTrans = im.isTrans;
1910 nrhs = im.nrhs;
1911 lda = im.lda;
1912 ldb = im.ldb;
1913 ldc = im.ldc;
1914 nrow = im.nrow;
1915 ncol = im.ncol;
1916 xi = im.xi;
1917 ii = im.ii;
1918 yi = im.yi;
1919 zi = im.zi;
1920 jj = im.jj;
1921 LDLt = im.LDLt;
1922 i_block = im.i_block;
1923 j_block = im.j_block;
1924 alpha = im.alpha;
1925 beta = im.beta;
1926 ops_complexity = im.ops_complexity;
1927 }
1928 };
1929
1930 template<typename T>
1931 struct C_StripsFwBwOffdiag_arg
1932 {
1933 bool isLower;
1934 int dim;
1935 bool **isTrans;
1936 int **nrhs;
1937 int lda;
1938 int ldb;
1939 int ldc;
1940 int nrow;
1941 int ncol;
1942 T **xi;
1943 int ii;
1944 T **yi;
1945 int jj;
1946 RectBlockMatrix<T> *upper;
1947 RectBlockMatrix<T> *lower;
1948 int i_block;
1949 int j_block;
1950 T alpha;
1951 T beta;
1952 long *ops_complexity;
1953
1954 ~C_StripsFwBwOffdiag_arg() {
1955 delete ops_complexity;
1956 }
1957 C_StripsFwBwOffdiag_arg() {}
1958
1959 C_StripsFwBwOffdiag_arg(bool isLower_,
1960 int dim_,
1961 bool **isTrans_,
1962 int **nrhs_,
1963 int lda_,
1964 int ldb_,
1965 int ldc_,
1966 int nrow_,
1967 int ncol_,
1968 T **xi_,
1969 int ii_,
1970 T **yi_,
1971 int jj_,
1972 RectBlockMatrix<T> *upper_,
1973 RectBlockMatrix<T> *lower_,
1974 int i_block_,
1975 int j_block_,
1976 T alpha_,
1977 T beta_) :
1978 isLower(isLower_),
1979 dim(dim_),
1980 isTrans(isTrans_),
1981 nrhs(nrhs_),
1982 lda(lda_),
1983 ldb(ldb_),
1984 ldc(ldc_),
1985 nrow(nrow_),
1986 ncol(ncol_),
1987 xi(xi_),
1988 ii(ii_),
1989 yi(yi_),
1990 jj(jj_),
1991 upper(upper_),
1992 lower(lower_),
1993 i_block(i_block_),
1994 j_block(j_block_),
1995 alpha(alpha_),
1996 beta(beta_)
1997 {
1998 ops_complexity = new long;
1999 }
2000 C_StripsFwBwOffdiag_arg(C_StripsFwBwOffdiag_arg &im)
2001 {
2002 isLower = im.isLower;
2003 dim = im.dim;
2004 isTrans = im.isTrans;
2005 nrhs = im.nrhs;
2006 lda = im.lda;
2007 ldb = im.ldb;
2008 ldc = im.ldc;
2009 nrow = im.nrow;
2010 ncol = im.ncol;
2011 xi = im.xi;
2012 ii = im.ii;
2013 yi = im.yi;
2014 jj = im.jj;
2015 upper = im.upper;
2016 lower = im.lower;
2017 i_block = im.i_block;
2018 j_block = im.j_block;
2019 alpha = im.alpha;
2020 beta = im.beta;
2021 ops_complexity = im.ops_complexity;
2022 }
2023 };
2024
2025
2026 #define RESTRICT
2027
2028 void print_strips(const char *name, list<index_strip> &strips, FILE *fp);
2029 void print_strips(const char *name, list<index_strip2> &strips, FILE *fp);
2030
2031 void assign_tasks_statically(list<C_task_seq*> *queue_static,
2032 list<C_task_seq*> &queue_dynamic,
2033 long *nops_sum,
2034 list<C_task_seq *> &task_seq_tmp,
2035 const int task_id,
2036 const char *task_name_,
2037 const int level,
2038 const int phase,
2039 const long nops_block_total,
2040 int num_threads);
2041
2042 template<typename T>
2043 int count_diag_negative(SquareBlockMatrix<T>& Diag);
2044 template<>
2045 int count_diag_negative<double>(SquareBlockMatrix<double>& Diag);
2046 template<>
2047 int count_diag_negative<complex<double> >(SquareBlockMatrix<complex<double> >& Diag);
2048 template<>
2049 int count_diag_negative<quadruple>(SquareBlockMatrix<quadruple>& Diag);
2050 template<>
2051 int count_diag_negative<complex<quadruple> >(SquareBlockMatrix<complex<quadruple> >& Diag);
2052 template<>
2053 int count_diag_negative<float>(SquareBlockMatrix<float>& Diag);
2054 template<>
2055 int count_diag_negative<complex<float> >(SquareBlockMatrix<complex<float> >& Diag);
2056
2057 template<typename T>
2058 int count_diag_negative(SubSquareMatrix<T>& Diag);
2059 template<>
2060 int count_diag_negative<double>(SubSquareMatrix<double>& Diag);
2061 template<>
2062 int count_diag_negative<complex<double> >(SubSquareMatrix<complex<double> >& Diag);
2063 template<>
2064 int count_diag_negative<quadruple>(SubSquareMatrix<quadruple>& Diag);
2065 template<>
2066 int count_diag_negative<complex<quadruple> >(SubSquareMatrix<complex<quadruple> >& Diag);
2067 template<>
2068 int count_diag_negative<float>(SubSquareMatrix<float>& Diag);
2069 template<>
2070 int count_diag_negative<complex<float> >(SubSquareMatrix<complex<float> >& Diag);
2071
2072 template<typename T, typename U>
2073 void full_gauss3(int *n0,
2074 T *a,
2075 const int n,
2076 double *pivot,
2077 int *permute,
2078 const bool isSym,
2079 const double eps,
2080 const bool verbose,
2081 FILE *fp);
2082
2083 void CopyUpper2LowerSymm(double RESTRICT *s, const double RESTRICT *s_t,
2084 const int size_b2,
2085 int i, int block_nrow, int ncol);
2086
2087 void CopyUpper2LowerSquare(double RESTRICT *s, const double RESTRICT *s_t,
2088 const int size_b2,
2089 int i, int j, int block_nrow, int block_ncol,
2090 int ncol);
2091
2092 template<typename T, typename U>
2093 void C_SparseSymbFact(void *arg_);
2094
2095 template<typename T, typename U>
2096 void C_SparseNumFact(void *arg_);
2097
2098 template<typename T, typename U>
2099 void C_SparseLocalSchur(void *arg_);
2100
2101 template<typename T>
2102 void dump_matrix(FILE *fp, const int nrow, T *a);
2103 template<>
2104 void dump_matrix<double>(FILE *fp, const int nrow, double *a);
2105
2106 template<typename T>
2107 void dump_matrix(FILE *fp, const int nrow, const int ncol, T *a);
2108 template<>
2109 void dump_matrix<double>(FILE *fp, const int nrow, const int ncol, double *a);
2110
2111 template<typename T>
2112 void dump_matrix(FILE *fp, const int kk,
2113 const int nrow, const int ncol, const int nn, T *a);
2114
2115 template<typename T>
2116 void dump_matrix(FILE *fp,
2117 RectBlockMatrix<T> &a);
2118
2119 template<typename T>
2120 void dump_matrix(FILE *fp,
2121 SquareBlockMatrix<T> &a);
2122
2123 template<typename T>
2124 void dump_matrix(FILE *fp, const int nrow, const int nnz, int *prow,
2125 int *indcols, int *indvals, T *a);
2126 template<typename T, typename U>
2127 void C_dfull_gauss_b(void *arg_);
2128
2129 template<typename T>
2130 void C_dinvDL_timesU(void *arg_);
2131
2132 template<typename T>
2133 void C_dupdateb_Schur_diag(void *arg_);
2134
2135 template<typename T>
2136 void C_dupdateb_Schur_offdiag(void *arg_);
2137
2138 template<typename T, typename U>
2139 void C_gauss_whole_pivot(void *arg_);
2140
2141 template<typename T>
2142 void C_dupdateb_Schur_offdiag_t(void *arg_);
2143
2144 void C_CopyLowerMatrix(int n, const double *A, double *LDlt);
2145
2146 void C_DTRSMScale_solve_seq(void *arg_);
2147
2148 template<typename T>
2149 void C_FillSymMatrix(void *arg_);
2150
2151 template<typename T>
2152 void C_FillMatrix_diag(void *arg_);
2153
2154 template<typename T>
2155 void C_FillMatrix_offdiag(void *arg_);
2156
2157 template<typename T>
2158 void DSchurGEMM_diag(void *arg_);
2159
2160 template<typename T>
2161 void DSchurGEMM_diag_two(void *arg_);
2162
2163
2164 template<typename T>
2165 void DSchurGEMM_offdiag(void *arg_);
2166
2167 template<typename T>
2168 void DSchurGEMM_offdiag_two(void *arg_);
2169
2170 template<typename T>
2171 void C_DTRSMScale_diag_upper(void *arg_);
2172
2173 template<typename T>
2174 void C_DTRSMScale_offdiag_upper(void *arg_);
2175
2176 template<typename T>
2177 void C_DTRSMScale_diag_lower(void *arg_);
2178
2179 template<typename T>
2180 void C_DTRSMScale_offdiag_lower(void *arg_);
2181
2182 template<typename T>
2183 void C_DTRSMScale_solve(void *arg_);
2184
2185 template<typename T>
2186 void C_deallocLower(void *arg_);
2187
2188 template<typename T>
2189 void C_deallocLocalSchur(void *arg_);
2190
2191 template<typename T, typename U>
2192 void C_SparseFw(void *arg_);
2193
2194 template<typename T, typename U>
2195 void C_SparseBw(void *arg_);
2196
2197 template<typename T>
2198 void C_Dsub_FwBw(void *arg_);
2199
2200 template<typename T>
2201 void C_DenseFwBw_diag(void *arg_);
2202
2203 template<typename T>
2204 void C_DenseFwBw_offdiag(void *arg_);
2205
2206 template<typename T>
2207 void C_StripsFwBw_offdiag(void *arg_);
2208
2209 template<typename T>
2210 void C_Dfill_FwBw(void *arg_);
2211
2212 template<typename T, typename U>
2213 void erase_task(C_task *& task);
2214
2215 void C_dummy(void *arg_);
2216
2217 #define imin(a, b) ((a) < (b) ? (a) : (b))
2218 #define imax(a, b) ((a) > (b) ? (a) : (b))
2219
2220 int compare_DTRSMScale_task(const void *_a, const void *_b);
2221 int compare_DSchurGEMM_task(const void* _a, const void* _b);
2222 int compare_source_dist_index(const void *_a, const void *_b);
2223
2224 int convert_array2strip(list<index_strip> &strips,
2225 vector<int>& array);
2226
2227 int combine_two_strips(list<index_strip> &stripsa,
2228 list<index_strip> &stripsb,
2229 list<index_strip2> &stripsc,
2230 list<index_strip> &strips0,
2231 list<index_strip> &strips1,
2232 const int size);
2233 void copy_two_strips(list<index_strip2> &strips2,
2234 list<index_strip> &strips0,
2235 list<index_strip> &strips1);
2236
2237 void split_two_strips(list<index_strip> &strips0,
2238 list<index_strip> &strips1,
2239 list<index_strip2> &strips2,
2240 index_strip strip0,
2241 index_strip strip1);
2242
2243 template<typename T, typename U>
2244 int dimKernDense(vector<int> &singIdx,
2245 const int n,
2246 const int aug_dim,
2247 const U eps_machine,
2248 const double eps_piv,
2249 SquareBlockMatrix<T> &D,
2250 T *a,
2251 const bool refactorize,
2252 const bool isBlocked,
2253 const bool isSym,
2254 const bool verbose,
2255 FILE *fp);
2256
2257 template<typename T>
2258 void calc_relative_norm(double *norm_l2, double *norm_infty,
2259 const T *v, const T *u, const int dim);
2260 template<>
2261 void calc_relative_norm<double>(double *norm_l2, double *norm_infty,
2262 const double *v, const double *u,
2263 const int dim);
2264 template<>
2265 void calc_relative_norm<quadruple>(double *norm_l2, double *norm_infty,
2266 const quadruple *v, const quadruple *u,
2267 const int dim);
2268 template<>
2269 void calc_relative_norm<complex<double> >(double *norm_l2, double *norm_infty,
2270 const complex<double> *v,
2271 const complex<double> *u,
2272 const int dim);
2273 template<>
2274 void calc_relative_norm<complex<quadruple> >(double *norm_l2,
2275 double *norm_infty,
2276 const complex<quadruple> *v,
2277 const complex<quadruple> *u,
2278 const int dim);
2279
2280 template<typename T, typename U>
2281 void calc_relative_normscaled(double *norm_l2, double *norm_infty,
2282 const T *v, const T *u, const U *w,
2283 const int dim);
2284 template<>
2285 void calc_relative_normscaled<double,
2286 double>(double *norm_l2, double *norm_infty,
2287 const double *v, const double *u,
2288 const double *w,
2289 const int dim);
2290 template<>
2291 void calc_relative_normscaled<quadruple,
2292 quadruple>(double *norm_l2, double *norm_infty,
2293 const quadruple *v, const quadruple *u,
2294 const quadruple *w,
2295 const int dim);
2296
2297 template<>
2298 void calc_relative_normscaled<quadruple,
2299 double>(double *norm_l2, double *norm_infty,
2300 const quadruple *v, const quadruple *u,
2301 const double *w,
2302 const int dim);
2303
2304 template<>
2305 void calc_relative_normscaled<complex<double>,
2306 double>(double *norm_l2, double *norm_infty,
2307 const complex<double> *v,
2308 const complex<double> *u,
2309 const double *w,
2310 const int dim);
2311 template<>
2312 void calc_relative_normscaled<complex<quadruple>,
2313 quadruple>(double *norm_l2,
2314 double *norm_infty,
2315 const complex<quadruple> *v,
2316 const complex<quadruple> *u,
2317 const quadruple *w,
2318 const int dim);
2319
2320 template<>
2321 void calc_relative_normscaled<complex<quadruple>,
2322 double>(double *norm_l2,
2323 double *norm_infty,
2324 const complex<quadruple> *v,
2325 const complex<quadruple> *u,
2326 const double *w,
2327 const int dim);
2328
2329 int CSR_sym2unsym(CSR_indirect *unsym,
2330 const int *ptSymRows, const int *indSymCols,
2331 const int *map_eqn, const int *remap_eqn,
2332 const int dim,
2333 const bool upper_flag = true,
2334 const bool verbose = false, FILE *fp = NULL);
2335
2336 bool CSR_unsym2unsym(CSR_indirect *unsym,
2337 const int *ptUnSymRows, const int *indUnSymCols,
2338 const int *map_eqn, const int *remap_eqn,
2339 const int dim, const bool vebose, FILE *fp);
2340
2341 void swap_queues_n(vector <C_task *> &queue,
2342 vector<int> &queue_index,
2343 const int ii,
2344 const int jj,
2345 const int n,
2346 vector <C_task *> &tmp,
2347 vector<int> &tmp_index);
2348
2349 int EraseNullParents(vector<C_task *> &queue);
2350 int EraseNullParents(C_task *task);
2351
2352 bool compare_task_name(C_task *first, C_task *second);
2353
2354 extern "C" {
2355 void c_getrealtime_(uint64_t &tmprofiles, const int &m);
2356 void c_fileout_(uint64_t &fp_prt, char *strgs, const int &force_stderr);
2357 }
2358
2359 void swap_2x2pivots(const int way,
2360 int *pivot_width, int *permute_q,
2361 const int dim_augkern, const int nn0,
2362 const int n_dim, double *a1, long double *aq,
2363 double *d1, long double *d1q, double *a_fact);
2364
2365 template<typename T> void dump_vectors(int nrow, int nn0, T *v,
2366 string fname);
2367
2368 void ComputeSVD(double *b, const double *a_, const int n);
2369 #endif