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

Header file for type definitions. More...

#include "config.h"
#include "error.h"
#include <inttypes.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
#include <complex.h>
Include dependency graph for types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ghost_mpi_c
 A float complex number (used for MPI). More...
 
struct  ghost_mpi_z
 A double complex number (used for MPI). More...
 

Macros

#define GHOST_ALLREDUCE   -1
 
#define MPI_COMM_NULL   0
 
#define MPI_COMM_SELF   1
 
#define MPI_OP_NULL   0
 
#define MPI_DATATYPE_NULL   0
 
#define MPI_COMM_WORLD   0
 
#define SELECT_TMPL_2DATATYPES(dt1, dt2, complexclass, ret, func,...)
 
#define SELECT_TMPL_2DATATYPES_base_derived(dt1, dt2, complexclass, ret, func,...)
 
#define SELECT_TMPL_4DATATYPES(dt1, dt2, complexclass, ret, func,...)
 Calls the function with template arguments <dt1_device,dt2_host,dt2_device,dt2_base>. More...
 
#define SELECT_TMPL_1DATATYPE(dt, complexclass, ret, func,...)
 
#define GHOST_DT_ANY   (ghost_datatype)-1
 
#define GHOST_DT_NONE   (ghost_datatype)0
 
#define GHOST_HOST_IDX   0
 
#define GHOST_DEVICE_IDX   1
 
#define GHOST_DT_MAX_SIZE   16
 Size of the largest data type (complex double). More...
 
#define GHOST_REGISTER_DT_D(name)
 Macro to "register" a double data type in an application. More...
 
#define GHOST_REGISTER_DT_S(name)
 
#define GHOST_REGISTER_DT_C(name)
 
#define GHOST_REGISTER_DT_Z(name)
 
#define ghost_mpi_dt_gidx   MPI_INT
 
#define PRGIDX   PRId32
 Macro to print matrix/vector row/column indices depending on index size. More...
 
#define GHOST_GIDX_MAX   INT32_MAX
 
#define ghost_mpi_dt_lidx   MPI_INT
 
#define PRBLASIDX   PRId32
 
#define PRLIDX   PRId32
 
#define GHOST_LIDX_MAX   INT32_MAX
 
#define GHOST_IDX_UNIFORM
 
#define PRIDX   PRGIDX
 
#define ghost_mpi_dt_idx   ghost_mpi_dt_gidx
 

Typedefs

typedef int ghost_mpi_comm
 
typedef int ghost_mpi_op
 
typedef int ghost_mpi_datatype
 
typedef int32_t ghost_gidx
 Type for global indices. More...
 
typedef int32_t ghost_lidx
 
typedef int ghost_blas_idx
 
typedef struct ghost_mpi_c ghost_mpi_c
 
typedef struct ghost_mpi_z ghost_mpi_z
 

Enumerations

enum  ghost_datatype { GHOST_DT_FLOAT = 1, GHOST_DT_DOUBLE = 2, GHOST_DT_REAL = 4, GHOST_DT_COMPLEX = 8 }
 Available primitive data types. More...
 
enum  ghost_location { GHOST_LOCATION_DEFAULT = 0, GHOST_LOCATION_HOST = 1, GHOST_LOCATION_DEVICE = 2 }
 
enum  ghost_alignment { GHOST_UNALIGNED = 0, GHOST_ALIGNED = 1 }
 Possible alignments of data access. More...
 
enum  ghost_implementation {
  GHOST_IMPLEMENTATION_DEFAULT = -1, GHOST_IMPLEMENTATION_PLAIN = 0, GHOST_IMPLEMENTATION_SSE = 1, GHOST_IMPLEMENTATION_AVX = 2,
  GHOST_IMPLEMENTATION_AVX2 = 3, GHOST_IMPLEMENTATION_MIC = 4, GHOST_IMPLEMENTATION_CUDA = 5
}
 Possible implementations of a CPU function. More...
 
enum  ghost_datatype_idx { GHOST_DT_S_IDX = 0, GHOST_DT_D_IDX = 1, GHOST_DT_C_IDX = 2, GHOST_DT_Z_IDX = 3 }
 Contiguous indices for data types. More...
 

