GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Classes | Enumerations | Functions
map.h File Reference

Types and functions related to GHOST maps. More...

#include "config.h"
#include "types.h"
#include "sparsemat_src.h"
Include dependency graph for map.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ghost_map
 A GHOST map. More...
 

Enumerations

enum  ghost_maptype { GHOST_MAP_NONE, GHOST_MAP_ROW, GHOST_MAP_COL }
 Possible types of maps. More...
 
enum  ghost_sparsemat_src { GHOST_SPARSEMAT_SRC_FILE, GHOST_SPARSEMAT_SRC_MM, GHOST_SPARSEMAT_SRC_FUNC, GHOST_SPARSEMAT_SRC_NONE }
 Possible sources of a sparse matrix. More...
 
enum  ghost_map_dist_type { GHOST_MAP_DIST_NNZ, GHOST_MAP_DIST_NROWS }
 Possible distribution criteria of maps. More...
 
enum  ghost_map_flags { GHOST_MAP_DEFAULT =0, GHOST_PERM_NO_DISTINCTION =1 }
 Possible flags to maps. More...
 

Functions

ghost_error ghost_map_create_distribution (ghost_map *map, ghost_sparsemat_src_rowfunc *matsrc, double weight, ghost_map_dist_type distType, ghost_lidx *el_per_rank)
 Initialize a map's distribution. More...
 
ghost_error ghost_map_create (ghost_map **map, ghost_gidx gdim, ghost_mpi_comm comm, ghost_maptype type, ghost_map_flags flags)
 Create a map. More...
 
ghost_mapghost_map_create_light (ghost_lidx dim, ghost_mpi_comm mpicomm)
 Create a light map with only a dimension and an MPI communicator. More...
 
void ghost_map_destroy (ghost_map *map)
 Destroy a map and free all its resources if no more references to it exist. More...
 
int ghost_rank_of_row (ghost_map *map, ghost_gidx row)
 Get the rank of a given global row in a given map. More...
 

Detailed Description

Types and functions related to GHOST maps.

Author
Moritz Kreutzer morit.nosp@m.z.kr.nosp@m.eutze.nosp@m.r@fa.nosp@m.u.de

Enumeration Type Documentation

Possible distribution criteria of maps.

Enumerator
GHOST_MAP_DIST_NNZ 

Distribute by number of non zero entries.

GHOST_MAP_DIST_NROWS 

Distribute by number of rows.

Possible flags to maps.

Enumerator
GHOST_MAP_DEFAULT 
GHOST_PERM_NO_DISTINCTION 

Does not make a distinction between local and remote entries if set; this might lead to higher communication time.

Possible types of maps.

Enumerator
GHOST_MAP_NONE 

No type associated yet.

GHOST_MAP_ROW 

A row map.

GHOST_MAP_COL 

A column map.

Possible sources of a sparse matrix.

Enumerator
GHOST_SPARSEMAT_SRC_FILE 

The matrix comes from a binary CRS file.

GHOST_SPARSEMAT_SRC_MM 

The matrix comes from a Matrix Market file.

GHOST_SPARSEMAT_SRC_FUNC 

The matrix is generated by a function.

GHOST_SPARSEMAT_SRC_NONE 

Empty source.

Function Documentation

ghost_error ghost_map_create ( ghost_map **  map,
ghost_gidx  gdim,
ghost_mpi_comm  comm,
ghost_maptype  type,
ghost_map_flags  flags 
)

Create a map.

Parameters
mapThe map.
gdimThe global dimensions of the map.
commThe map's MPI communicator.
typeThe type of the map.
flagsOptional flags.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_error ghost_map_create_distribution ( ghost_map map,
ghost_sparsemat_src_rowfunc matsrc,
double  weight,
ghost_map_dist_type  distType,
ghost_lidx el_per_rank 
)

Initialize a map's distribution.

Parameters
mapThe map.
matsrcThe sparse matrix construction function or NULL.
weightThe weight of this rank.
distTypeThe distribution scheme.
el_per_rankAn array of length $nranks which prescribed the distribution or NULL.

In case matsrc is NULL, the only possible distType is GHOST_MAP_DIST_NROWS.

Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_map* ghost_map_create_light ( ghost_lidx  dim,
ghost_mpi_comm  mpicomm 
)

Create a light map with only a dimension and an MPI communicator.

This map is usually used for non-distributed dense matrices. The map does not have to be free'd by the user but will be free'd in ghost_densemat_destroy().

Parameters
dimThe dimension.
mpicommThe MPI communicator.
Returns
The map.

Here is the call graph for this function:

void ghost_map_destroy ( ghost_map map)

Destroy a map and free all its resources if no more references to it exist.

Parameters
mapThe map.

This decreases the ghost_map::ref_count and, in case it is zero afterwards, free's the map's resources.

int ghost_rank_of_row ( ghost_map map,
ghost_gidx  row 
)

Get the rank of a given global row in a given map.

Parameters
mapThe map.
rowThe global row.
Returns
The rank inside the map's MPI communicator which owns the given row.

Here is the call graph for this function: