3 #include "DataFormats/PortableTestObjects/interface/TestHostCollection.h" 22 void print(std::ostream&
out)
const {
29 buffer <<
", " << data_[1];
32 buffer <<
", " << data_[2];
47 std::ostream& operator<<(std::ostream& out, Column<T>
const&
column) {
53 void checkViewAddresses(
T const&
view) {
77 assert(
view.metadata().addressOf_m() == &
view.m(0).coeffRef(0, 0));
78 assert(
view.metadata().addressOf_m() == &
view[0].m().coeffRef(0, 0));
98 auto& mview = product.
view();
99 auto const& cmview = product.
view();
103 <<
view.metadata().size();
109 msg <<
" data @ " << product.
buffer().data() <<
",\n" 110 <<
" x @ " <<
view.metadata().addressOf_x() <<
" = " << Column(
view.x(),
view.metadata().size()) <<
",\n" 111 <<
" y @ " <<
view.metadata().addressOf_y() <<
" = " << Column(
view.y(),
view.metadata().size()) <<
",\n" 112 <<
" z @ " <<
view.metadata().addressOf_z() <<
" = " << Column(
view.z(),
view.metadata().size()) <<
",\n" 113 <<
" id @ " <<
view.metadata().addressOf_id() <<
" = " << Column(
view.id(),
view.metadata().size())
115 <<
" r @ " <<
view.metadata().addressOf_r() <<
" = " <<
view.r() <<
'\n' 116 <<
" flags @ " <<
view.metadata().addressOf_flags() <<
" = " << Column(
view.flags(),
view.metadata().size())
120 msg << std::hex <<
" [y - x] = 0x" 121 <<
reinterpret_cast<intptr_t
>(
view.metadata().addressOf_y()) -
122 reinterpret_cast<intptr_t>(
view.metadata().addressOf_x())
124 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_z()) -
125 reinterpret_cast<intptr_t>(
view.metadata().addressOf_y())
127 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_id()) -
128 reinterpret_cast<intptr_t>(
view.metadata().addressOf_z())
130 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_r()) -
131 reinterpret_cast<intptr_t>(
view.metadata().addressOf_id())
132 <<
" [flags - r] = 0x" 133 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_flags()) -
134 reinterpret_cast<intptr_t>(
view.metadata().addressOf_r())
135 <<
" [m - flags] = 0x" 136 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_m()) -
137 reinterpret_cast<intptr_t>(
view.metadata().addressOf_flags());
140 checkViewAddresses(
view);
141 checkViewAddresses(mview);
142 checkViewAddresses(cmview);
144 const portabletest::Matrix matrix{{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {3, 6, 9, 12, 15, 18}};
147 for (int32_t
i = 0;
i <
view.metadata().size(); ++
i) {
169 desc.add<
int>(
"expectSize", -1)
170 ->setComment(
"Expected size of the input collection. Values < 0 mean the check is not performed. Default: -1");
173 "Expected backend of the input collection. Empty value means to not perform the check. Default: empty "
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< portabletest::TestHostCollection > token_
Eigen::Matrix< double, 3, 6 > Matrix
void analyze(edm::StreamID sid, edm::Event const &event, edm::EventSetup const &) const override
std::optional< cms::alpakatools::Backend > expectBackend_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ConstView const & const_view() const
const edm::InputTag source_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
edm::EDGetTokenT< unsigned short > backendToken_
#define DEFINE_FWK_MODULE(type)
char data[epos_bytes_allocation]
TestAlpakaAnalyzer(edm::ParameterSet const &config)