Skip to content

API array inconsistency #331

Description

@jacobmerson

The APIs should be consistent enough that we can avoid copying data everywhere. One such problematic mismatch is between the point evaluation routines and the SetDOFData routines.

See here:

PCMS_FUNCTION_TIMER;
const LO num_points = num_points_;
const int n_comp = n_comp_;
Kokkos::View<T**, DeviceMemorySpace> output("interp_output", num_points,
n_comp);
auto output_view = MakeRank2View(output);
evaluator_->Evaluate(source, output_view);
Kokkos::View<T*, DeviceMemorySpace> flat(
"interp_flat", static_cast<size_t>(num_points) * n_comp);
Kokkos::parallel_for(
Kokkos::RangePolicy<DeviceMemorySpace::execution_space>(0, num_points),
KOKKOS_LAMBDA(LO i) {
for (int c = 0; c < n_comp; ++c) {
flat(i * n_comp + c) = output(i, c);
}
});
target.GetData().SetDOFHolderData(make_const_array_view(flat));

In the short-term with scalar fields, we can just create a 1D view that aliases the 2D view. However, longer term, the SetDOFData API needs to be updated to follow the cannonical data format we have been using in this project.

i.e., data is always Rank 2 where the shape is [# npoints][# components]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions