KOKKOS_LAMBDA(size_type i, RealType & update) {
update = Kokkos::max(update, Kokkos::abs(data.values(i)));
},
- Kokkos::Max<RealType, Kokkos::HostSpace>(result));
+ Kokkos::Max<RealType, Kokkos::HostSpace>(result));
}
};
} // namespace internal
const unsigned int n_elements =
communication_pattern->locally_owned_size();
- Kokkos::deep_copy(Kokkos::View<Number*, Kokkos::HostSpace>(tmp_vector.begin(), n_elements), Kokkos::View<const Number*, ::dealii::MemorySpace::Device::kokkos_space>(values, n_elements));
+ Kokkos::deep_copy(
+ Kokkos::View<Number *, Kokkos::HostSpace>(tmp_vector.begin(),
+ n_elements),
+ Kokkos::View<const Number *,
+ ::dealii::MemorySpace::Device::kokkos_space>(
+ values, n_elements));
tmp_vector.update_ghost_values();
const IndexSet &stored = rw_vector.get_stored_elements();
{
if (!used_vertices_rtree.empty())
{
- Assert(false, ExcInternalError());
+ Assert(false, ExcInternalError());
}
else
{
if (!found_cell)
{
- Assert(false, ExcInternalError());
+ Assert(false, ExcInternalError());
}
if (!found_cell)
unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
deallog.push(Utilities::int_to_string(myid));
-
+
if (myid == 0)
{
initlog();
{
unsigned int local_index = partitioner->global_to_local(1);
double * values_dev = v.get_values();
- Kokkos::deep_copy(Kokkos::View<double, MemorySpace::Device::kokkos_space>(values_dev+local_index), 7);
+ Kokkos::deep_copy(Kokkos::View<double, MemorySpace::Device::kokkos_space>(
+ values_dev + local_index),
+ 7);
}
- unsigned int allocated_size = local_relevant.n_elements();
- Kokkos::View<double*, MemorySpace::Device::kokkos_space> v_device(v.get_values(), allocated_size);
- Kokkos::View<double*, Kokkos::HostSpace> v_host("v_host", allocated_size);
+ unsigned int allocated_size = local_relevant.n_elements();
+ Kokkos::View<double *, MemorySpace::Device::kokkos_space> v_device(
+ v.get_values(), allocated_size);
+ Kokkos::View<double *, Kokkos::HostSpace> v_host("v_host", allocated_size);
Kokkos::deep_copy(v_host, v_device);
AssertThrow(v_host[partitioner->global_to_local(myid * 2)] == myid * 4.0,
v.import(rw_vector, VectorOperation::insert);
- LinearAlgebra::distributed::Vector<double, MemorySpace::Device> w(v), u(v);
+ LinearAlgebra::distributed::Vector<double, MemorySpace::Device> w(v),
+ u(v);
u = 0;
v *= 2.0;
LinearAlgebra::distributed::Vector<double, MemorySpace::Device> v(
local_owned, local_relevant, MPI_COMM_WORLD);
- Kokkos::View<double*, MemorySpace::Device::kokkos_space> v_view(v.get_values(), local_relevant.n_elements());
+ Kokkos::View<double *, MemorySpace::Device::kokkos_space> v_view(
+ v.get_values(), local_relevant.n_elements());
- deallog << "Local range of proc 0: " << v.get_partitioner()->local_range().first << " "
+ deallog << "Local range of proc 0: "
+ << v.get_partitioner()->local_range().first << " "
<< v.get_partitioner()->local_range().second << std::endl;
// set local values
for (types::global_dof_index i = 0; i < local_size; ++i)
{
- Kokkos::deep_copy(Kokkos::subview(v_view, i), min_index + myid * local_size + i);
+ Kokkos::deep_copy(Kokkos::subview(v_view, i),
+ min_index + myid * local_size + i);
}
deallog << "vector norm: " << v.l2_norm() << std::endl;
v.zero_out_ghost_values();
const auto &partitioner = v.get_partitioner();
- Kokkos::deep_copy(Kokkos::subview(v_view, partitioner->global_to_local(min_index + 38)), min_index);
- Kokkos::deep_copy(Kokkos::subview(v_view, partitioner->global_to_local(min_index + 39)), min_index*2);
- Kokkos::deep_copy(Kokkos::subview(v_view, partitioner->global_to_local(min_index + 41)), min_index+7);
- Kokkos::deep_copy(Kokkos::subview(v_view, partitioner->global_to_local(min_index + 42)), -static_cast<double>(min_index));
+ Kokkos::deep_copy(
+ Kokkos::subview(v_view, partitioner->global_to_local(min_index + 38)),
+ min_index);
+ Kokkos::deep_copy(
+ Kokkos::subview(v_view, partitioner->global_to_local(min_index + 39)),
+ min_index * 2);
+ Kokkos::deep_copy(
+ Kokkos::subview(v_view, partitioner->global_to_local(min_index + 41)),
+ min_index + 7);
+ Kokkos::deep_copy(
+ Kokkos::subview(v_view, partitioner->global_to_local(min_index + 42)),
+ -static_cast<double>(min_index));
v.compress(VectorOperation::add);
v.update_ghost_values();
v.print(deallog.get_file_stream(), 12, false, false);
v2.reinit(v, true);
// set locally owned range of v2 manually
- Kokkos::View<double*, MemorySpace::Device::kokkos_space> v2_view(v2.get_values(), v2.local_size());
+ Kokkos::View<double *, MemorySpace::Device::kokkos_space> v2_view(
+ v2.get_values(), v2.local_size());
Kokkos::deep_copy(v2_view, 1.);
- Kokkos::parallel_for(v2.local_size(), KOKKOS_LAMBDA(int i) { KOKKOS_IMPL_DO_NOT_USE_PRINTF("%d: %f\n", i, v2_view(i));});
+ Kokkos::parallel_for(
+ v2.local_size(), KOKKOS_LAMBDA(int i) {
+ KOKKOS_IMPL_DO_NOT_USE_PRINTF("%d: %f\n", i, v2_view(i));
+ });
// add entries to ghost values
// Because of limitation in import, the IndexSet of the ReadWriteVector needs
// to have the local elements.
template <typename Number>
double
-print_value(Number* values_dev, unsigned int index)
+print_value(Number *values_dev, unsigned int index)
{
static Kokkos::View<Number, Kokkos::HostSpace> cpu_value("cpu_value");
- Kokkos::deep_copy(cpu_value, Kokkos::View<Number>(values_dev+index));
+ Kokkos::deep_copy(cpu_value, Kokkos::View<Number>(values_dev + index));
return cpu_value();
}
// create vector
LinearAlgebra::distributed::Vector<double, MemorySpace::Device> v(
local_owned, local_relevant, MPI_COMM_WORLD);
- Kokkos::View<double*, MemorySpace::Device::kokkos_space> v_device(v.get_values(), local_relevant.n_elements());
+ Kokkos::View<double *, MemorySpace::Device::kokkos_space> v_device(
+ v.get_values(), local_relevant.n_elements());
const auto &partitioner = v.get_partitioner();
// set local values
- Kokkos::deep_copy(Kokkos::subview(v_device, partitioner->global_to_local(myid * 2)), myid*2.0);
- Kokkos::deep_copy(Kokkos::subview(v_device, partitioner->global_to_local(myid * 2+1)), myid*2.0+1.0);
+ Kokkos::deep_copy(Kokkos::subview(v_device,
+ partitioner->global_to_local(myid * 2)),
+ myid * 2.0);
+ Kokkos::deep_copy(Kokkos::subview(v_device,
+ partitioner->global_to_local(myid * 2 + 1)),
+ myid * 2.0 + 1.0);
v.compress(VectorOperation::add);
v *= 2.0;
// set ghost dof on owning processor and maximize
if (myid != 0)
Kokkos::deep_copy(Kokkos::subview(v_device,
- partitioner->global_to_local(1)),
- 7. * myid);
+ partitioner->global_to_local(1)),
+ 7. * myid);
v.compress(VectorOperation::max);
// import ghosts onto all procs
// set ghost dof on non-owning processors and minimize
v.zero_out_ghost_values();
if (myid == 0)
- Kokkos::deep_copy(Kokkos::subview(v_device, partitioner->global_to_local(1)), -1);
+ Kokkos::deep_copy(Kokkos::subview(v_device,
+ partitioner->global_to_local(1)),
+ -1);
v.compress(VectorOperation::min);
v.update_ghost_values();
v.zero_out_ghost_values();
v = 1.0;
if (myid == 0)
- Kokkos::deep_copy(Kokkos::subview(v_device, partitioner->global_to_local(1)), -1);
+ Kokkos::deep_copy(Kokkos::subview(v_device,
+ partitioner->global_to_local(1)),
+ -1);
// maximize
v.compress(VectorOperation::max);
// maximum is -1:
v.zero_out_ghost_values();
v = 1.0;
- Kokkos::deep_copy(Kokkos::subview(v_device, partitioner->global_to_local(1)), -1);
+ Kokkos::deep_copy(Kokkos::subview(v_device, partitioner->global_to_local(1)),
+ -1);
v.compress(VectorOperation::max);
v.update_ghost_values();
deallog << myid << ":"
// than zero
v.zero_out_ghost_values();
v = -1.0;
- Kokkos::deep_copy(Kokkos::subview(v_device, partitioner->global_to_local(1)), -1);
+ Kokkos::deep_copy(Kokkos::subview(v_device, partitioner->global_to_local(1)),
+ -1);
v.compress(VectorOperation::max);
deallog << myid << ":"
<< "ghost entry after first max: "
template <typename Number>
double
-print_value(Number* values_dev, unsigned int index)
+print_value(Number *values_dev, unsigned int index)
{
static Kokkos::View<Number, Kokkos::HostSpace> cpu_value("cpu_value");
- Kokkos::deep_copy(cpu_value, Kokkos::View<Number>(values_dev+index));
+ Kokkos::deep_copy(cpu_value, Kokkos::View<Number>(values_dev + index));
return cpu_value();
}