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));
99 auto& mview = product.
view();
100 auto const& cmview = product.
view();
104 <<
view.metadata().size();
110 msg <<
" data @ " << product.
buffer().data() <<
",\n" 111 <<
" x @ " <<
view.metadata().addressOf_x() <<
" = " << Column(
view.x(),
view.metadata().size()) <<
",\n" 112 <<
" y @ " <<
view.metadata().addressOf_y() <<
" = " << Column(
view.y(),
view.metadata().size()) <<
",\n" 113 <<
" z @ " <<
view.metadata().addressOf_z() <<
" = " << Column(
view.z(),
view.metadata().size()) <<
",\n" 114 <<
" id @ " <<
view.metadata().addressOf_id() <<
" = " << Column(
view.id(),
view.metadata().size())
116 <<
" r @ " <<
view.metadata().addressOf_r() <<
" = " <<
view.r() <<
'\n' 117 <<
" flags @ " <<
view.metadata().addressOf_flags() <<
" = " << Column(
view.flags(),
view.metadata().size())
121 msg << std::hex <<
" [y - x] = 0x" 122 <<
reinterpret_cast<intptr_t
>(
view.metadata().addressOf_y()) -
123 reinterpret_cast<intptr_t>(
view.metadata().addressOf_x())
125 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_z()) -
126 reinterpret_cast<intptr_t>(
view.metadata().addressOf_y())
128 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_id()) -
129 reinterpret_cast<intptr_t>(
view.metadata().addressOf_z())
131 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_r()) -
132 reinterpret_cast<intptr_t>(
view.metadata().addressOf_id())
133 <<
" [flags - r] = 0x" 134 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_flags()) -
135 reinterpret_cast<intptr_t>(
view.metadata().addressOf_r())
136 <<
" [m - flags] = 0x" 137 << reinterpret_cast<intptr_t>(
view.metadata().addressOf_m()) -
138 reinterpret_cast<intptr_t>(
view.metadata().addressOf_flags());
141 checkViewAddresses(
view);
142 checkViewAddresses(mview);
143 checkViewAddresses(cmview);
145 const portabletest::Matrix matrix{{1, 2, 3, 4, 5, 6}, {2, 4, 6, 8, 10, 12}, {3, 6, 9, 12, 15, 18}};
148 for (int32_t
i = 0;
i <
view.metadata().size(); ++
i) {
173 desc.add<
int>(
"expectSize", -1)
174 ->setComment(
"Expected size of the input collection. Values < 0 mean the check is not performed. Default: -1");
175 desc.add<std::vector<double>>(
"expectXvalues", std::vector<double>(0.))
177 "Expected values of the 'x' field in the input collection. Empty value means to not perform the check. If " 178 "input collection has more elements than this parameter, the parameter values are looped over. Default: " 182 "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)
const std::vector< double > expectXvalues_
char data[epos_bytes_allocation]
TestAlpakaAnalyzer(edm::ParameterSet const &config)