Functions

bool ghost_datatype_valid (ghost_datatype datatype)
 Check whether a given data type is valid. More...
 
const char * ghost_datatype_string (ghost_datatype datatype)
 Stringify a ghost_datatype. More...
 
const char * ghost_location_string (ghost_location location)
 
const char * ghost_implementation_string (ghost_implementation implementation)
 
ghost_error ghost_datatype_idx_get (ghost_datatype_idx *idx, ghost_datatype datatype)
 
ghost_error ghost_idx2datatype (ghost_datatype *datatype, ghost_datatype_idx idx)
 
ghost_error ghost_datatype_size (size_t *size, ghost_datatype datatype)
 
ghost_error ghost_mpi_datatype_get (ghost_mpi_datatype *dt, ghost_datatype datatype)
 
ghost_error ghost_mpi_datatypes_create ()
 
ghost_error ghost_mpi_datatypes_destroy ()
 
int ghost_idx_of_location (ghost_location l)
 

Detailed Description

Header file for type definitions.

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

Macro Definition Documentation

#define GHOST_ALLREDUCE   -1
#define GHOST_DEVICE_IDX   1
#define GHOST_DT_ANY   (ghost_datatype)-1
#define GHOST_DT_MAX_SIZE   16

Size of the largest data type (complex double).

#define GHOST_DT_NONE   (ghost_datatype)0
#define GHOST_GIDX_MAX   INT32_MAX
#define GHOST_HOST_IDX   0
#define GHOST_IDX_UNIFORM
#define GHOST_LIDX_MAX   INT32_MAX
#define ghost_mpi_dt_gidx   MPI_INT
#define ghost_mpi_dt_idx   ghost_mpi_dt_gidx
#define ghost_mpi_dt_lidx   MPI_INT
#define GHOST_REGISTER_DT_C (   name)
Value:
typedef complex float name ## _t; \
Complex numbers.
Definition: types.h:264
Single precision.
Definition: types.h:252
ghost_datatype
Available primitive data types.
Definition: types.h:248
See Also
GHOST_REGISTER_DT_D with float complex instead of double.
#define GHOST_REGISTER_DT_D (   name)
Value:
typedef double name ## _t; \
Double precision.
Definition: types.h:256
Real numbers.
Definition: types.h:260
ghost_datatype
Available primitive data types.
Definition: types.h:248

Macro to "register" a double data type in an application.

Parameters
nameAn identifier.

This macro enables easy switching of data types in applications. After calling the macros with identifier "mydata" a typedef "typedef mydata_t double;" and a variable "ghost_datatype mydata = GHOST_DT_DOUBLE|GHOST_DT_REAL;" will be present.

#define GHOST_REGISTER_DT_S (   name)
Value:
typedef float name ## _t; \
Single precision.
Definition: types.h:252
Real numbers.
Definition: types.h:260
ghost_datatype
Available primitive data types.
Definition: types.h:248
See Also
GHOST_REGISTER_DT_D with float instead of double.
#define GHOST_REGISTER_DT_Z (   name)
Value:
typedef complex double name ## _t; \
Complex numbers.
Definition: types.h:264
Double precision.
Definition: types.h:256
ghost_datatype
Available primitive data types.
Definition: types.h:248
See Also
GHOST_REGISTER_DT_D with double complex instead of double.
#define MPI_COMM_NULL   0
#define MPI_COMM_SELF   1
#define MPI_COMM_WORLD   0
#define MPI_DATATYPE_NULL   0
#define MPI_OP_NULL   0
#define PRBLASIDX   PRId32
#define PRGIDX   PRId32

Macro to print matrix/vector row/column indices depending on index size.

