aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2015-10-22 16:53:36 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2015-10-22 16:53:36 -0700
commit2dd944661380875b5536658185041acbd459a225 (patch)
tree252ffb7538735e3198cb9197b2b61ca109e4bbf9 /unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
parent2495e2479fb00674a8ad78ea79e10ac2c952f2a7 (diff)
Added mapping between a specific device and the corresponding packet type
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
index 07735fa5f..3952e733c 100644
--- a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
+++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h
@@ -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.
template <typename U, typename V> struct Tuple {
public: