Types and functions related to GHOST contexts.
More...
#include "config.h"
#include "types.h"
#include "error.h"
#include "map.h"
Go to the source code of this file.
|
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. More...
|
|
ghost_error | ghost_context_string (char **str, ghost_context *context) |
| Create a string containing information on the context. More...
|
|
void | ghost_context_destroy (ghost_context *ctx) |
| Free the context's resources. More...
|
|
char * | ghost_context_workdist_string (ghost_context_flags_t flags) |
| Get the name of the work distribution scheme. More...
|
|
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. More...
|
|
ghost_map * | ghost_context_map (const ghost_context *ctx, const ghost_maptype mt) |
| Get the context's map with the given map type. More...
|
|
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. More...
|
|
ghost_map * | ghost_context_max_map (const ghost_context *ctx) |
| Get the largest map of the context. More...
|
|
ghost_error | ghost_context_set_map (ghost_context *ctx, ghost_maptype which, ghost_map *map) |
| Set a context's map. More...
|
|
ghost_error | ghost_context_comm_string (char **str, ghost_context *ctx, int root) |
| Create a string holding the context's communication information. More...
|
|
Types and functions related to GHOST contexts.
- Author
- Moritz Kreutzer morit.nosp@m.z.kr.nosp@m.eutze.nosp@m.r@fa.nosp@m.u.de
This struct holds all possible flags for a context.
Enumerator |
---|
GHOST_CONTEXT_DEFAULT |
|
GHOST_CONTEXT_DIST_NZ |
Distribute work among the ranks by number of nonzeros.
|
GHOST_CONTEXT_DIST_ROWS |
Distribute work among the ranks by number of rows.
|
internal to differentiate between different KACZ sweep methods
Enumerator |
---|
GHOST_KACZ_METHOD_MC |
Multicolored.
|
GHOST_KACZ_METHOD_BMC_RB |
Block Multicolored with RCM ( condition : nrows/(2*(total_bw+1)) > threads)
|
GHOST_KACZ_METHOD_BMC_one_sweep |
Block Multicolored with RCM ( condition : nrows/(total_bw+1) > threads, and transition does not overlap)
|
GHOST_KACZ_METHOD_BMC_two_sweep |
Block Multicolored with RCM ( condition : nrows/(total_bw+1) > threads, and transition can overlap)
|
GHOST_KACZ_METHOD_BMC |
|
GHOST_KACZ_METHOD_BMCshift |
|
GHOST_KACZ_METHOD_BMCNORMAL |
For system normalized at start.
|
Possible permutation directions.
Enumerator |
---|
GHOST_PERMUTATION_ORIG2PERM |
Permute from original to permuted space.
|
GHOST_PERMUTATION_PERM2ORIG |
Permute from permuted to original space.
|
Create a string holding the context's communication information.
- Parameters
-
str | The string, must be free'd by the caller. |
ctx | The context. |
root | On which rank in the context's MPI communicator to gather the information and create the string. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
Create a context.
- Parameters
-
[out] | context | Where to store the created context. |
[in] | gnrows | The global number of rows for the context. If gnrows is 0 a valid matrix file path has to be provided in the argument matrixSource from which the number of rows will be read. |
[in] | gncols | The global number of columns for the context. If gncols is 0 a valid matrix file path has to be provided in the argument matrixSource from which the number of columns will be read. |
[in] | flags | Flags to the context. |
[in] | matrixSource | The sparse matrix source. |
[in] | srcType | The type of the sparse matrix source. |
[in] | comm | The MPI communicator in which the context is present. |
[in] | weight | This influences the work distribution amon ranks. If set to 0., it is automatically determined. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
The matrix source can either be one of ghost_sparsemat_src. The concrete type has to be specified in the srcType parameter. It must not be GHOST_SPARSEMAT_SRC_NONE in the following cases:
- If gnrows or gncols are given as less than 1, the source has to be a a pointer to a ghost_sparsemat_src_rowfunc and srcType has to be set to GHOST_SPARSEMAT_SRC_FILE.
- If the flag GHOST_CONTEXT_WORKDIST_NZE is set in the flags, the source may be of any type (except GHOST_SPARSEMAT_SRC_NONE of course)
In all other cases, i.e., gnrows and gncols are correctly set and the distribution of matrix rows across ranks should be done by the number of rows, the matrixSource parameter will be ignored.
Each rank will get a portion of work which depends on the distribution scheme as set in the flags multiplied with the given weight divided by the sum of the weights of all ranks in the context's MPI communicator. Example: Rank A is of type GHOST_TYPE_CUDA using a GPU with a memory bandwidth of 150 GB/s and rank B is of type GHOST_TYPE_WORK using a CPU socket with a memory bandwidth of 50 GB/s. The work is to be distributed by rows and the matrix contains 8 million rows. A straight-forward distribution of work would assume a weight of 1.5 for A and 0.5 for B. Thus, A would be assigned 6 million matrix rows and B 2 million. Automatic weight determination is done using a main memory benchmark. If the bechmark results differ by less than 10% on each rank, the parallel run will be considered "homogeneous" and the weights will be fixed to 1.0
Free the context's resources.
- Parameters
-
If the context is NULL it will be ignored.
Get the context's map with the given map type.
- Parameters
-
ctx | The context. |
mt | The map type. |
- Returns
- The map corresponding to the map type.
Get the largest map of the context.
- Parameters
-
- Returns
- The map with the larger local dimension.
Get the context's map which does not have the given map type.
- Parameters
-
ctx | The context. |
mt | The map type. |
- Returns
- The map not corresponding to the map type.
Set a context's map.
- Parameters
-
ctx | The context. |
which | The map type to be set. |
map | The map. |
- Returns
- GHOST_SUCCESS on success or an error indicator.
Get the name of the work distribution scheme.
- Parameters
-
- Returns
- A string holding a sensible name of the work distribution scheme.
Create a global inverse permutation from a present global permutation.
- Parameters
-
context | A context with a valid global permutation |
- Returns
- GHOST_SUCCESS on success or an error indicator.