TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( Kokkos_View_MP, DeepCopy_Subview_Range, Storage ) { typedef typename Storage::execution_space Device; typedef typename Storage::value_type Scalar; typedef Sacado::MP::Vector<Storage> Vector; typedef typename ApplyView<Vector**,Kokkos::LayoutLeft,Device>::type ViewType; typedef typename ViewType::size_type size_type; typedef typename ViewType::HostMirror host_view_type; const size_type num_rows1 = global_num_rows; const size_type num_rows2 = global_num_rows*2; const size_type num_cols = 5; const size_type num_vec = Storage::is_static ? Storage::static_size : global_num_cols; ViewType v1("view1", num_rows1, num_cols, num_vec); ViewType v2("view2", num_rows2, num_cols, num_vec); for (size_type j=0; j<num_cols; ++j) { std::pair<size_type,size_type> rows( 0, num_rows1 ); ViewType v1s = Kokkos::subview( v1, rows, std::pair<size_t,size_t> (j,j+1) ); ViewType v2s = Kokkos::subview( v2, rows, std::pair<size_t,size_t> (j,j+1) ); Kokkos::deep_copy( v1s, Scalar(j+1) ); Kokkos::deep_copy( v2s, v1s ); } // Check success = true; host_view_type hv2 = Kokkos::create_mirror_view( v2 ); Kokkos::deep_copy( hv2, v2 ); for (size_type j=0; j<num_cols; ++j) { for (size_type i=0; i<num_rows1; ++i) { for (size_type k=0; k<num_vec; ++k) { Scalar val = hv2(i,j).fastAccessCoeff(k); Scalar val_expected = j+1; TEUCHOS_TEST_EQUALITY(val, val_expected, out, success); } } for (size_type i=num_rows1; i<num_rows2; ++i) { for (size_type k=0; k<num_vec; ++k) { Scalar val = hv2(i,j).fastAccessCoeff(k); Scalar val_expected = 0; TEUCHOS_TEST_EQUALITY(val, val_expected, out, success); } } } }
vertex_id reach_dijkstra::iterate() { if (q_.size() > max_heap_size_) max_heap_size_ = q_.size(); while (pout_->count(q_.top().id) != 0) { if (iterations_counter % 100000 == 0) cout << "Heap size: " << q_.size() << endl; ++iterations_counter; q_.pop(); } heap_vertex hv = q_.top(); q_.pop(); const path_vertex &pv = unordered_safe_find_const(border_, hv.id); (*pout_)[hv.id] = pv; const vertex &v = pgraph_->get_vertex(hv.id); for (vertex::adj_iterator it = v.out_begin(); it != v.out_end(); ++it) { const vertex_id &adj_vid = (*it).v; const vertex &adj_v = pgraph_->get_vertex(adj_vid); const edge_id &eid = (*it).e; const edge &e = pgraph_->get_edge(eid); if (pout_->count (adj_vid) > 0) continue; path_vertex pv2 (adj_vid, pv.d + get_weight(e), eid, hv.id); heap_vertex hv2 (adj_vid, pv2.d); if (border_.count(adj_vid) == 0 || unordered_safe_find_const(border_, adj_vid).d > pv2.d) { q_.push(hv2); border_[adj_vid] = pv2; } } border_.erase(hv.id); return hv.id; }