Added mapping between a specific device and the corresponding packet type

This commit is contained in:
Benoit Steiner 2015-10-22 16:53:36 -07:00
parent 2495e2479f
commit 2dd9446613

View File

@ -32,6 +32,29 @@ template <> struct max_n_1<0> {
}; };
// Default packet types
template <typename Scalar, typename Device>
struct PacketType {
typedef typename internal::packet_traits<Scalar>::type type;
static const int size = internal::unpacket_traits<type>::size;
};
// For CUDA packet types when using a GpuDevice
#if defined(EIGEN_USE_GPU) && defined(__CUDACC__)
template <>
struct PacketType<float, GpuDevice> {
typedef float4 type;
static const int size = 4;
};
template <>
struct PacketType<double, GpuDevice> {
typedef double2 type;
static const int size = 2;
};
#endif
// Tuple mimics std::pair but works on e.g. nvcc. // Tuple mimics std::pair but works on e.g. nvcc.
template <typename U, typename V> struct Tuple { template <typename U, typename V> struct Tuple {
public: public: