GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sparsemat.h
Go to the documentation of this file.
1 
6 #ifndef GHOST_SPARSEMAT_H
7 #define GHOST_SPARSEMAT_H
8 
9 #include "config.h"
10 #include "types.h"
11 #include "spmv.h"
12 #include "context.h"
13 #include "densemat.h"
14 #include "sparsemat_src.h"
15 
16 #include <stdarg.h>
17 
18 #define GHOST_SPARSEMAT_SORT_GLOBAL -1
19 #define GHOST_SPARSEMAT_SORT_LOCAL -2
20 
24 typedef struct {
34 
35 
39 typedef enum {
57 
58 typedef struct
59 {
61  void *val;
63  size_t dtsize;
65 }
67 
70 
71 typedef struct{
73  void *alpha;
74  void *beta;
75  void *gamma;
76  void *delta;
77  void *eta;
78  void *dot;
81 }
83 
84 typedef enum {
88 }
90 
91 typedef enum{
95 }
97 
98 #ifdef __cplusplus
99 static inline ghost_kacz_normalize operator|(const ghost_kacz_normalize &a, const ghost_kacz_normalize &b) {
100 return static_cast<ghost_kacz_normalize>(static_cast<int>(a) | static_cast<int>(b));
101 }
102 static inline ghost_kacz_normalize operator&(const ghost_kacz_normalize &a, const ghost_kacz_normalize &b) {
103 return static_cast<ghost_kacz_normalize>(static_cast<int>(a) & static_cast<int>(b));
104 }
105 static inline ghost_kacz_normalize operator|=(ghost_kacz_normalize &a, const ghost_kacz_normalize &b) {
106  a = static_cast<ghost_kacz_normalize>(static_cast<int>(a) | static_cast<int>(b));
107  return a;
108 }
109 static inline ghost_kacz_normalize operator&=(ghost_kacz_normalize &a, const ghost_kacz_normalize &b) {
110  a = static_cast<ghost_kacz_normalize>(static_cast<int>(a) & static_cast<int>(b));
111  return a;
112 }
113 #endif
114 
115 
116 typedef enum{
120 }
122 
123 
124 typedef struct {
125  void *omega;
126  void *shift;// shift can be complex
127  int num_shifts; //number of shifts provided
130  int best_block_size; //it provides the best block size if performance mode is set
132  void *scale; //scaled values if normalize is on
133  bool initialized; //internal flag
134 }
136 
137 typedef struct {
138  void *omega;
139  void *shift;// shift can be complex
140  int num_shifts; //number of shifts provided
142  int best_block_size; //it provides the best block size if performance mode is set
144  void *scale; //scaled values if normalize is on
145  bool initialized; //internal flag
146 }
147 ghost_carp_opts; //no direction since forward followed by backward done
148 
149 
153 #define GHOST_SELL_CHUNKHEIGHT_ELLPACK 0
154 
157 #define GHOST_SELL_CHUNKHEIGHT_AUTO -1
158 
165 typedef struct
166 {
186  int blocksz;
195 
196 }
198 
205 typedef struct
206 {
226  int blocksz;
235 
236  bool do_axpby;
237  bool do_scale;
238  bool do_vshift;
239  bool do_dot_yy;
240  bool do_dot_xy;
241  bool do_dot_xx;
243 
244 }
246 
247 
254 typedef struct
255 {
275  int blocksz;
284 
286 
290  int nshifts;
291 
292 }
294 
298 
299 
301 typedef ghost_error (*ghost_kacz_kernel)(ghost_densemat*, ghost_sparsemat *, ghost_densemat*, ghost_kacz_opts);
302 typedef ghost_error (*ghost_kacz_shift_kernel)(ghost_densemat*, ghost_densemat*, ghost_sparsemat *, ghost_densemat*, double, double, ghost_kacz_opts);
303 
304 
308 typedef enum {
389 
391 
395 #define GHOST_SPARSEMAT_PERM_ANY (GHOST_SPARSEMAT_PERM_ANY_LOCAL|GHOST_SPARSEMAT_PERM_ANY_GLOBAL)
396 #define GHOST_SPARSEMAT_PERM_ANY_LOCAL (GHOST_SPARSEMAT_COLOR|GHOST_SPARSEMAT_RCM|GHOST_SPARSEMAT_BLOCKCOLOR|GHOST_SPARSEMAT_SORT_ROWS)
397 #define GHOST_SPARSEMAT_PERM_ANY_GLOBAL (GHOST_SPARSEMAT_SCOTCHIFY|GHOST_SPARSEMAT_ZOLTAN)
398 
399 #ifdef __cplusplus
400 inline ghost_sparsemat_flags operator|(const ghost_sparsemat_flags &a,
401  const ghost_sparsemat_flags &b)
402 {
403  return static_cast<ghost_sparsemat_flags>(
404  static_cast<int>(a) | static_cast<int>(b));
405 }
406 
407 inline ghost_sparsemat_flags operator&(const ghost_sparsemat_flags &a,
408  const ghost_sparsemat_flags &b)
409 {
410  return static_cast<ghost_sparsemat_flags>(
411  static_cast<int>(a) & static_cast<int>(b));
412 }
413 #endif
414 
415 
431  int C;
435  int T;
439  const char * scotchStrat;
454 };
455 
456 #ifdef GHOST_HAVE_MPI
457 #define GHOST_SCOTCH_STRAT_DEFAULT "n{ole=q{strat=g},ose=q{strat=g},osq=g,sep=m}"
458 #else
459 #define GHOST_SCOTCH_STRAT_DEFAULT "g"
460 #endif
461 
466 
476 struct ghost_sparsemat
477 {
489  ghost_sparsemat *localPart;
494  ghost_sparsemat *remotePart;
502  char *name;
506  char *val;
548  //ghost_cu_sell *cumat;
552  char * cu_val;
576  size_t elSize;
593  //ghost_lidx nrows;
599  //ghost_lidx nrowsPadded;
603  //ghost_gidx ncols;
607  //ghost_lidx nnz;
617  double avgRowBand;
626  double smartRowBand;
639  double variance;
643  double deviation;
647  double cv;
654 };
655 
656 typedef struct
657 {
658  char *filename;
660  ghost_sparsemat *mat;
661 }
663 
664 #define SPM_NROWS(mat) mat->context->row_map->dim
665 #define SPM_NNZ(mat) mat->context->nnz
666 #define SPM_NCOLS(mat) mat->context->col_map->dim
667 #define SPM_GNCOLS(mat) mat->context->col_map->gdim
668 #define SPM_NROWSPAD(mat) mat->context->row_map->dimpad
669 #define SPM_NCHUNKS(mat) (mat->nchunks)
670 
671 
672 #ifdef __cplusplus
673 extern "C" {
674 #endif
675 
695  ghost_error ghost_sparsemat_create(ghost_sparsemat **mat,
696  ghost_context *ctx, ghost_sparsemat_traits *traits,
697  int nTraits);
708  ghost_error ghost_sparsemat_info_string(char **str, ghost_sparsemat *matrix);
718  ghost_sparsemat *mat);
728  ghost_sparsemat *mat);
755  ghost_error ghost_sparsemat_perm_scotch(ghost_context *ctx, ghost_sparsemat *mat);
766  ghost_error ghost_sparsemat_perm_sort(ghost_context *ctx, ghost_sparsemat *mat, ghost_lidx scope);
767 
768  ghost_error ghost_sparsemat_perm_spmp(ghost_context *ctx, ghost_sparsemat *mat);
769 
778  ghost_error ghost_sparsemat_perm_color(ghost_context *ctx, ghost_sparsemat *mat);
779 
780  ghost_error ghost_sparsemat_blockColor(ghost_context *ctx, ghost_sparsemat *mat);
781 
782  ghost_error ghost_sparsemat_perm_zoltan(ghost_context *ctx, ghost_sparsemat *mat);
799  ghost_error ghost_sparsemat_fromfile_common(ghost_sparsemat *mat,
800  char *matrixPath, ghost_lidx **rpt) ;
811  ghost_error ghost_sparsematofile_header(ghost_sparsemat *mat,
812  char *path);
827  ghost_error ghost_sparsemat_registerrow(ghost_sparsemat *mat,
828  ghost_gidx row, ghost_gidx *col, ghost_lidx rowlen,
829  ghost_lidx stride);
843 
849  void ghost_sparsemat_destroy(ghost_sparsemat *mat);
860  ghost_error ghost_sell_spmv_selector(ghost_densemat *lhs,
861  ghost_sparsemat *mat,
862  ghost_densemat *rhs,
863  ghost_spmv_opts traits);
874  ghost_error ghost_cu_sell_spmv_selector(ghost_densemat *lhs,
875  ghost_sparsemat *mat,
876  ghost_densemat *rhs,
877  ghost_spmv_opts traits);
878 
888  ghost_error ghost_sell_stringify_selector(ghost_sparsemat *mat,
889  char **str, int dense);
901  ghost_error ghost_sparsemat_string(char **str, ghost_sparsemat *mat, int dense);
913  ghost_error ghost_sparsemat_init_rowfunc(ghost_sparsemat *mat, ghost_sparsemat_src_rowfunc *src, ghost_mpi_comm mpicomm, double weight);
914 
928  ghost_error ghost_sparsemat_init_bin(ghost_sparsemat *mat, char *path, ghost_mpi_comm mpicomm, double weight);
929 
949  ghost_error ghost_sparsemat_init_mm(ghost_sparsemat *mat, char *path, ghost_mpi_comm mpicomm, double weight);
950 
966  ghost_error ghost_sparsemat_init_crs(ghost_sparsemat *mat, ghost_gidx offs, ghost_lidx n, ghost_gidx *col, void *val, ghost_lidx *rpt, ghost_mpi_comm mpicomm, double weight);
967 
974  ghost_error ghost_sparsemat_to_bin(ghost_sparsemat *mat, char *path);
975 
984  size_t ghost_sparsemat_bytesize(ghost_sparsemat *mat);
985 
996  ghost_error ghost_cu_sell_spmv_selector(ghost_densemat *lhs,
997  ghost_sparsemat *mat,
998  ghost_densemat *rhs,
999  ghost_spmv_opts traits);
1000 
1001  ghost_error ghost_cu_sell1_spmv_selector(ghost_densemat * lhs_in,
1002  ghost_sparsemat *mat, ghost_densemat * rhs_in, ghost_spmv_opts traits);
1003 
1014  ghost_error ghost_sell_kacz_selector(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts);
1015 
1029  ghost_error ghost_sell_kacz_shift_selector(ghost_densemat *x_real, ghost_densemat *x_imag, ghost_sparsemat *mat, ghost_densemat *b, double sigma_r, double sigma_i, ghost_kacz_opts opts);
1030 
1041  ghost_error ghost_kacz(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts);
1042  ghost_error ghost_kacz_mc(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts);
1043  ghost_error ghost_kacz_rb(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts);
1044  ghost_error ghost_kacz_bmc(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts);
1045  ghost_error ghost_kacz_rb_with_shift(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, double *shift_r, ghost_kacz_opts opts);
1046  ghost_error ghost_carp(ghost_sparsemat *mat, ghost_densemat *x, ghost_densemat *b, ghost_carp_opts opts);
1047  ghost_error checker(ghost_sparsemat *mat);
1048  ghost_error split_transition(ghost_sparsemat *mat);
1049 
1057  ghost_error ghost_carp_init(ghost_sparsemat *mat, ghost_densemat *b, ghost_carp_opts *opts);
1064  ghost_error ghost_carp_perf_init(ghost_sparsemat *mat, ghost_carp_opts *opts);
1070  void ghost_carp_destroy(ghost_carp_opts *opts);
1076  ghost_error kacz_analyze_print(ghost_sparsemat *mat);
1077 
1078  ghost_error ghost_sparsemat_to_mm(char *path, ghost_sparsemat *mat);
1079 
1093  ghost_error ghost_context_comm_init(ghost_context *ctx, ghost_gidx *col_orig, ghost_sparsemat *mat, ghost_lidx *col, ghost_lidx *nhalo);
1094 
1096 
1097  static inline int ghost_sparsemat_rowfunc_crs(ghost_gidx row, ghost_lidx *rowlen, ghost_gidx *col, void *val, void *crsdata)
1098 {
1099  ghost_gidx *crscol = ((ghost_sparsemat_rowfunc_crs_arg *)crsdata)->col;
1100  ghost_lidx *crsrpt = ((ghost_sparsemat_rowfunc_crs_arg *)crsdata)->rpt;
1101  char *crsval = (char *)((ghost_sparsemat_rowfunc_crs_arg *)crsdata)->val;
1102  size_t dtsize = ((ghost_sparsemat_rowfunc_crs_arg *)crsdata)->dtsize;
1103  ghost_gidx offs = ((ghost_sparsemat_rowfunc_crs_arg *)crsdata)->offs;
1104 
1105  *rowlen = crsrpt[row-offs+1]-crsrpt[row-offs];
1106  memcpy(col,&crscol[crsrpt[row-offs]],*rowlen * sizeof(ghost_gidx));
1107  memcpy(val,&crsval[dtsize*crsrpt[row-offs]],*rowlen * dtsize);
1108 
1109  return 0;
1110 }
1111 
1112 //To calculate Bandwidth
1113 ghost_error calculate_bw(ghost_sparsemat *mat, void *matrixSource, ghost_sparsemat_src srcType);
1114 ghost_error set_kacz_ratio(ghost_sparsemat *mat, void *matrixSource, ghost_sparsemat_src srcType);
1115 
1116 #ifdef __cplusplus
1117 }
1118 #endif
1119 
1120 
1121 #endif
ghost_sparsemat_traits splittraits[2]
The local and remote part's traits.
Definition: sparsemat.h:485
ghost_spmv_flags flags
Definition: sparsemat.h:72
Definition: sparsemat.h:124
ghost_gidx nMaxRows
The number of rows with length maxRowLen.
Definition: sparsemat.h:635
void * gamma
Definition: sparsemat.h:75
bool do_dot_xy
Definition: sparsemat.h:240
ghost_implementation
Possible implementations of a CPU function.
Definition: types.h:323
ghost_error ghost_sparsemat_registerrow_finalize(ghost_sparsemat *mat)
Finalize the storing of matrix information like bandwidth and nonzero distribution.
Definition: sparsemat.cpp:96
Symmetric matrix.
Definition: sparsemat.h:47
ghost_error ghost_sparsematofile_header(ghost_sparsemat *mat, char *path)
Write the sparse matrix header to a binary CRS file.
Definition: sparsemat.c:497
Definition: sparsemat.h:117
ghost_error split_transition(ghost_sparsemat *mat)
Definition: kacz_hybrid_split.c:223
ghost_lidx * col
The column indices.
Definition: sparsemat.h:510
ghost_gidx maxRowLen
The maximum row length. TODO: This sould be a ghost_lidx, right?
Definition: sparsemat.h:631
void ghost_carp_destroy(ghost_carp_opts *opts)
Destroy(Finalize) CARP.
Definition: sell_kacz.cpp:113
ghost_lidx * rowLen4
Longest length of each quadruple of rows.
Definition: sparsemat.h:536
void * omega
Definition: sparsemat.h:125
ghost_datatype mdt
The matrix data type.
Definition: sparsemat.h:178
Header file for type definitions.
bool initialized
Definition: sparsemat.h:145
ghost_lidx * rowLenPadded
Needed if T>1.
Definition: sparsemat.h:544
ghost_error ghost_sparsemat_nrows(ghost_gidx *nrows, ghost_sparsemat *mat)
Obtain the global number of rows of a sparse matrix.
Definition: sparsemat.c:359
ghost_lidx blocksz
Definition: sparsemat.h:80
Types and functions related to GHOST contexts.
Reduce the matrix bandwidth with PT-Scotch.
Definition: sparsemat.h:346
ghost_kacz_normalize normalize
Definition: sparsemat.h:143
void * delta
Definition: sparsemat.h:76
ghost_datatype vdt
The densemat data type.
Definition: sparsemat.h:222
ghost_datatype datatype
The data type.
Definition: sparsemat.h:447
bool do_dot_yy
Definition: sparsemat.h:239
int32_t ghost_gidx
Type for global indices.
Definition: types.h:443
Definition: sparsemat.h:92
ghost_error ghost_context_comm_init(ghost_context *ctx, ghost_gidx *col_orig, ghost_sparsemat *mat, ghost_lidx *col, ghost_lidx *nhalo)
Assemble communication information in the given context.
Definition: context.c:225
ghost_lidx * rowLen
Length of each row.
Definition: sparsemat.h:532
ghost_error ghost_kacz_mc(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts)
Definition: sell_kacz_mc.c:30
ghost_error ghost_sparsemat_init_bin(ghost_sparsemat *mat, char *path, ghost_mpi_comm mpicomm, double weight)
Initializes a sparsemat from a binary CRS file.
Definition: sparsemat.c:657
ghost_error ghost_sparsemat_to_mm(char *path, ghost_sparsemat *mat)
Definition: matrixmarket.c:446
const ghost_kacz_opts GHOST_KACZ_OPTS_INITIALIZER
Definition: sell_kacz.c:9
void * shift
Definition: sparsemat.h:126
ghost_error ghost_sparsemat_create(ghost_sparsemat **mat, ghost_context *ctx, ghost_sparsemat_traits *traits, int nTraits)
Create a sparse matrix.
Definition: sparsemat.c:61
ghost_kacz_normalize
Definition: sparsemat.h:91
int chunkheight
The SELL matrix chunk height.
Definition: sparsemat.h:190
Sort matrix rows according to their length (SELL-C-Sigma sorting)
Definition: sparsemat.h:380
ghost_error ghost_sell_spmv_selector(ghost_densemat *lhs, ghost_sparsemat *mat, ghost_densemat *rhs, ghost_spmv_opts traits)
Select and call the right SELL SpMV kernel.
Definition: sell_spmv.cpp:432
Create a matrix permutation reflecting a distance-2-coloring.
Definition: sparsemat.h:354
ghost_error ghost_sparsemat_to_bin(ghost_sparsemat *mat, char *path)
Write a matrix to a binary CRS file.
Definition: sparsemat.c:1962
ghost_datatype vdt
The densemat data type.
Definition: sparsemat.h:182
ghost_sparsemat * remotePart
The remote part (i.e., the part which has remote column indices) of the matrix (if distributed)...
Definition: sparsemat.h:494
ghost_gidx * nzDist
Array of length (2*nrows-1) with nzDist[i] = number nonzeros with distance i from diagonal...
Definition: sparsemat.h:652
ghost_lidx nchunks
Definition: sparsemat.h:653
ghost_lidx * cu_rowLen
The length of each row.
Definition: sparsemat.h:560
char * name
The matrix' name.
Definition: sparsemat.h:502
If the matrix comes from a matrix market file, transpose it on read-in. If this is implemented for ot...
Definition: sparsemat.h:359
Definition: sparsemat.h:119
ghost_lidx * cu_rowLenPadded
Needed if T>1.
Definition: sparsemat.h:564
double cv
Row length coefficient of variation.
Definition: sparsemat.h:647
ghost_datatype vdt
The densemat data type.
Definition: sparsemat.h:271
ghost_sparsemat_traits traits
The matrix' traits.
Definition: sparsemat.h:481
Definition: sparsemat.h:58
ghost_error set_kacz_ratio(ghost_sparsemat *mat, void *matrixSource, ghost_sparsemat_src srcType)
ghost_lidx row
The row.
Definition: sparsemat.h:28
int32_t ghost_lidx
Definition: types.h:503
ghost_lidx * chunkLenPadded
Needed if T>1.
Definition: sparsemat.h:526
ghost_error ghost_sell_stringify_selector(ghost_sparsemat *mat, char **str, int dense)
Select and call the right SELL stringification function.
Helper for sparse matrix row sorting.
Definition: sparsemat.h:24
bool do_chain_axpby
Definition: sparsemat.h:242
ghost_error ghost_sparsemat_perm_spmp(ghost_context *ctx, ghost_sparsemat *mat)
Definition: sparsemat_perm_spmp.cpp:30
ghost_densemat_storage storage
The densemat storage order.
Definition: sparsemat.h:234
The matrix rows should be re-ordered in a certain way (defined in the traits).
Definition: sparsemat.h:330
ghost_kacz_mode mode
Definition: sparsemat.h:129
ghost_lidx * rpt
Definition: sparsemat.h:62
Hermitian matrix.
Definition: sparsemat.h:55
bool do_scale
Definition: sparsemat.h:237
ghost_error(* ghost_spmv_kernel)(ghost_densemat *, ghost_sparsemat *, ghost_densemat *, ghost_spmv_opts)
Definition: sparsemat.h:300
ghost_lidx nEnts
The number of rows.
Definition: sparsemat.h:613
ghost_error ghost_sparsemat_blockColor(ghost_context *ctx, ghost_sparsemat *mat)
Definition: sparsemat_perm_blockColor.cpp:13
ghost_error(* ghost_kacz_kernel)(ghost_densemat *, ghost_sparsemat *, ghost_densemat *, ghost_kacz_opts)
Definition: sparsemat.h:301
ghost_error(* ghost_kacz_shift_kernel)(ghost_densemat *, ghost_densemat *, ghost_sparsemat *, ghost_densemat *, double, double, ghost_kacz_opts)
Definition: sparsemat.h:302
ghost_error ghost_sell_kacz_selector(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts)
Select and call the right SELL KACZ kernel.
void * dot
Definition: sparsemat.h:78
SETS the sparsematrix permutation as needed by the KACZ solver depending on the bandwidth of the matr...
Definition: sparsemat.h:376
int ghost_mpi_comm
Definition: types.h:19
Matrix is store on device.
Definition: sparsemat.h:320
ghost_lidx * chunkStart
Pointer to start of each chunk.
Definition: sparsemat.h:514
Defines a rowfunc-based sparsemat source.
Definition: sparsemat_src.h:36
Definition: sparsemat.h:85
ghost_error ghost_sparsemat_init_mm(ghost_sparsemat *mat, char *path, ghost_mpi_comm mpicomm, double weight)
Initializes a sparsemat from a Matrix Market file.
Definition: sparsemat.c:704
A default sparse matrix.
Definition: sparsemat.h:312
Definition: sparsemat.h:118
Save the un-compressed original columns of a distributed matrix.
Definition: sparsemat.h:350
ghost_gidx * col
Definition: sparsemat.h:60
bool do_vshift
Definition: sparsemat.h:238
ghost_alignment alignment
The data access alignment.
Definition: sparsemat.h:210
Skew-symmetric matrix.
Definition: sparsemat.h:51
int chunkheight
The SELL matrix chunk height.
Definition: sparsemat.h:279
const ghost_spmv_opts GHOST_SPMV_OPTS_INITIALIZER
Definition: sparsemat.c:49
ghost_error
Error return type.
Definition: error.h:23
ghost_error ghost_kacz_bmc(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts)
Definition: sell_kacz_bmc.c:450
int T
Number of threads per row.
Definition: sparsemat.h:435
ghost_alignment
Possible alignments of data access.
Definition: types.h:315
ghost_gidx offs
Definition: sparsemat.h:64
double deviation
Row length standard deviation.
Definition: sparsemat.h:643
void ghost_sparsemat_destroy(ghost_sparsemat *mat)
Destroy a sparsemat and free all memory.
Definition: sparsemat.c:609
char * filename
Definition: sparsemat.h:658
ghost_lidx * chunkMin
Minimal row length in a chunk.
Definition: sparsemat.h:518
size_t dtsize
Definition: sparsemat.h:63
ghost_error ghost_sparsemat_perm_color(ghost_context *ctx, ghost_sparsemat *mat)
Create a matrix permutation based on 2-way coloring using ColPack.
Definition: sparsemat_perm_colpack.cpp:9
ghost_densemat_storage storage
The densemat storage order.
Definition: sparsemat.h:194
ghost_gidx * col_orig
The original column indices of the matrix.
Definition: sparsemat.h:589
Do not sort the matrix cols wrt. memory location.
Definition: sparsemat.h:334
double variance
Row length variance.
Definition: sparsemat.h:639
ghost_error ghost_sell_kacz_shift_selector(ghost_densemat *x_real, ghost_densemat *x_imag, ghost_sparsemat *mat, ghost_densemat *b, double sigma_r, double sigma_i, ghost_kacz_opts opts)
Select and call the right SELL KACZ kernel with complex shifts.
ghost_sparsemat_flags
Flags to a sparse matrix.
Definition: sparsemat.h:308
ghost_alignment alignment
The data access alignment.
Definition: sparsemat.h:259
const char * ghost_sparsemat_symmetry_string(ghost_sparsemat_symmetry symmetry)
Convert the matrix' symmetry information to a string.
Definition: sparsemat.c:585
ghost_alignment alignment
The data access alignment.
Definition: sparsemat.h:170
ghost_kacz_mode
Definition: sparsemat.h:116
Definition: sparsemat.h:87
ghost_datatype mdt
The matrix data type.
Definition: sparsemat.h:267
void * val
Definition: sparsemat.h:61
Definition: sparsemat.h:86
GHOST sparsemat sources.
ghost_error ghost_carp_perf_init(ghost_sparsemat *mat, ghost_carp_opts *opts)
Finds optimum parameters for CARP.
Definition: sell_kacz.cpp:218
ghost_error ghost_sparsemat_info_string(char **str, ghost_sparsemat *matrix)
Create a string holding information about the sparsemat.
Definition: sparsemat.c:394
ghost_sparsemat_symmetry symmetry
The matrix symmetry.
Definition: sparsemat.h:427
ghost_spmv_flags
Flags to be passed to sparse matrix-vector multiplication.
Definition: spmv.h:15
The parameters to identify a CUDA SELL SpMV kernel.
Definition: sparsemat.h:205
int blocksz
The densemat width.
Definition: sparsemat.h:186
ghost_error ghost_sparsemat_registerrow(ghost_sparsemat *mat, ghost_gidx row, ghost_gidx *col, ghost_lidx rowlen, ghost_lidx stride)
Store matrix information like bandwidth and nonzero distribution for a given matrix row...
Definition: sparsemat.cpp:27
ghost_kacz_mode mode
Definition: sparsemat.h:141
const char * scotchStrat
The re-ordering strategy to be passed to SCOTCH.
Definition: sparsemat.h:439
ghost_implementation impl
The implementation.
Definition: sparsemat.h:263
ghost_error ghost_sparsemat_init_rowfunc(ghost_sparsemat *mat, ghost_sparsemat_src_rowfunc *src, ghost_mpi_comm mpicomm, double weight)
Initializes a sparsemat from a row-based callback function.
Definition: sparsemat.c:948
void * scale
Definition: sparsemat.h:144
ghost_sparsemat_symmetry
Possible sparse matrix symmetries.
Definition: sparsemat.h:39
ghost_error kacz_analyze_print(ghost_sparsemat *mat)
Prints the row distribution details of KACZ.
Definition: kacz_analyze_print.c:4
ghost_densemat_storage storage
The densemat storage order.
Definition: sparsemat.h:283
ghost_datatype
Available primitive data types.
Definition: types.h:248
ghost_kacz_direction
Definition: sparsemat.h:84
bool do_dot_xx
Definition: sparsemat.h:241
int best_block_size
Definition: sparsemat.h:142
ghost_sparsemat_src
Possible sources of a sparse matrix.
Definition: map.h:36
ghost_implementation impl
The implementation.
Definition: sparsemat.h:214
int num_shifts
Definition: sparsemat.h:127
ghost_lidx opt_blockvec_width
Optimal width of block vectors multiplied with this matrix.
Definition: sparsemat.h:453
ghost_context * context
The context of the matrix (if distributed).
Definition: sparsemat.h:498
char * val
The values.
Definition: sparsemat.h:506
ghost_densemat * z
Definition: sparsemat.h:79
Re-order the matrix globally using Zoltan hypergraph partitioning.
Definition: sparsemat.h:363
ghost_error ghost_sparsemat_perm_sort(ghost_context *ctx, ghost_sparsemat *mat, ghost_lidx scope)
Create a matrix permutation based on row length sorting within a given scope.
Definition: sparsemat_perm_sort.c:15
Definition: sparsemat.h:93
Definition: sparsemat.h:656
ghost_densemat_storage
Densemat storage orders.
Definition: densemat.h:94
size_t ghost_sparsemat_bytesize(ghost_sparsemat *mat)
Get the entire memory footprint of the matrix.
Definition: sparsemat.c:797
void * beta
Definition: sparsemat.h:74
void * shift
Definition: sparsemat.h:139
ghost_error ghost_sparsemat_init_crs(ghost_sparsemat *mat, ghost_gidx offs, ghost_lidx n, ghost_gidx *col, void *val, ghost_lidx *rpt, ghost_mpi_comm mpicomm, double weight)
Initializes a sparsemat from local CRS data.
Definition: sparsemat.c:755
double avgAvgRowBand
The average of the average width of the rows wrt. the diagonal.
Definition: sparsemat.h:621
If the matrix rows have been re-ordered, do NOT permute the column indices accordingly.
Definition: sparsemat.h:325
A sparse matrix.
Definition: sparsemat.h:476
ghost_error ghost_sparsemat_nnz(ghost_gidx *nnz, ghost_sparsemat *mat)
Obtain the global number of nonzero elements of a sparse matrix.
Definition: sparsemat.c:373
int best_block_size
Definition: sparsemat.h:130
ghost_error ghost_sparsemat_perm_zoltan(ghost_context *ctx, ghost_sparsemat *mat)
Definition: sparsemat_perm_zoltan.c:95
ghost_error ghost_kacz_rb_with_shift(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, double *shift_r, ghost_kacz_opts opts)
Definition: sell_kacz_rb.c:227
ghost_sparsemat_flags flags
Flags to the matrix.
Definition: sparsemat.h:423
Definition: sparsemat.h:137
ghost_kacz_normalize normalize
Definition: sparsemat.h:131
ghost_error calculate_bw(ghost_sparsemat *mat, void *matrixSource, ghost_sparsemat_src srcType)
The GHOST context.
Definition: context.h:108
Do NOT store the full matrix (local and remote combined).
Definition: sparsemat.h:342
ghost_sparsemat * mat
Definition: sparsemat.h:660
ghost_implementation impl
The implementation.
Definition: sparsemat.h:174
Re-order the local part of the matrix using parallel RCM re-ordering.
Definition: sparsemat.h:367
ghost_error ghost_carp_init(ghost_sparsemat *mat, ghost_densemat *b, ghost_carp_opts *opts)
Initialize CARP.
Definition: sell_kacz.cpp:106
ghost_error ghost_kacz_rb(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts)
Definition: sell_kacz_rb.c:39
int blocksz
The densemat width.
Definition: sparsemat.h:275
ghost_error checker(ghost_sparsemat *mat)
Definition: kacz_hybrid_split.c:62
bool do_axpby
Definition: sparsemat.h:236
ghost_kacz_method
internal to differentiate between different KACZ sweep methods
Definition: context.h:68
int blocksz
The densemat width.
Definition: sparsemat.h:226
ghost_lidx nEntsInRow
Number of entries in the row.
Definition: sparsemat.h:32
ghost_error ghost_sparsemat_fromfile_common(ghost_sparsemat *mat, char *matrixPath, ghost_lidx **rpt)
Common function for matrix creation from a file.
void * omega
Definition: sparsemat.h:138
Definition: sparsemat.h:71
ghost_error ghost_sparsemat_perm_global_cols(ghost_gidx *cols, ghost_lidx ncols, ghost_context *context)
Definition: sparsemat.c:294
int num_shifts
Definition: sparsemat.h:140
ghost_kacz_method method
Definition: sparsemat.h:285
Definition: sparsemat.h:94
ghost_lidx * cu_chunkStart
Pointer to start of each chunk.
Definition: sparsemat.h:568
Matrix is stored on host.
Definition: sparsemat.h:316
static int ghost_sparsemat_rowfunc_crs(ghost_gidx row, ghost_lidx *rowlen, ghost_gidx *col, void *val, void *crsdata)
Definition: sparsemat.h:1097
ghost_lidx sortScope
The sorting scope if sorting should be applied.
Definition: sparsemat.h:443
const ghost_carp_opts GHOST_CARP_OPTS_INITIALIZER
Definition: sell_kacz.c:21
ghost_error ghost_sparsemat_perm_scotch(ghost_context *ctx, ghost_sparsemat *mat)
Create a matrix permutation based on (PT-)SCOTCH.
Definition: sparsemat_perm_scotch.c:40
ghost_kacz_direction direction
Definition: sparsemat.h:128
void * alpha
Definition: sparsemat.h:73
ghost_datatype mdt
The matrix data type.
Definition: sparsemat.h:218
The parameters to identify a SELL Kaczmarz kernel.
Definition: sparsemat.h:254
ghost_error ghost_carp(ghost_sparsemat *mat, ghost_densemat *x, ghost_densemat *b, ghost_carp_opts opts)
Definition: carp.c:5
Store the diagonal entry first in each row. Store an explicit zero if the diagonal is zero...
Definition: sparsemat.h:388
ghost_error ghost_cu_sell1_spmv_selector(ghost_densemat *lhs_in, ghost_sparsemat *mat, ghost_densemat *rhs_in, ghost_spmv_opts traits)
Non-symmetric (general) matrix.
Definition: sparsemat.h:43
double avgRowBand
The average width of the rows wrt. the diagonal.
Definition: sparsemat.h:617
ghost_datatype dt
Definition: sparsemat.h:659
bool ghost_sparsemat_symmetry_valid(ghost_sparsemat_symmetry symmetry)
Check if the symmetry information of a sparse matrix is valid.
Definition: sparsemat.c:569
ghost_sparsemat * localPart
The local part of the matrix (if distributed).
Definition: sparsemat.h:489
ghost_lidx * cu_chunkLen
The length of each chunk.
Definition: sparsemat.h:572
ghost_error ghost_kacz(ghost_densemat *x, ghost_sparsemat *mat, ghost_densemat *b, ghost_kacz_opts opts)
Perform a Kaczmarz sweep with the SELL matrix.
Definition: sell_kacz.cpp:251
Sparse matrix traits.
Definition: sparsemat.h:419
The parameters to identify a SELL SpMV kernel.
Definition: sparsemat.h:165
char * cu_val
The CUDA matrix.
Definition: sparsemat.h:552
bool initialized
Definition: sparsemat.h:133
void * eta
Definition: sparsemat.h:77
const ghost_sparsemat_traits GHOST_SPARSEMAT_TRAITS_INITIALIZER
Initialize sparse matrix traits with default values.
Definition: sparsemat.c:31
double smartRowBand
A smart value quantifying the matrix bandwidth. Currently the 90-percentile of the 90-percentile of a...
Definition: sparsemat.h:626
Do NOT store the local and remote part of the matrix.
Definition: sparsemat.h:338
int nshifts
The number of shifts (zero if no shift should be applied).
Definition: sparsemat.h:290
ghost_error ghost_sparsemat_string(char **str, ghost_sparsemat *mat, int dense)
Creates a string of the sparsemat's contents.
Definition: sparsemat.cpp:231
int chunkheight
The SELL matrix chunk height.
Definition: sparsemat.h:230
Re-order the local part of the matrix using a block coloring.
Definition: sparsemat.h:371
ghost_lidx * rowLen2
Longest length of each tuple of rows.
Definition: sparsemat.h:540
size_t elSize
Size (in bytes) of one matrix element.
Definition: sparsemat.h:576
Does not make a distinction between local and remote entries if set; this might lead to higher commun...
Definition: sparsemat.h:384
ghost_error ghost_cu_sell_spmv_selector(ghost_densemat *lhs, ghost_sparsemat *mat, ghost_densemat *rhs, ghost_spmv_opts traits)
Select and call the right CUDA SELL SpMV kernel.
Definition: sell_spmv.cpp:628
ghost_lidx * chunkLen
The length of each chunk.
Definition: sparsemat.h:522
ghost_lidx * cu_col
The column indices.
Definition: sparsemat.h:556
void * scale
Definition: sparsemat.h:132
Types, constants and macros for SpMV.
A dense vector/matrix.
Definition: densemat.h:226
int C
The chunk height. Only Powers of Two are supported.
Definition: sparsemat.h:431