#define PRIDX   PRGIDX
#define PRLIDX   PRId32
#define SELECT_TMPL_1DATATYPE (   dt,
  complexclass,
  ret,
  func,
  ... 
)
Value:
if (dt & GHOST_DT_COMPLEX) {\
if (dt & GHOST_DT_DOUBLE) {\
ret = func<complexclass<double> >(__VA_ARGS__);\
} else {\
ret = func<complexclass<float> >(__VA_ARGS__);\
}\
} else {\
if (dt & GHOST_DT_DOUBLE) {\
ret = func<double>(__VA_ARGS__);\
} else {\
ret = func<float>(__VA_ARGS__);\
}\
}\
Complex numbers.
Definition: types.h:264
Double precision.
Definition: types.h:256
#define SELECT_TMPL_2DATATYPES (   dt1,
  dt2,
  complexclass,
  ret,
  func,
  ... 
)
#define SELECT_TMPL_2DATATYPES_base_derived (   dt1,
  dt2,
  complexclass,
  ret,
  func,
  ... 
)
#define SELECT_TMPL_4DATATYPES (   dt1,
  dt2,
  complexclass,
  ret,
  func,
  ... 
)

Calls the function with template arguments <dt1_device,dt2_host,dt2_device,dt2_base>.

Typedef Documentation

typedef int ghost_blas_idx
typedef int32_t ghost_gidx

Type for global indices.

typedef int32_t ghost_lidx
typedef struct ghost_mpi_c ghost_mpi_c
typedef int ghost_mpi_comm
typedef int ghost_mpi_datatype
typedef int ghost_mpi_op
typedef struct ghost_mpi_z ghost_mpi_z

Enumeration Type Documentation

Possible alignments of data access.

Enumerator
GHOST_UNALIGNED 
GHOST_ALIGNED 

Available primitive data types.

The validity of a data type can be checked with ghost_datatypeValid().

Enumerator
GHOST_DT_FLOAT 

Single precision.

GHOST_DT_DOUBLE 

Double precision.

GHOST_DT_REAL 

Real numbers.

GHOST_DT_COMPLEX 

Complex numbers.

Contiguous indices for data types.

This is used, e.g., when template instantiations for different data types are stored in an array.

Enumerator
GHOST_DT_S_IDX 

Real float.

GHOST_DT_D_IDX 

Real double.

GHOST_DT_C_IDX 

Complex float.

GHOST_DT_Z_IDX 

Complex double.

Possible implementations of a CPU function.

Enumerator
GHOST_IMPLEMENTATION_DEFAULT 
GHOST_IMPLEMENTATION_PLAIN 
GHOST_IMPLEMENTATION_SSE 
GHOST_IMPLEMENTATION_AVX 
GHOST_IMPLEMENTATION_AVX2 
GHOST_IMPLEMENTATION_MIC 
GHOST_IMPLEMENTATION_CUDA 
Enumerator
GHOST_LOCATION_DEFAULT 

Default location. This is only a placeholder and the actual location has to be specified by GHOST.

GHOST_LOCATION_HOST 

Data is located on host.

GHOST_LOCATION_DEVICE 

Data is located on device (accelerator, GPU).

Function Documentation

ghost_error ghost_datatype_idx_get ( ghost_datatype_idx idx,
ghost_datatype  datatype 
)

Here is the call graph for this function:

ghost_error ghost_datatype_size ( size_t *  size,
ghost_datatype  datatype 
)

Here is the call graph for this function:

bool ghost_datatype_valid ( ghost_datatype  datatype)

Check whether a given data type is valid.

Parameters
datatypeThe data type.
Returns
1 if the data type is valid and 0 if it isn't.

An data type is valid if exactly one of GHOST_DT_FLOAT and GHOST_DT_DOUBLE and exactly one of GHOST_DT_REAL and GHOST_DT_COMPLEX is set.

ghost_error ghost_idx2datatype ( ghost_datatype datatype,
ghost_datatype_idx  idx 
)
int ghost_idx_of_location ( ghost_location  l)
const char* ghost_implementation_string ( ghost_implementation  implementation)
const char* ghost_location_string ( ghost_location  location)
ghost_error ghost_mpi_datatype_get ( ghost_mpi_datatype dt,
ghost_datatype  datatype 
)
ghost_error ghost_mpi_datatypes_create ( )
ghost_error ghost_mpi_datatypes_destroy ( )