4#include "average_cpu.h"
5#if THRUST_DEVICE_SYSTEM==THRUST_DEVICE_SYSTEM_CUDA
6#include "average_gpu.cuh"
7#elif THRUST_DEVICE_SYSTEM==THRUST_DEVICE_SYSTEM_OMP
8#include "average_omp.h"
25template<
class ContainerType>
26void transpose(
unsigned nx,
unsigned ny,
const ContainerType& in, ContainerType& out)
32 unsigned i = k/nx, j = k%nx;
33 oo[j*ny+i] = ii[i*nx+j];
46template<
class ContainerType>
47void extend_line(
unsigned nx,
unsigned ny,
const ContainerType& in, ContainerType& out)
53 unsigned i = k/nx, j = k%nx;
66template<
class ContainerType>
67void extend_column(
unsigned nx,
unsigned ny,
const ContainerType& in, ContainerType& out)
73 unsigned i = k/nx, j = k%nx;
80template<
class ContainerType>
81void average(
unsigned nx,
unsigned ny,
const ContainerType& in0,
const ContainerType& in1, ContainerType& out)
83 static_assert( std::is_same<get_value_type<ContainerType>,
double>::value,
"We only support double precision dot products at the moment!");
84 const double* in0_ptr = thrust::raw_pointer_cast( in0.data());
85 const double* in1_ptr = thrust::raw_pointer_cast( in1.data());
86 double* out_ptr = thrust::raw_pointer_cast( out.data());
87 average( get_execution_policy<ContainerType>(), nx, ny, in0_ptr, in1_ptr, out_ptr);
91template<
class ContainerType>
92void mpi_average(
unsigned nx,
unsigned ny,
const ContainerType& in0,
const ContainerType& in1, ContainerType& out, MPI_Comm comm, MPI_Comm comm_mod, MPI_Comm comm_mod_reduce)
94 static_assert( std::is_same<get_value_type<ContainerType>,
double>::value,
"We only support double precision dot products at the moment!");
95 const double* in0_ptr = thrust::raw_pointer_cast( in0.data());
96 const double* in1_ptr = thrust::raw_pointer_cast( in1.data());
97 double* out_ptr = thrust::raw_pointer_cast( out.data());
98 average_mpi( get_execution_policy<ContainerType>(), nx, ny, in0_ptr, in1_ptr, out_ptr, comm, comm_mod, comm_mod_reduce);
#define DG_DEVICE
Expands to __host__ __device__ if compiled with nvcc else is empty.
Definition: functions.h:9
void parallel_for(Stencil f, unsigned N, ContainerType &&x, ContainerTypes &&... xs)
; Customizable and generic for loop
Definition: blas2.h:378
void extend_column(unsigned nx, unsigned ny, const ContainerType &in, ContainerType &out)
Copy a line into columns of output vector.
Definition: average_dispatch.h:67
void extend_line(unsigned nx, unsigned ny, const ContainerType &in, ContainerType &out)
Copy a line into rows of output vector.
Definition: average_dispatch.h:47
void transpose(unsigned nx, unsigned ny, const ContainerType &in, ContainerType &out)
Transpose vector.
Definition: average_dispatch.h:26
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition: tensor_traits.h:38
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...