Discontinuous Galerkin Library
#include "dg/algorithm.h"
typedefs.h
Go to the documentation of this file.
1#ifndef _DG_TYPEDEFS_CUH_
2#define _DG_TYPEDEFS_CUH_
3#include <thrust/host_vector.h>
4#include <thrust/device_vector.h>
5#include "sparseblockmat.h"
6#include "sparseblockmat.cuh"
7
12namespace dg{
13
16//vectors
17template<class T>
18using HVec_t = thrust::host_vector<T>;
19using HVec = thrust::host_vector<double>;
20using iHVec = thrust::host_vector<int>;
21using fHVec = thrust::host_vector<float>;
22
23using DVec = thrust::device_vector<double>;
24using iDVec = thrust::device_vector<int>;
25using fDVec = thrust::device_vector<float>;
26
27//derivative matrices
28template<class T>
34
35// Interpolation matrices
36template<class real_type>
37using IHMatrix_t = cusp::csr_matrix<int, real_type, cusp::host_memory>;
38template<class real_type>
39#if THRUST_DEVICE_SYSTEM==THRUST_DEVICE_SYSTEM_CUDA
40//Ell matrix can be almost 3x faster than csr for GPU
41//However, sometimes matrices contain outlier rows that do not fit in ell
42using IDMatrix_t = cusp::csr_matrix<int, real_type, cusp::device_memory>;
43#else
44// csr matrix can be much faster than ell for CPU (we have our own symv implementation!)
45using IDMatrix_t = cusp::csr_matrix<int, real_type, cusp::device_memory>;
46#endif
49
51}//namespace dg
52
53#ifdef MPI_VERSION
54#include "mpi_vector.h"
55#include "mpi_matrix.h"
56#include "mpi_collective.h"
57
58namespace dg{
61//using MPI_Vector<thrust::device_vector<double> > MDVec; //!< MPI Device Vector s.a. dg::DVec
62template<class T>
68
69template<class T>
71template<class T>
77
78template< class T>
84
85template<class T>
91
92template<class real_type>
94template<class real_type>
98
99
101}//namespace dg
102#endif //MPI_VERSION
103
104//MPI-independent definitions
105namespace dg{
108//vectors
109namespace x{
110#ifdef MPI_VERSION
111using HVec = MHVec;
112using fHVec = fMHVec;
113
114using DVec = MDVec;
115using fDVec = fMDVec;
116
117//derivative matrices
122//interpolation matrices
125#else
126using HVec = HVec;
127using fHVec = fHVec;
128
129using DVec = DVec;
130using fDVec = fDVec;
131
132//derivative matrices
133using HMatrix = HMatrix;
134using fHMatrix = fHMatrix;
135using DMatrix = DMatrix;
136using fDMatrix = fDMatrix;
137//interpolation matrices
138using IHMatrix = IHMatrix;
139using IDMatrix = IDMatrix;
140#endif //MPI_VERSION
141}//namespace x
143}//namespace dg
144
146#ifdef MPI_VERSION
147#define DG_RANK0 if(rank==0)
148#else //MPI_VERSION
149#define DG_RANK0
150#endif //MPI_VERSION
151
152#endif//_DG_TYPEDEFS_CUH_
@ x
x direction
thrust::host_vector< T > HVec_t
Host Vector.
Definition: typedefs.h:18
dg::MPI_Vector< dg::DVec > MDVec
MPI Device Vector s.a. dg::DVec.
Definition: typedefs.h:66
IHMatrix_t< double > IHMatrix
Definition: typedefs.h:47
cusp::csr_matrix< int, real_type, cusp::device_memory > IDMatrix_t
Definition: typedefs.h:42
cusp::csr_matrix< int, real_type, cusp::host_memory > IHMatrix_t
Definition: typedefs.h:37
thrust::device_vector< int > iDVec
integer Device Vector
Definition: typedefs.h:24
thrust::host_vector< double > HVec
Host Vector.
Definition: typedefs.h:19
dg::RowColDistMat< dg::fDMatrix, dg::fDCooMat, dg::fNNCD > fMDMatrix
MPI Device Matrix for derivatives.
Definition: typedefs.h:90
thrust::device_vector< double > DVec
Device Vector. The device can be an OpenMP parallelized cpu or a gpu. This depends on the value of th...
Definition: typedefs.h:23
thrust::host_vector< int > iHVec
integer Host Vector
Definition: typedefs.h:20
MIHMatrix_t< double > MIHMatrix
Definition: typedefs.h:96
thrust::device_vector< float > fDVec
Device Vector. The device can be an OpenMP parallelized cpu or a gpu. This depends on the value of th...
Definition: typedefs.h:25
dg::RowColDistMat< dg::DMatrix, dg::DCooMat, dg::dNNCD > MDMatrix
MPI Device Matrix for derivatives.
Definition: typedefs.h:89
dg::MPI_Vector< dg::fHVec > fMHVec
MPI Host Vector s.a. dg::fHVec.
Definition: typedefs.h:65
dg::MPI_Vector< dg::fDVec > fMDVec
MPI Device Vector s.a. dg::fDVec.
Definition: typedefs.h:67
MIDMatrix_t< double > MIDMatrix
Definition: typedefs.h:97
dg::MPI_Vector< dg::HVec > MHVec
MPI Host Vector s.a. dg::HVec.
Definition: typedefs.h:64
dg::RowColDistMat< dg::fHMatrix, dg::fCooMat, dg::fNNCH > fMHMatrix
MPI Host Matrix for derivatives.
Definition: typedefs.h:88
IDMatrix_t< double > IDMatrix
Definition: typedefs.h:48
thrust::host_vector< float > fHVec
Host Vector.
Definition: typedefs.h:21
dg::RowColDistMat< dg::HMatrix, dg::CooMat, dg::dNNCH > MHMatrix
MPI Host Matrix for derivatives.
Definition: typedefs.h:87
MPI matrix classes.
MIDMatrix IDMatrix
Definition: typedefs.h:124
fMHMatrix fHMatrix
Definition: typedefs.h:119
fMHVec fHVec
Definition: typedefs.h:112
MHMatrix HMatrix
Definition: typedefs.h:118
fMDVec fDVec
Definition: typedefs.h:115
MIHMatrix IHMatrix
Definition: typedefs.h:123
MDVec DVec
Definition: typedefs.h:114
fMDMatrix fDMatrix
Definition: typedefs.h:121
MHVec HVec
Definition: typedefs.h:111
MDMatrix DMatrix
Definition: typedefs.h:120
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Coo Sparse Block Matrix format.
Definition: sparseblockmat.h:179
Ell Sparse Block Matrix format.
Definition: sparseblockmat.h:46
Perform general gather and its transpose (scatter) operation across processes on distributed vectors ...
Definition: mpi_collective.h:504
mpi Vector class
Definition: mpi_vector.h:32
Distributed memory matrix class.
Definition: mpi_matrix.h:219
Communicator for asynchronous nearest neighbor communication.
Definition: mpi_vector.h:181
Distributed memory matrix class, asynchronous communication.
Definition: mpi_matrix.h:65