File: magmasparse_types.h

package info (click to toggle)
magma 2.5.4%2Bds-3
  • links: PTS, VCS
  • area: contrib
  • in suites: bullseye
  • size: 55,132 kB
  • sloc: cpp: 403,043; fortran: 121,916; ansic: 29,190; python: 25,167; f90: 13,666; makefile: 776; csh: 232; xml: 182; sh: 178; perl: 88
file content (876 lines) | stat: -rw-r--r-- 40,749 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
/*
    -- MAGMA (version 2.5.4) --
       Univ. of Tennessee, Knoxville
       Univ. of California, Berkeley
       Univ. of Colorado, Denver
       @date October 2020
*/

#ifndef MAGMASPARSE_TYPES_H
#define MAGMASPARSE_TYPES_H


#if defined(HAVE_PASTIX)
//PaStiX include
#include <stdint.h>
/* to access functions from the libpastix, respect this order */
#include <pastix.h>
#include <read_matrix.h>
#include <get_options.h>
#include <assert.h>
#include <omp.h>
#endif

// includes CUDA
#include <cusparse_v2.h>



#ifdef __cplusplus
extern "C" {
#endif


#define MAGMA_CSR5_OMEGA 32

typedef struct magma_z_matrix
{
    magma_storage_t    storage_type;            // matrix format - CSR, ELL, SELL-P, CSR5
    magma_location_t   memory_location;         // CPU or DEV
    magma_symmetry_t   sym;                     // opt: indicate symmetry
    magma_diagorder_t  diagorder_type;          // opt: only needed for factorization matrices
    magma_uplo_t   fill_mode;               // fill mode full/lower/upper
    magma_int_t        num_rows;                // number of rows
    magma_int_t        num_cols;                // number of columns
    magma_int_t        nnz;                     // opt: number of nonzeros
    magma_int_t        max_nnz_row;             // opt: max number of nonzeros in one row
    magma_int_t        diameter;                // opt: max distance of entry from main diagonal
    magma_int_t        true_nnz;              // opt: true nnz
    magma_bool_t       ownership;               // does MAGMA own the arrays of this matrix structure
    union {
        magmaDoubleComplex      *val;           // array containing values in CPU case
        magmaDoubleComplex_ptr  dval;           // array containing values in DEV case
    };
    union {
        magmaDoubleComplex      *diag;          // opt: diagonal entries in CPU case
        magmaDoubleComplex_ptr  ddiag;          // opt: diagonal entries in DEV case
    };
    union {
        magma_index_t           *row;           // opt: row pointer CPU case
        magmaIndex_ptr          drow;           // opt: row pointer DEV case
    };
    union {
        magma_index_t           *rowidx;        // opt: array containing row indices CPU case
        magmaIndex_ptr          drowidx;        // opt: array containing row indices DEV case
    };
    union {
        magma_index_t           *col;           // opt: array containing col indices CPU case
        magmaIndex_ptr          dcol;           // opt: array containing col indices DEV case
    };
    union {
        magma_index_t           *list;          // opt: linked list pointing to next element
        magmaIndex_ptr          dlist;          // opt: linked list pointing to next element
    };
    union {
        magma_uindex_t           *tile_ptr;              // opt: CSR5 tile pointer CPU case
        magmaUIndex_ptr          dtile_ptr;              // opt: CSR5 tile pointer DEV case
    };
    union {
        magma_uindex_t           *tile_desc;             // opt: CSR5 tile descriptor CPU case
        magmaUIndex_ptr          dtile_desc;             // opt: CSR5 tile descriptor DEV case
    };
    union {
        magma_index_t            *tile_desc_offset_ptr;  // opt: CSR5 tile descriptor offset pointer CPU case
        magmaIndex_ptr           dtile_desc_offset_ptr;  // opt: CSR5 tile descriptor offset pointer DEV case
    };
    union {
        magma_index_t            *tile_desc_offset;      // opt: CSR5 tile descriptor offset CPU case
        magmaIndex_ptr           dtile_desc_offset;      // opt: CSR5 tile descriptor offset DEV case
    };
    union {
        magmaDoubleComplex       *calibrator;            // opt: CSR5 calibrator CPU case
        magmaDoubleComplex_ptr   dcalibrator;            // opt: CSR5 calibrator DEV case
    };
    magma_index_t      *blockinfo;              // opt: for BCSR format CPU case
    magma_int_t        blocksize;               // opt: info for SELL-P/BCSR
    magma_int_t        numblocks;               // opt: info for SELL-P/BCSR
    magma_int_t        alignment;               // opt: info for SELL-P/BCSR
    magma_int_t        csr5_sigma;              // opt: info for CSR5
    magma_int_t        csr5_bit_y_offset;       // opt: info for CSR5
    magma_int_t        csr5_bit_scansum_offset; // opt: info for CSR5
    magma_int_t        csr5_num_packets;        // opt: info for CSR5
    magma_index_t      csr5_p;                  // opt: info for CSR5
    magma_index_t      csr5_num_offsets;        // opt: info for CSR5
    magma_index_t      csr5_tail_tile_start;    // opt: info for CSR5
    magma_order_t      major;                   // opt: row/col major for dense matrices
    magma_int_t        ld;                      // opt: leading dimension for dense
} magma_z_matrix;

typedef struct magma_c_matrix
{
    magma_storage_t    storage_type;            // matrix format - CSR, ELL, SELL-P, CSR5
    magma_location_t   memory_location;         // CPU or DEV
    magma_symmetry_t   sym;                     // opt: indicate symmetry
    magma_diagorder_t  diagorder_type;          // opt: only needed for factorization matrices
    magma_uplo_t   fill_mode;               // fill mode full/lower/upper
    magma_int_t        num_rows;                // number of rows
    magma_int_t        num_cols;                // number of columns
    magma_int_t        nnz;                     // opt: number of nonzeros
    magma_int_t        max_nnz_row;             // opt: max number of nonzeros in one row
    magma_int_t        diameter;                // opt: max distance of entry from main diagonal
    magma_int_t        true_nnz;              // opt: true nnz
    magma_bool_t       ownership;               // does MAGMA own the arrays of this matrix structure
    union {
        magmaFloatComplex       *val;           // array containing values in CPU case
        magmaFloatComplex_ptr   dval;           // array containing values in DEV case
    };
    union {
        magmaFloatComplex       *diag;          // opt: diagonal entries in CPU case
        magmaFloatComplex_ptr   ddiag;          // opt: diagonal entries in DEV case
    };
    union {
        magma_index_t           *row;           // row pointer CPU case
        magmaIndex_ptr          drow;           // row pointer DEV case
    };
    union {
        magma_index_t           *rowidx;        // opt: array containing row indices CPU case
        magmaIndex_ptr          drowidx;        // opt: array containing row indices DEV case
    };
    union {
        magma_index_t           *col;           // array containing col indices CPU case
        magmaIndex_ptr          dcol;           // array containing col indices DEV case
    };
    union {
        magma_index_t           *list;          // opt: linked list pointing to next element
        magmaIndex_ptr          dlist;          // opt: linked list pointing to next element
    };
    union {
        magma_uindex_t           *tile_ptr;              // opt: CSR5 tile pointer CPU case
        magmaUIndex_ptr          dtile_ptr;              // opt: CSR5 tile pointer DEV case
    };
    union {
        magma_uindex_t           *tile_desc;             // opt: CSR5 tile descriptor CPU case
        magmaUIndex_ptr          dtile_desc;             // opt: CSR5 tile descriptor DEV case
    };
    union {
        magma_index_t            *tile_desc_offset_ptr;  // opt: CSR5 tile descriptor offset pointer CPU case
        magmaIndex_ptr           dtile_desc_offset_ptr;  // opt: CSR5 tile descriptor offset pointer DEV case
    };
    union {
        magma_index_t            *tile_desc_offset;      // opt: CSR5 tile descriptor offset CPU case
        magmaIndex_ptr           dtile_desc_offset;      // opt: CSR5 tile descriptor offset DEV case
    };
    union {
        magmaFloatComplex        *calibrator;            // opt: CSR5 calibrator CPU case
        magmaFloatComplex_ptr    dcalibrator;            // opt: CSR5 calibrator DEV case
    };
    magma_index_t      *blockinfo;              // opt: for BCSR format CPU case
    magma_int_t        blocksize;               // opt: info for SELL-P/BCSR
    magma_int_t        numblocks;               // opt: info for SELL-P/BCSR
    magma_int_t        alignment;               // opt: info for SELL-P/BCSR
    magma_int_t        csr5_sigma;              // opt: info for CSR5
    magma_int_t        csr5_bit_y_offset;       // opt: info for CSR5
    magma_int_t        csr5_bit_scansum_offset; // opt: info for CSR5
    magma_int_t        csr5_num_packets;        // opt: info for CSR5
    magma_index_t      csr5_p;                  // opt: info for CSR5
    magma_index_t      csr5_num_offsets;        // opt: info for CSR5
    magma_index_t      csr5_tail_tile_start;    // opt: info for CSR5
    magma_order_t      major;                   // opt: row/col major for dense matrices
    magma_int_t        ld;                      // opt: leading dimension for dense
} magma_c_matrix;


typedef struct magma_d_matrix
{
    magma_storage_t    storage_type;            // matrix format - CSR, ELL, SELL-P, CSR5
    magma_location_t   memory_location;         // CPU or DEV
    magma_symmetry_t   sym;                     // opt: indicate symmetry
    magma_diagorder_t  diagorder_type;          // opt: only needed for factorization matrices
    magma_uplo_t   fill_mode;               // fill mode full/lower/upper
    magma_int_t        num_rows;                // number of rows
    magma_int_t        num_cols;                // number of columns
    magma_int_t        nnz;                     // opt: number of nonzeros
    magma_int_t        max_nnz_row;             // opt: max number of nonzeros in one row
    magma_int_t        diameter;                // opt: max distance of entry from main diagonal
    magma_int_t        true_nnz;              // opt: true nnz
    magma_bool_t       ownership;               // does MAGMA own the arrays of this matrix structure
    union {
        double                  *val;           // array containing values in CPU case
        magmaDouble_ptr         dval;           // array containing values in DEV case
    };
    union {
        double                  *diag;          // opt: diagonal entries in CPU case
        magmaDouble_ptr         ddiag;          // opt: diagonal entries in DEV case
    };
    union {
        magma_index_t           *row;           // row pointer CPU case
        magmaIndex_ptr          drow;           // row pointer DEV case
    };
    union {
        magma_index_t           *rowidx;        // opt: array containing row indices CPU case
        magmaIndex_ptr          drowidx;        // opt: array containing row indices DEV case
    };
    union {
        magma_index_t           *col;           // array containing col indices CPU case
        magmaIndex_ptr          dcol;           // array containing col indices DEV case
    };
    union {
        magma_index_t           *list;          // opt: linked list pointing to next element
        magmaIndex_ptr          dlist;          // opt: linked list pointing to next element
    };
    union {
        magma_uindex_t           *tile_ptr;              // opt: CSR5 tile pointer CPU case
        magmaUIndex_ptr          dtile_ptr;              // opt: CSR5 tile pointer DEV case
    };
    union {
        magma_uindex_t           *tile_desc;             // opt: CSR5 tile descriptor CPU case
        magmaUIndex_ptr          dtile_desc;             // opt: CSR5 tile descriptor DEV case
    };
    union {
        magma_index_t            *tile_desc_offset_ptr;  // opt: CSR5 tile descriptor offset pointer CPU case
        magmaIndex_ptr           dtile_desc_offset_ptr;  // opt: CSR5 tile descriptor offset pointer DEV case
    };
    union {
        magma_index_t            *tile_desc_offset;      // opt: CSR5 tile descriptor offset CPU case
        magmaIndex_ptr           dtile_desc_offset;      // opt: CSR5 tile descriptor offset DEV case
    };
    union {
        double                   *calibrator;            // opt: CSR5 calibrator CPU case
        magmaDouble_ptr          dcalibrator;            // opt: CSR5 calibrator DEV case
    };
    magma_index_t      *blockinfo;              // opt: for BCSR format CPU case
    magma_int_t        blocksize;               // opt: info for SELL-P/BCSR
    magma_int_t        numblocks;               // opt: info for SELL-P/BCSR
    magma_int_t        alignment;               // opt: info for SELL-P/BCSR
    magma_int_t        csr5_sigma;              // opt: info for CSR5
    magma_int_t        csr5_bit_y_offset;       // opt: info for CSR5
    magma_int_t        csr5_bit_scansum_offset; // opt: info for CSR5
    magma_int_t        csr5_num_packets;        // opt: info for CSR5
    magma_index_t      csr5_p;                  // opt: info for CSR5
    magma_index_t      csr5_num_offsets;        // opt: info for CSR5
    magma_index_t      csr5_tail_tile_start;    // opt: info for CSR5
    magma_order_t      major;                   // opt: row/col major for dense matrices
    magma_int_t        ld;                      // opt: leading dimension for dense
} magma_d_matrix;


typedef struct magma_s_matrix
{
    magma_storage_t    storage_type;            // matrix format - CSR, ELL, SELL-P, CSR5
    magma_location_t   memory_location;         // CPU or DEV
    magma_symmetry_t   sym;                     // opt: indicate symmetry
    magma_diagorder_t  diagorder_type;          // opt: only needed for factorization matrices
    magma_uplo_t   fill_mode;               // fill mode full/lower/upper
    magma_int_t        num_rows;                // number of rows
    magma_int_t        num_cols;                // number of columns
    magma_int_t        nnz;                     // opt: number of nonzeros
    magma_int_t        max_nnz_row;             // opt: max number of nonzeros in one row
    magma_int_t        diameter;                // opt: max distance of entry from main diagonal
    magma_int_t        true_nnz;              // opt: true nnz
    magma_bool_t       ownership;               // does MAGMA own the arrays of this matrix structure
    union {
        float                   *val;           // array containing values in CPU case
        magmaFloat_ptr          dval;           // array containing values in DEV case
    };
    union {
        float                   *diag;          // opt: diagonal entries in CPU case
        magmaFloat_ptr          ddiag;          // opt: diagonal entries in DEV case
    };
    union {
        magma_index_t           *row;           // opt: row pointer CPU case
        magmaIndex_ptr          drow;           // opt: row pointer DEV case
    };
    union {
        magma_index_t           *rowidx;        // opt: array containing row indices CPU case
        magmaIndex_ptr          drowidx;        // opt: array containing row indices DEV case
    };
    union {
        magma_index_t           *col;           // opt: array containing col indices CPU case
        magmaIndex_ptr          dcol;           // opt: array containing col indices DEV case
    };
    union {
        magma_index_t           *list;          // opt: linked list pointing to next element
        magmaIndex_ptr          dlist;          // opt: linked list pointing to next element
    };
    union {
        magma_uindex_t           *tile_ptr;              // opt: CSR5 tile pointer CPU case
        magmaUIndex_ptr          dtile_ptr;              // opt: CSR5 tile pointer DEV case
    };
    union {
        magma_uindex_t           *tile_desc;             // opt: CSR5 tile descriptor CPU case
        magmaUIndex_ptr          dtile_desc;             // opt: CSR5 tile descriptor DEV case
    };
    union {
        magma_index_t            *tile_desc_offset_ptr;  // opt: CSR5 tile descriptor offset pointer CPU case
        magmaIndex_ptr           dtile_desc_offset_ptr;  // opt: CSR5 tile descriptor offset pointer DEV case
    };
    union {
        magma_index_t            *tile_desc_offset;      // opt: CSR5 tile descriptor offset CPU case
        magmaIndex_ptr           dtile_desc_offset;      // opt: CSR5 tile descriptor offset DEV case
    };
    union {
        float                    *calibrator;            // opt: CSR5 calibrator CPU case
        magmaFloat_ptr           dcalibrator;            // opt: CSR5 calibrator DEV case
    };
    magma_index_t      *blockinfo;              // opt: for BCSR format CPU case
    magma_int_t        blocksize;               // opt: info for SELL-P/BCSR
    magma_int_t        numblocks;               // opt: info for SELL-P/BCSR
    magma_int_t        alignment;               // opt: info for SELL-P/BCSR
    magma_int_t        csr5_sigma;              // opt: info for CSR5
    magma_int_t        csr5_bit_y_offset;       // opt: info for CSR5
    magma_int_t        csr5_bit_scansum_offset; // opt: info for CSR5
    magma_int_t        csr5_num_packets;        // opt: info for CSR5
    magma_index_t      csr5_p;                  // opt: info for CSR5
    magma_index_t      csr5_num_offsets;        // opt: info for CSR5
    magma_index_t      csr5_tail_tile_start;    // opt: info for CSR5
    magma_order_t      major;                   // opt: row/col major for dense matrices
    magma_int_t        ld;                      // opt: leading dimension for dense
} magma_s_matrix;


// for backwards compatability, make these aliases.
typedef magma_s_matrix magma_s_sparse_matrix;
typedef magma_d_matrix magma_d_sparse_matrix;
typedef magma_c_matrix magma_c_sparse_matrix;
typedef magma_z_matrix magma_z_sparse_matrix;

typedef magma_s_matrix magma_s_vector;
typedef magma_d_matrix magma_d_vector;
typedef magma_c_matrix magma_c_vector;
typedef magma_z_matrix magma_z_vector;

/*
typedef struct magma_z_vector
{
    magma_location_t   memory_location;         // CPU or DEV
    magma_int_t        num_rows;                // number of rows
    magma_int_t        num_cols;                // number of columns (in case of a block of vectors)
    magma_int_t        nnz;                     // opt: number of nonzeros
    union {
        magmaDoubleComplex      *val;           // array containing values in CPU case
        magmaDoubleComplex_ptr  dval;           // array containing values in DEV case
    };
    magma_order_t      major;                   // storage type:Row/Column-Major
} magma_z_vector;

typedef struct magma_c_vector
{
    magma_location_t   memory_location;         // CPU or DEV
    magma_int_t        num_rows;                // number of rows
    magma_int_t        num_cols;                // number of columns (in case of a block of vectors)
    magma_int_t        nnz;                     // opt: number of nonzeros
    union {
        magmaFloatComplex       *val;           // array containing values in CPU case
        magmaFloatComplex_ptr   dval;           // array containing values in DEV case
    };
    magma_order_t      major;                   // storage type:Row/Column-Major
} magma_c_vector;


typedef struct magma_d_vector
{
    magma_location_t   memory_location;         // CPU or DEV
    magma_int_t        num_rows;                // number of rows
    magma_int_t        num_cols;                // number of columns (in case of a block of vectors)
    magma_int_t        nnz;                     // opt: number of nonzeros
    union {
        double                  *val;           // array containing values in CPU case
        magmaDouble_ptr         dval;           // array containing values in DEV case
    };
    magma_order_t      major;                   // storage type:Row/Column-Major
} magma_d_vector;


typedef struct magma_s_vector
{
    magma_location_t   memory_location;         // CPU or DEV
    magma_int_t        num_rows;                // number of rows
    magma_int_t        num_cols;                // number of columns (in case of a block of vectors)
    magma_int_t        nnz;                     // opt: number of nonzeros
    union {
        float                   *val;           // array containing values in CPU case
        magmaFloat_ptr          dval;           // array containing values in DEV case
    };
    magma_order_t      major;                   // storage type:Row/Column-Major
} magma_s_vector;
*/


//*****************     solver parameters     ********************************//

typedef struct magma_z_solver_par
{
    magma_solver_type  solver;                  // solver type
    magma_int_t        version;                 // sometimes there are different versions
    double             atol;                    // absolute residual stopping criterion
    double             rtol;                    // relative residual stopping criterion
    magma_int_t        maxiter;                 // upper iteration limit
    magma_int_t        restart;                 // for GMRES
    magma_ortho_t      ortho;                   // for GMRES
    magma_int_t        numiter;                 // feedback: number of needed iterations
    magma_int_t        spmv_count;              // feedback: number of needed SpMV - can be different to iteration count
    double             init_res;                // feedback: initial residual
    double             final_res;               // feedback: final residual
    double             iter_res;                // feedback: iteratively computed residual
    real_Double_t      runtime;                 // feedback: runtime needed
    real_Double_t      *res_vec;                // feedback: array containing residuals
    real_Double_t      *timing;                 // feedback: detailed timing
    magma_int_t        verbose;                 // print residual every 'verbose' iterations
    magma_int_t        num_eigenvalues;         // number of EV for eigensolvers
    magma_int_t        ev_length;               // needed for framework
    double             *eigenvalues;            // feedback: array containing eigenvalues
    magmaDoubleComplex_ptr      eigenvectors;   // feedback: array containing eigenvectors on DEV
    magma_int_t        info;                    // feedback: did the solver converge etc.

    //---------------------------------
    // the input for verbose is:
    // 0 = production mode
    // k>0 = convergence and timing is monitored in *res_vec and *timeing every  
    // k-th iteration 
    //
    // the output of info is:
    //  0 = convergence (stopping criterion met)
    // -1 = no convergence
    // -2 = convergence but stopping criterion not met within maxiter
    //--------------------------------
} magma_z_solver_par;



typedef struct magma_c_solver_par
{
    magma_solver_type  solver;                  // solver type
    magma_int_t        version;                 // sometimes there are different versions
    float              atol;                     // absolute residual stopping criterion
    float              rtol;                    // relative residual stopping criterion
    magma_int_t        maxiter;                 // upper iteration limit
    magma_int_t        restart;                 // for GMRES
    magma_ortho_t      ortho;                   // for GMRES
    magma_int_t        numiter;                 // feedback: number of needed iterations
    magma_int_t        spmv_count;              // feedback: number of needed SpMV - can be different to iteration count
    float              init_res;                // feedback: initial residual
    float              final_res;               // feedback: final residual
    float              iter_res;                // feedback: iteratively computed residual
    real_Double_t      runtime;                 // feedback: runtime needed
    real_Double_t      *res_vec;                // feedback: array containing residuals
    real_Double_t      *timing;                 // feedback: detailed timing
    magma_int_t        verbose;                 // print residual ever 'verbose' iterations
    magma_int_t        num_eigenvalues;         // number of EV for eigensolvers
    magma_int_t        ev_length;               // needed for framework
    float              *eigenvalues;            // feedback: array containing eigenvalues
    magmaFloatComplex_ptr       eigenvectors;   // feedback: array containing eigenvectors on DEV
    magma_int_t        info;                    // feedback: did the solver converge etc.

    //---------------------------------
    // the input for verbose is:
    // 0 = production mode
    // k>0 = convergence and timing is monitored in *res_vec and *timeing every  
    // k-th iteration 
    //
    // the output of info is:
    //  0 = convergence (stopping criterion met)
    // -1 = no convergence
    // -2 = convergence but stopping criterion not met within maxiter
    //--------------------------------
} magma_c_solver_par;



typedef struct magma_d_solver_par
{
    magma_solver_type  solver;                  // solver type
    magma_int_t        version;                 // sometimes there are different versions
    double             atol;                     // absolute residual stopping criterion
    double             rtol;                    // relative residual stopping criterion
    magma_int_t        maxiter;                 // upper iteration limit
    magma_int_t        restart;                 // for GMRES
    magma_ortho_t      ortho;                   // for GMRES
    magma_int_t        numiter;                 // feedback: number of needed iterations
    magma_int_t        spmv_count;              // feedback: number of needed SpMV - can be different to iteration count
    double             init_res;                // feedback: initial residual
    double             final_res;               // feedback: final residual
    double             iter_res;                // feedback: iteratively computed residual
    real_Double_t      runtime;                 // feedback: runtime needed
    real_Double_t      *res_vec;                // feedback: array containing residuals
    real_Double_t      *timing;                 // feedback: detailed timing
    magma_int_t        verbose;                 // print residual ever 'verbose' iterations
    magma_int_t        num_eigenvalues;         // number of EV for eigensolvers
    magma_int_t        ev_length;               // needed for framework
    double             *eigenvalues;            // feedback: array containing eigenvalues
    magmaDouble_ptr             eigenvectors;   // feedback: array containing eigenvectors on DEV
    magma_int_t        info;                    // feedback: did the solver converge etc.

    //---------------------------------
    // the input for verbose is:
    // 0 = production mode
    // k>0 = convergence and timing is monitored in *res_vec and *timeing every  
    // k-th iteration 
    //
    // the output of info is:
    //  0 = convergence (stopping criterion met)
    // -1 = no convergence
    // -2 = convergence but stopping criterion not met within maxiter
    //--------------------------------
} magma_d_solver_par;



typedef struct magma_s_solver_par
{
    magma_solver_type  solver;                  // solver type
    magma_int_t        version;                 // sometimes there are different versions
    float              atol;                     // absolute residual stopping criterion
    float              rtol;                    // relative residual stopping criterion
    magma_int_t        maxiter;                 // upper iteration limit
    magma_int_t        restart;                 // for GMRES
    magma_ortho_t      ortho;                   // for GMRES
    magma_int_t        numiter;                 // feedback: number of needed iterations
    magma_int_t        spmv_count;              // feedback: number of needed SpMV - can be different to iteration count
    float              init_res;                // feedback: initial residual
    float              final_res;               // feedback: final residual
    float              iter_res;                // feedback: iteratively computed residual
    real_Double_t      runtime;                 // feedback: runtime needed
    real_Double_t      *res_vec;                // feedback: array containing residuals
    real_Double_t      *timing;                 // feedback: detailed timing
    magma_int_t        verbose;                 // print residual ever 'verbose' iterations
    magma_int_t        num_eigenvalues;         // number of EV for eigensolvers
    magma_int_t        ev_length;               // needed for framework
    float              *eigenvalues;            // feedback: array containing eigenvalues
    magmaFloat_ptr              eigenvectors;   // feedback: array containing eigenvectors on DEV
    magma_int_t        info;                    // feedback: did the solver converge etc.

    //---------------------------------
    // the input for verbose is:
    // 0 = production mode
    // k>0 = convergence and timing is monitored in *res_vec and *timeing every  
    // k-th iteration 
    //
    // the output of info is:
    //       0          Success.
    //      -117        Not supported.
    //      -201        No convergence within iteration limit. 
    //      -202        No convergence.
    //      -203        Operator A is not positive definite.
    //--------------------------------
} magma_s_solver_par;



//************            preconditioner parameters       ********************//

#if CUDA_VERSION < 11000
    #define magma_solve_info_t cusparseSolveAnalysisInfo_t
#else
    #define magma_solve_info_t csrsm2Info_t
#endif

typedef struct magma_z_preconditioner
{
    magma_solver_type       solver;
    magma_solver_type       trisolver;
    magma_int_t             levels;
    magma_int_t             sweeps;
    magma_int_t             pattern;
    magma_int_t             bsize;
    magma_int_t             offset;
    magma_precision         format;
    double                  atol;                
    double                  rtol;    
    magma_int_t             maxiter;
    magma_int_t             restart; 
    magma_int_t             numiter;
    magma_int_t             spmv_count;  
    double                  init_res;
    double                  final_res;
    real_Double_t      runtime;                 // feedback: preconditioner runtime needed
    real_Double_t      setuptime;               // feedback: preconditioner setup time needed
    magma_z_matrix   M;
    magma_z_matrix   L;
    magma_z_matrix   LT;
    magma_z_matrix   U;
    magma_z_matrix   UT;
    magma_z_matrix   LD;
    magma_z_matrix   UD;
    magma_z_matrix   LDT;
    magma_z_matrix   UDT;
    magma_index_t *Lnz;
    magma_index_t *Unz;
    magma_index_t **Lja;
    magma_index_t **Uja;
    magmaDoubleComplex **Lma;
    magmaDoubleComplex **Uma;
    magma_z_matrix          d;
    magma_z_matrix          d2;
    magma_z_matrix          work1;
    magma_z_matrix          work2;
    magma_int_t*            int_array_1;
    magma_int_t*            int_array_2;
    magma_index_t*            L_dgraphindegree;     // for sync-free trisolve
    magma_index_t*            L_dgraphindegree_bak; // for sync-free trisolve
    magma_index_t*            U_dgraphindegree;     // for sync-free trisolve
    magma_index_t*            U_dgraphindegree_bak; // for sync-free trisolve
    magma_solve_info_t cuinfo;
    magma_solve_info_t cuinfoL;
    magma_solve_info_t cuinfoLT;
    magma_solve_info_t cuinfoU;
    magma_solve_info_t cuinfoUT;
    magma_bool_t            transpose;                 // need the transpose for the solver?
#if defined(HAVE_PASTIX)
    pastix_data_t*          pastix_data;
    magma_int_t*            iparm;
    double*                 dparm;
#endif
} magma_z_preconditioner;

typedef struct magma_c_preconditioner
{
    magma_solver_type       solver;
    magma_solver_type       trisolver;
    magma_int_t             levels;
    magma_int_t             sweeps;
    magma_int_t             pattern;
    magma_int_t             bsize;
    magma_int_t             offset;
    magma_precision         format;
    float                   atol;                
    float                   rtol;               
    magma_int_t             maxiter;
    magma_int_t             restart; 
    magma_int_t             numiter;
    magma_int_t             spmv_count;
    float                   init_res;
    float                   final_res;
    real_Double_t      runtime;                // feedback: preconditioner runtime needed
    real_Double_t      setuptime;           // feedback: preconditioner setup time needed
    magma_c_matrix   M;
    magma_c_matrix   L;
    magma_c_matrix   LT;
    magma_c_matrix   U;
    magma_c_matrix   UT;
    magma_c_matrix   LD;
    magma_c_matrix   UD;
    magma_c_matrix   LDT;
    magma_c_matrix   UDT;
    magma_index_t *Lnz;
    magma_index_t *Unz;
    magma_index_t **Lja;
    magma_index_t **Uja;
    magmaFloatComplex **Lma;
    magmaFloatComplex **Uma;
    magma_c_matrix          d;
    magma_c_matrix          d2;
    magma_c_matrix          work1;
    magma_c_matrix          work2;
    magma_int_t*            int_array_1;
    magma_int_t*            int_array_2;
    magma_index_t*            L_dgraphindegree;     // for sync-free trisolve
    magma_index_t*            L_dgraphindegree_bak; // for sync-free trisolve
    magma_index_t*            U_dgraphindegree;     // for sync-free trisolve
    magma_index_t*            U_dgraphindegree_bak; // for sync-free trisolve
    magma_solve_info_t cuinfo;
    magma_solve_info_t cuinfoL;
    magma_solve_info_t cuinfoLT;
    magma_solve_info_t cuinfoU;
    magma_solve_info_t cuinfoUT;
    magma_bool_t            transpose;                 // need the transpose for the solver?
#if defined(HAVE_PASTIX)
    pastix_data_t*          pastix_data;
    magma_int_t*            iparm;
    float*                  dparm;
#endif
} magma_c_preconditioner;


typedef struct magma_d_preconditioner
{
    magma_solver_type       solver;
    magma_solver_type       trisolver;
    magma_int_t             levels;
    magma_int_t             sweeps;
    magma_int_t             pattern;
    magma_int_t             bsize;
    magma_int_t             offset;
    magma_precision         format;
    double                  atol;                
    double                  rtol; 
    magma_int_t             maxiter;
    magma_int_t             restart; 
    magma_int_t             numiter;
    magma_int_t             spmv_count;
    double                  init_res;
    double                  final_res;
    real_Double_t      runtime;                // feedback: preconditioner runtime needed
    real_Double_t      setuptime;           // feedback: preconditioner setup time needed
    magma_d_matrix   M;
    magma_d_matrix   L;
    magma_d_matrix   LT;
    magma_d_matrix   U;
    magma_d_matrix   UT;
    magma_d_matrix   LD;
    magma_d_matrix   UD;
    magma_d_matrix   LDT;
    magma_d_matrix   UDT;
    magma_index_t *Lnz;
    magma_index_t *Unz;
    magma_index_t **Lja;
    magma_index_t **Uja;
    double **Lma;
    double **Uma;
    magma_d_matrix          d;
    magma_d_matrix          d2;
    magma_d_matrix          work1;
    magma_d_matrix          work2;
    magma_int_t*            int_array_1;
    magma_int_t*            int_array_2;
    magma_index_t*            L_dgraphindegree;     // for sync-free trisolve
    magma_index_t*            L_dgraphindegree_bak; // for sync-free trisolve
    magma_index_t*            U_dgraphindegree;     // for sync-free trisolve
    magma_index_t*            U_dgraphindegree_bak; // for sync-free trisolve
    magma_solve_info_t cuinfo;
    magma_solve_info_t cuinfoL;
    magma_solve_info_t cuinfoLT;
    magma_solve_info_t cuinfoU;
    magma_solve_info_t cuinfoUT;
    magma_bool_t            transpose;                 // need the transpose for the solver?
#if defined(HAVE_PASTIX)
    pastix_data_t*          pastix_data;
    magma_int_t*            iparm;
    double*                 dparm;
#endif
} magma_d_preconditioner;


typedef struct magma_s_preconditioner
{
    magma_solver_type       solver;
    magma_solver_type       trisolver;
    magma_int_t             levels;
    magma_int_t             sweeps;
    magma_int_t             pattern;
    magma_int_t             bsize;
    magma_int_t             offset;
    magma_precision         format;
    float                   atol;                
    float                   rtol;    
    magma_int_t             maxiter;
    magma_int_t             restart; 
    magma_int_t             numiter;
    magma_int_t             spmv_count;
    float                   init_res;
    float                   final_res;
    real_Double_t      runtime;                // feedback: preconditioner runtime needed
    real_Double_t      setuptime;           // feedback: preconditioner setup time needed
    magma_s_matrix   M;
    magma_s_matrix   L;
    magma_s_matrix   LT;
    magma_s_matrix   U;
    magma_s_matrix   UT;
    magma_s_matrix   LD;
    magma_s_matrix   UD;
    magma_s_matrix   LDT;
    magma_s_matrix   UDT;
    magma_index_t *Lnz;
    magma_index_t *Unz;
    magma_index_t **Lja;
    magma_index_t **Uja;
    float **Lma;
    float **Uma;
    magma_s_matrix          d;
    magma_s_matrix          d2;
    magma_s_matrix          work1;
    magma_s_matrix          work2;
    magma_int_t*            int_array_1;
    magma_int_t*            int_array_2;
    magma_index_t*            L_dgraphindegree;     // for sync-free trisolve
    magma_index_t*            L_dgraphindegree_bak; // for sync-free trisolve
    magma_index_t*            U_dgraphindegree;     // for sync-free trisolve
    magma_index_t*            U_dgraphindegree_bak; // for sync-free trisolve
    magma_solve_info_t cuinfo;
    magma_solve_info_t cuinfoL;
    magma_solve_info_t cuinfoLT;
    magma_solve_info_t cuinfoU;
    magma_solve_info_t cuinfoUT;
    magma_bool_t            transpose;                 // need the transpose for the solver?
#if defined(HAVE_PASTIX)
    pastix_data_t*          pastix_data;
    magma_int_t*            iparm;
    float*                  dparm;
#endif
} magma_s_preconditioner;


//##############################################################################
//
//              opts for the testers
//
//##############################################################################

typedef struct magma_zopts
{
    magma_operation_t       operation;
    magma_location_t        compute_location;
    magma_z_solver_par      solver_par;
    magma_z_preconditioner  precond_par;
    magma_storage_t         input_format;
    magma_trans_t           trans;
    magma_int_t             blocksize;
    magma_int_t             alignment;
    magma_storage_t         output_format;
    magma_location_t        input_location;
    magma_location_t        output_location;
    magma_scale_t           scaling;
} magma_zopts;

typedef struct magma_copts
{
    magma_operation_t       operation;
    magma_location_t        compute_location;
    magma_c_solver_par      solver_par;
    magma_c_preconditioner  precond_par;
    magma_storage_t         input_format;
    magma_trans_t           trans;
    magma_int_t             blocksize;
    magma_int_t             alignment;
    magma_storage_t         output_format;
    magma_location_t        input_location;
    magma_location_t        output_location;
    magma_scale_t           scaling;
} magma_copts;

typedef struct magma_dopts
{
    magma_operation_t       operation;
    magma_location_t        compute_location;
    magma_d_solver_par      solver_par;
    magma_d_preconditioner  precond_par;
    magma_storage_t         input_format;
    magma_trans_t           trans;
    magma_int_t             blocksize;
    magma_int_t             alignment;
    magma_storage_t         output_format;
    magma_location_t        input_location;
    magma_location_t        output_location;
    magma_scale_t           scaling;
} magma_dopts;

typedef struct magma_sopts
{
    magma_operation_t       operation;
    magma_location_t        compute_location;
    magma_s_solver_par      solver_par;
    magma_s_preconditioner  precond_par;
    magma_storage_t         input_format;
    magma_trans_t           trans;
    magma_int_t             blocksize;
    magma_int_t             alignment;
    magma_storage_t         output_format;
    magma_location_t        input_location;
    magma_location_t        output_location;
    magma_scale_t           scaling;
} magma_sopts;

#ifdef __cplusplus
}
#endif

#endif        //  #ifndef MAGMASPARSE_TYPES_H