/**
* Mask deciding where constraints are set on a given cell.
*/
- dealii::internal::MatrixFreeFunctions::ConstraintKinds *constraint_mask;
+ Kokkos::View<dealii::internal::MatrixFreeFunctions::ConstraintKinds *,
+ MemorySpace::Default::kokkos_space>
+ constraint_mask;
/**
* If true, use graph coloring has been used and we can simply add into
/**
* Mask deciding where constraints are set on a given cell.
*/
- std::vector<dealii::internal::MatrixFreeFunctions::ConstraintKinds *>
+ std::vector<
+ Kokkos::View<dealii::internal::MatrixFreeFunctions::ConstraintKinds *,
+ MemorySpace::Default::kokkos_space>>
constraint_mask;
/**
/**
* Mask deciding where constraints are set on a given cell.
*/
- std::vector<dealii::internal::MatrixFreeFunctions::ConstraintKinds>
- constraint_mask;
+ typename Kokkos::View<
+ dealii::internal::MatrixFreeFunctions::ConstraintKinds *,
+ MemorySpace::Default::kokkos_space>::HostMirror constraint_mask;
/**
* If true, use graph coloring has been used and we can simply add into
Kokkos::deep_copy(data_host.JxW, data.JxW);
}
- data_host.constraint_mask.resize(data_host.n_cells);
- Utilities::CUDA::copy_to_host(data.constraint_mask,
- data_host.constraint_mask);
+ data_host.constraint_mask = Kokkos::create_mirror(data.constraint_mask);
+ Kokkos::deep_copy(data_host.constraint_mask, data.constraint_mask);
return data_host;
}
Kokkos::View<Number **, MemorySpace::Default::kokkos_space> JxW;
Kokkos::View<Number **[dim][dim], MemorySpace::Default::kokkos_space>
inv_jacobian;
- std::vector<dealii::internal::MatrixFreeFunctions::ConstraintKinds>
- constraint_mask_host;
+ Kokkos::View<dealii::internal::MatrixFreeFunctions::ConstraintKinds *,
+ MemorySpace::Default::kokkos_space>
+ constraint_mask;
// Local buffer
std::vector<types::global_dof_index> local_dof_indices;
FEValues<dim> fe_values;
n_cells,
dofs_per_cell);
- constraint_mask_host.resize(n_cells);
+ // Initialize to zero, i.e., unconstrained cell
+ constraint_mask =
+ Kokkos::View<dealii::internal::MatrixFreeFunctions::ConstraintKinds *,
+ MemorySpace::Default::kokkos_space>(
+ "constraint_mask_" + std::to_string(color), n_cells);
}
for (unsigned int i = 0; i < dofs_per_cell; ++i)
lexicographic_dof_indices[i] = local_dof_indices[lexicographic_inv[i]];
+ // FIXME too many deep_copy
+ auto constraint_mask_host =
+ Kokkos::create_mirror_view_and_copy(MemorySpace::Host::kokkos_space{},
+ constraint_mask);
const ArrayView<dealii::internal::MatrixFreeFunctions::ConstraintKinds>
cell_id_view(constraint_mask_host[cell_id]);
{lexicographic_inv},
lexicographic_dof_indices,
cell_id_view);
+ Kokkos::deep_copy(constraint_mask, constraint_mask_host);
// FIXME too many deep_copy
auto local_to_global_host =
data->inv_jacobian[color] = inv_jacobian;
}
- alloc_and_copy(
- &data->constraint_mask[color],
- ArrayView<const dealii::internal::MatrixFreeFunctions::ConstraintKinds>(
- constraint_mask_host.data(), constraint_mask_host.size()),
- n_cells);
+ data->constraint_mask[color] = constraint_mask;
}
void
MatrixFree<dim, Number>::free()
{
- for (auto &constraint_mask_color_ptr : constraint_mask)
- Utilities::CUDA::free(constraint_mask_color_ptr);
- constraint_mask.clear();
-
internal::used_objects[my_id].store(false);
my_id = -1;
}