GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
context.h
Go to the documentation of this file.
1 
6 #ifndef GHOST_CONTEXT_H
7 #define GHOST_CONTEXT_H
8 
9 #include "config.h"
10 #include "types.h"
11 #include "error.h"
12 #include "map.h"
13 
15 
19 typedef enum
20 {
29 }
31 
35 typedef enum {
45 
47 
48 #ifdef __cplusplus
49 inline ghost_context_flags_t operator|(const ghost_context_flags_t &a,
50  const ghost_context_flags_t &b)
51 {
52  return static_cast<ghost_context_flags_t>(
53  static_cast<int>(a) | static_cast<int>(b));
54 }
55 
56 inline ghost_context_flags_t operator&(const ghost_context_flags_t &a,
57  const ghost_context_flags_t &b)
58 {
59  return static_cast<ghost_context_flags_t>(
60  static_cast<int>(a) & static_cast<int>(b));
61 }
62 #endif
63 
64 
68 typedef enum{
91 }
93 
94 //TODO zone ptr can be moved here
95 typedef struct {
96 
99 }
101 
102 
109 {
129  double weight;
219  ghost_lidx *mappedDuelist; //This might be removed in a future version
226 
232  int nmats;
274  double kaczRatio;
275 
276 };
277 
279 
280 
281 #ifdef __cplusplus
282 extern "C" {
283 #endif
284 
315  ghost_error ghost_context_create(ghost_context **context, ghost_gidx gnrows, ghost_gidx gncols, ghost_context_flags_t flags, ghost_mpi_comm comm, double weight);
316 
326  ghost_error ghost_context_string(char **str, ghost_context *context);
335 
397  ghost_error ghost_context_comm_string(char **str, ghost_context *ctx, int root);
398 
399 #ifdef __cplusplus
400 } //extern "C"
401 #endif
402 
403 #endif
ghost_lidx * color_ptr
The number of rows with each color (length: ncolors+1).
Definition: context.h:257
char * ghost_context_workdist_string(ghost_context_flags_t flags)
Get the name of the work distribution scheme.
Definition: context.c:749
ghost_gidx gnnz
The global number of non-zeros.
Definition: context.h:113
int nmats
The number of matrices in this context.
Definition: context.h:232
ghost_map * ghost_context_map(const ghost_context *ctx, const ghost_maptype mt)
Get the context's map with the given map type.
Definition: context.c:765
Header file for type definitions.
Definition: context.h:36
ghost_maptype
Possible types of maps.
Definition: map.h:16
ghost_lidx * hput_pos
First index to get RHS elements coming from each rank.
Definition: context.h:172
ghost_mpi_comm mpicomm
The context's MPI communicator.
Definition: context.h:133
ghost_error ghost_context_create(ghost_context **context, ghost_gidx gnrows, ghost_gidx gncols, ghost_context_flags_t flags, ghost_mpi_comm comm, double weight)
Create a context.
Definition: context.c:17
For system normalized at start.
Definition: context.h:90
int32_t ghost_gidx
Type for global indices.
Definition: types.h:443
ghost_lidx * avg_ptr
Compressed Pointer to the densematrix row indices where averaging has to be done (eg: used in densema...
Definition: context.h:205
ghost_permutation_direction
Possible permutation directions.
Definition: context.h:19
Permute from original to permuted space.
Definition: context.h:24
Permute from permuted to original space.
Definition: context.h:28
Distribute work among the ranks by number of rows.
Definition: context.h:44
Block Multicolored with RCM ( condition : nrows/(total_bw+1) > threads, and transition can overlap) ...
Definition: context.h:84
ghost_map * row_map
The row map of this context.
Definition: context.h:144
ghost_lidx * wishes
Number of wishes (= unique RHS elements to get) from each rank.
Definition: context.h:152
ghost_lidx ** duelist
Column indices of dues to each rank.
Definition: context.h:164
ghost_lidx ncolors
The number of colors from distance-2 coloring.
Definition: context.h:253
ghost_gidx bandwidth
The bandwidth of the matrix.
Definition: context.h:244
void ghost_context_destroy(ghost_context *ctx)
Free the context's resources.
Definition: context.c:145
ghost_lidx ** cu_duelist
Column indices of dues to each rank (CUDA)
Definition: context.h:168
ghost_gidx maxColRange
The maximum column index in the matrix (Required for example if we permute the (local + remote) part ...
Definition: context.h:249
int32_t ghost_lidx
Definition: types.h:503
ghost_lidx nzones
The number of total zones (odd+even)
Definition: context.h:261
ghost_gidx lowerBandwidth
The bandwidth of the lower triangular part of the matrix.
Definition: context.h:236
Definition: context.h:85
ghost_error ghost_context_comm_string(char **str, ghost_context *ctx, int root)
Create a string holding the context's communication information.
Definition: context.cpp:21
ghost_map * ghost_context_max_map(const ghost_context *ctx)
Get the largest map of the context.
Definition: context.c:775
Types, functions and macros for error handling.
int ghost_mpi_comm
Definition: types.h:19
Distribute work among the ranks by number of nonzeros.
Definition: context.h:40
ghost_error
Error return type.
Definition: error.h:23
Multicolored.
Definition: context.h:72
double kaczRatio
Store the ratio between nrows and bandwidth.
Definition: context.h:274
ghost_map * col_map
The column map of this context.
Definition: context.h:148
ghost_lidx active_threads
Definition: context.h:98
ghost_lidx nnz
Local number of non-zeros.
Definition: context.h:117
ghost_lidx ** wishlist
Column idx of wishes from each rank.
Definition: context.h:156
ghost_context_flags_t
This struct holds all possible flags for a context.
Definition: context.h:35
ghost_lidx * dues
Number of dues (= unique RHS elements from myself) to each rank.
Definition: context.h:160
int nwishpartners
The number of ranks from which this rank has to receive RHS vector elements in SpMV communication...
Definition: context.h:192
ghost_context_flags_t flags
The context's property flags.
Definition: context.h:121
int * duepartners
The list of ranks to which this rank has to send RHS vector elements in SpMV communcations.
Definition: context.h:178
ghost_gidx upperBandwidth
The bandwidth of the upper triangular part of the matrix.
Definition: context.h:240
ghost_lidx * zone_ptr
Pointer to odd-even (Red-Black coloring) zones of a matrix (length: nzones+1) Ordering [even_begin_1 ...
Definition: context.h:266
A GHOST map.
Definition: map.h:83
Block Multicolored with RCM ( condition : nrows/(2*(total_bw+1)) > threads)
Definition: context.h:76
ghost_error ghost_context_string(char **str, ghost_context *context)
Create a string containing information on the context.
Definition: context.c:127
ghost_error ghost_context_set_map(ghost_context *ctx, ghost_maptype which, ghost_map *map)
Set a context's map.
Definition: context.c:780
const ghost_context GHOST_CONTEXT_INITIALIZER
Block Multicolored with RCM ( condition : nrows/(total_bw+1) > threads, and transition does not overl...
Definition: context.h:80
The GHOST context.
Definition: context.h:108
ghost_kacz_setting kacz_setting
details regarding kacz is stored here
Definition: context.h:270
ghost_mpi_comm mpicomm_parent
The context's parent MPI communicator.
Definition: context.h:140
ghost_kacz_method
internal to differentiate between different KACZ sweep methods
Definition: context.h:68
Types and functions related to GHOST maps.
Definition: context.h:86
ghost_lidx nChunkAvg
The number of chunks in avg_ptr.
Definition: context.h:200
ghost_error ghost_global_perm_inv(ghost_gidx *toPerm, ghost_gidx *fromPerm, ghost_context *context)
Create a global inverse permutation from a present global permutation.
Definition: perm.c:14
ghost_lidx * entsInCol
Number of matrix entries in each local column.
Definition: context.h:196
double weight
The weight of this context.
Definition: context.h:129
Definition: context.h:95
ghost_lidx * mappedDuelist
Mapped Duelist (eg: used in densemat averaging)
Definition: context.h:219
int * wishpartners
The list of ranks from which this rank has to receive RHS vector elements in SpMV communcations...
Definition: context.h:188
ghost_lidx nElemAvg
The total elements to be averaged.
Definition: context.h:209
int nduepartners
The number of ranks to which this rank has to send RHS vector elements in SpMV communication.
Definition: context.h:182
int * nrankspresent
no. of ranks present in column index corresponding to avg_ptr (only elements with halo entries are st...
Definition: context.h:225
ghost_kacz_method kacz_method
Definition: context.h:97
ghost_lidx * mapAvg
Map used to compress the pointer (eg: used in densemat averaging)
Definition: context.h:214
ghost_map * ghost_context_other_map(const ghost_context *ctx, const ghost_maptype mt)
Get the context's map which does not have the given map type.
Definition: context.c:770