You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To represent (small) matrices and vectors per gridpoint we allow higher (than 3) dimensional storages (with backend specific) layout (typically structure-of-array like, i.e. the matrix/vector dimensions are outermost). For temporaries, we can only express 3D temporaries, but we allow non-scalar element type. Temporaries with non-scalar element type have a natural API, but will have non-optimal data layout (array-of-structure).
If the user expresses the non-scalar datatype (see example below) with (nested) arrays we can do custom allocation with backend specific layout, without changing the API.
/* * GridTools * * Copyright (c) 2014-2021, ETH Zurich * All rights reserved. * * Please, refer to the LICENSE file in the root directory. * SPDX-License-Identifier: BSD-3-Clause*/
#include"gridtools/stencil/frontend/cartesian/tmp_arg.hpp"
#include"gridtools/stencil/frontend/run.hpp"
#include<gtest/gtest.h>
#include<gridtools/common/array.hpp>
#include<gridtools/stencil/cartesian.hpp>
#include<stencil_select.hpp>
#include<test_environment.hpp>namespace {
usingnamespacegridtools;usingnamespacestencil;usingnamespacecartesian;structcopy_functor {
using in = in_accessor<0>;
using out = inout_accessor<1>;
using tmp = inout_accessor<2>;
using param_list = make_param_list<in, out, tmp>;
template <classEval>
GT_FUNCTION staticvoidapply(Eval &&eval) {
eval(tmp())[0] = eval(in());
eval(out()) = eval(tmp())[0];
}
};
GT_REGRESSION_TEST(copy_stencil_higher_dim, test_environment<>, stencil_backend_t) {
auto in = [](int i, int j, int k) { return i + j + k; };
auto out = TypeParam::make_storage();
run(
[](auto out, auto in) {
GT_DECLARE_TMP((array<typename TypeParam::float_t, 2>), tmp);
returnexecute_parallel().stage(copy_functor(), in, out, tmp);
},
stencil_backend_t(),
TypeParam::make_grid(),
out,
TypeParam::make_storage(in));
TypeParam::verify(in, out);
}
} // namespace
The text was updated successfully, but these errors were encountered:
To represent (small) matrices and vectors per gridpoint we allow higher (than 3) dimensional storages (with backend specific) layout (typically structure-of-array like, i.e. the matrix/vector dimensions are outermost). For temporaries, we can only express 3D temporaries, but we allow non-scalar element type. Temporaries with non-scalar element type have a natural API, but will have non-optimal data layout (array-of-structure).
If the user expresses the non-scalar datatype (see example below) with (nested) arrays we can do custom allocation with backend specific layout, without changing the API.
The text was updated successfully, but these errors were encountered: