36{
37 const auto a = make_vector<Vec>(info.ax, info.ay, info.az);
38 const auto b = make_vector<Vec>(info.bx, info.by, info.bz);
39 const auto c = make_vector<Vec>(info.cx, info.cy, info.cz);
40
42
43 auto d_a = libMesh::Kokkos::upload_vector_storage<StoragePolicy>(std::vector<Vec>{a}, "vector_ops_a");
44 auto d_b = libMesh::Kokkos::upload_vector_storage<StoragePolicy>(std::vector<Vec>{
b},
"vector_ops_b");
45 auto d_c = libMesh::Kokkos::upload_vector_storage<StoragePolicy>(std::vector<Vec>{c}, "vector_ops_c");
46 auto d_vectors = libMesh::Kokkos::make_vector_storage<StoragePolicy>("vector_ops_vectors", vector_results);
47 ::Kokkos::View<double *> d_scalars("vector_ops_scalars", scalar_results);
48
49 ::Kokkos::parallel_for(
50 1,
51 KOKKOS_LAMBDA(int) {
55
56 const Vec copied = libMesh::Kokkos::copy_vector<Vec>(a_ref);
57 const Vec mix = a_ref + b_ref - c_ref;
58 const Vec scaled =
Real(1.25) * a_ref +
Real(-0.5) * b_ref +
Real(0.25) * c_ref;
59 const Vec plus_assign = a_ref + b_ref;
60 const Vec minus_assign = a_ref - b_ref;
61 const Vec accum =
Real(1.25) * a_ref +
Real(-0.5) * b_ref +
Real(0.25) * c_ref;
62 const Vec divided = a_ref /
Real(5.0);
63 const Vec outer_right =
Real(5.0) * a_ref;
64 const Vec outer_left = a_ref *
Real(5.0);
65 const Vec mult_assign = a_ref *
Real(5.0);
66 const Vec div_assign = a_ref /
Real(5.0);
67
73 const Vec assign_zero =
zero;
74
75 unsigned int vector_offset = 0;
87
88 unsigned int scalar_offset = 0;
89 d_scalars(scalar_offset++) = a_ref * b_ref;
90 d_scalars(scalar_offset++) = dot;
91 d_scalars(scalar_offset++) =
contract;
92 d_scalars(scalar_offset++) =
norm;
93 d_scalars(scalar_offset++) =
norm_sq;
94 d_scalars(scalar_offset++) =
zero.is_zero() ? 1.0 : 0.0;
95 d_scalars(scalar_offset++) = mix.is_zero() ? 1.0 : 0.0;
96 d_scalars(scalar_offset++) = (a_ref == a_ref) ? 1.0 : 0.0;
97 d_scalars(scalar_offset++) = (a_ref == b_ref) ? 1.0 : 0.0;
98 d_scalars(scalar_offset++) = (a_ref != a_ref) ? 1.0 : 0.0;
99 d_scalars(scalar_offset++) = (a_ref != b_ref) ? 1.0 : 0.0;
100 d_scalars(scalar_offset++) = assign_zero.is_zero() ? 1.0 : 0.0;
101
102 const Vec xvec = make_vector<Vec>(1.3);
104
105#if LIBMESH_DIM > 1
106 const Vec yvec = make_vector<Vec>(0.0, 2.7);
107 const Vec xydiag = make_vector<Vec>(3.1, 3.1);
110#endif
111
112#if LIBMESH_DIM > 2
113 const Vec xypdiag = make_vector<Vec>(0.8, -0.8);
114 const Vec zvec = make_vector<Vec>(0.0, 0.0, 1.1);
115 const Vec xzdiag = make_vector<Vec>(0.0, 0.7, 0.7);
116 const Vec icosa1 = make_vector<Vec>(1.0, golden_ratio, 0.0);
117 const Vec icosa2 = make_vector<Vec>(-1.0, golden_ratio, 0.0);
118 const Vec icosa3 = make_vector<Vec>(0.0, 1.0, golden_ratio);
123#endif
124
125#if LIBMESH_DIM > 2
126 const Vec cross = a_ref.cross(b_ref);
127 Vec unit_cross = cross;
128 if (cross.norm() > unit_tol)
129 unit_cross = libMesh::Kokkos::vector_unit<Vec>(cross);
130
133#endif
134
135 libmesh_assert_equal_to(vector_offset, vector_results);
136 libmesh_assert_equal_to(scalar_offset, scalar_results);
137 });
138 ::Kokkos::fence();
139
142}
host_oracle< Vec > build_host_oracle(const Vec &a, const Vec &b, const Vec &c)
LIBMESH_DEVICE_INLINE auto vector_dot(const LeftVector &left, const RightVector &right)
LIBMESH_DEVICE_INLINE auto contract(const LeftTensor &left, const RightTensor &right)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real