77 typedef int size_type;
84 const int iEntryBeg = tensor.entry_begin(i);
85 const int iEntryEnd = tensor.entry_end(i);
86 for (
int iEntry = iEntryBeg ; iEntry < iEntryEnd ; ++iEntry ) {
87 const int kj = tensor.coord( iEntry );
88 const int j = kj & 0x0ffff;
89 const int k = kj >> 16;
92 value_type c2 = tensor.value(iEntry);
93 if (
j == k) c2 *= 2.0;
98 value_type c =
setup.
Cijk->getValue(ii,jj,kk);
101 out <<
"(" << ii <<
"," << jj <<
"," << kk <<
"): " << c
102 <<
" == " << c2 <<
" failed!" << std::endl;
112 typedef Scalar value_type;
115 Teuchos::ParameterList params;
116 params.set(
"Tile Size",10);
117 params.set(
"Max Tiles",10000);
127 const size_t n_tile = tensor.num_tiles();
128 for (
size_t tile = 0 ; tile < n_tile ; ++tile ) {
129 const size_t i_offset = tensor.offset(tile, 0);
130 const size_t j_offset = tensor.offset(tile, 1);
131 const size_t k_offset = tensor.offset(tile, 2);
132 const size_t n_row = tensor.num_rows(tile);
134 for (
size_t i=0; i<n_row; ++i) {
135 const size_t iEntryBeg = tensor.entry_begin(tile,i);
136 const size_t iEntryEnd = tensor.entry_end(tile,i);
137 for (
size_t iEntry = iEntryBeg ; iEntry < iEntryEnd ; ++iEntry ) {
138 const size_t j = tensor.coord(iEntry,0);
139 const size_t k = tensor.coord(iEntry,1);
140 value_type c2 = tensor.value(iEntry);
141 int ii = i + i_offset;
142 int jj =
j + j_offset;
143 int kk = k + k_offset;
146 value_type c =
setup.
Cijk->getValue(ii,jj,kk);
149 out <<
"(" << ii <<
"," << jj <<
"," << kk <<
"): " << c
150 <<
" == " << c2 <<
" failed!" << std::endl;
161 typedef Scalar value_type;
164 Teuchos::ParameterList params;
165 params.set(
"Tile Size",10);
168 Stokhos::create_simple_tiled_product_tensor<Device>(
172 const size_t n_i_tile = tensor.num_i_tiles();
173 for (
size_t i_tile = 0; i_tile<n_i_tile; ++i_tile) {
174 const size_t i_begin = tensor.i_begin(i_tile);
175 const size_t i_size = tensor.i_size(i_tile);
177 const size_t n_j_tile = tensor.num_j_tiles(i_tile);
178 for (
size_t j_tile = 0; j_tile<n_j_tile; ++j_tile) {
179 const size_t j_begin = tensor.j_begin(i_tile, j_tile);
182 const size_t n_k_tile = tensor.num_k_tiles(i_tile, j_tile);
183 for (
size_t k_tile = 0; k_tile<n_k_tile; ++k_tile) {
184 const size_t k_begin = tensor.k_begin(i_tile, j_tile, k_tile);
187 for (
size_t i=0; i<i_size; ++i) {
188 const size_t iEntryBeg = tensor.entry_begin(i_tile,j_tile,k_tile,i);
189 const size_t iEntryEnd = tensor.entry_end(i_tile,j_tile,k_tile,i);
190 for (
size_t iEntry = iEntryBeg ; iEntry < iEntryEnd ; ++iEntry ) {
191 const size_t j = tensor.coord(iEntry,0);
192 const size_t k = tensor.coord(iEntry,1);
193 value_type c2 = tensor.value(iEntry);
194 int ii = i + i_begin;
195 int jj =
j + j_begin;
196 int kk = k + k_begin;
202 value_type c =
setup.
Cijk->getValue(ii,jj,kk);
205 out <<
"(" << ii <<
"," << jj <<
"," << kk <<
"): " << c
206 <<
" == " << c2 <<
" failed!" << std::endl;
214 TEUCHOS_TEST_EQUALITY( num_entry,
setup.
Cijk->num_entries(), out, success );
219 Teuchos::FancyOStream& out) {
222 typedef Scalar value_type;
226 Stokhos::create_coo_product_tensor<Device, Pack>(
229 const size_t nEntry = tensor.entry_count();
231 for (
size_t entry = 0 ; entry < nEntry ; ++entry ) {
232 tensor.coord(entry, i,
j, k);
233 value_type c2 = tensor.value(entry);
234 if (
j == k) c2 *= 2.0;
238 out <<
"(" << i <<
"," <<
j <<
"," << k <<
"): " << c
239 <<
" == " << c2 <<
" failed!" << std::endl;
258 typedef Scalar value_type;
260 typedef size_t size_type;
266 const size_type nk = tensor.num_k(i);
267 const size_type kBeg = tensor.k_begin(i);
268 const size_type kEnd = kBeg + nk;
269 for (size_type kEntry = kBeg; kEntry < kEnd; ++kEntry) {
270 const size_type k = tensor.k_coord(kEntry);
271 const size_type nj = tensor.num_j(kEntry);
272 const size_type jBeg = tensor.j_begin(kEntry);
273 const size_type jEnd = jBeg + nj;
274 for (size_type jEntry = jBeg; jEntry < jEnd; ++jEntry) {
275 const size_type
j = tensor.j_coord(jEntry);
276 value_type c2 = tensor.value(jEntry);
277 if (
j == k) c2 *= 2.0;
280 out <<
"(" << i <<
"," <<
j <<
"," << k <<
"): " << c
281 <<
" == " << c2 <<
" failed!" << std::endl;
292 typedef Scalar value_type;
294 typedef size_t size_type;
298 const size_type nk = tensor.num_k();
300 for ( size_type k = 0; k < nk; ++k) {
301 const size_type nj = tensor.num_j(k);
302 const size_type jBeg = tensor.j_begin(k);
303 const size_type jEnd = jBeg + nj;
304 for (size_type jEntry = jBeg; jEntry < jEnd; ++jEntry) {
305 const size_type
j = tensor.j_coord(jEntry);
306 const size_type ni = tensor.num_i(jEntry);
307 const size_type iBeg = tensor.i_begin(jEntry);
308 const size_type iEnd = iBeg + ni;
309 for (size_type iEntry = iBeg; iEntry < iEnd; ++iEntry) {
310 const size_type i = tensor.i_coord(iEntry);
311 value_type c2 = tensor.value(iEntry);
312 if (
j == k) c2 *= 2.0;
315 out <<
"(" << i <<
"," <<
j <<
"," << k <<
"): " << c
316 <<
" == " << c2 <<
" failed!" << std::endl;
361 Teuchos::GlobalMPISession mpiSession(&argc, &
argv);
363 const size_t team_count =
364 Kokkos::hwloc::get_available_numa_count() *
365 Kokkos::hwloc::get_available_cores_per_numa();
366 const size_t threads_per_team =
367 Kokkos::hwloc::get_available_threads_per_core();
371 Kokkos::InitializationSettings init_args;
372 init_args.set_num_threads(team_count*threads_per_team);
373 init_args.set_device_id(0);
374 Kokkos::initialize( init_args );
375 Kokkos::print_configuration( std::cout );
381 int ret = Teuchos::UnitTestRepository::runUnitTestsFromMain(argc,
argv);