Skip to content

Commit

Permalink
Fixes for latest RNTuple changes (#285)
Browse files Browse the repository at this point in the history
* adjust RNTuple benchmarks to latest interface changes

* use RC2 RNTuple data file
  • Loading branch information
jblomer authored Feb 23, 2024
1 parent 61211af commit 1fb0396
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion root/tree/dataframe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if(rootbench-datafiles)
RB_ADD_GBENCHMARK(RNTupleDSBenchmarks
RNTupleDSBenchmarks.cxx
LIBRARIES Core Hist RIO TreePlayer ROOTNTuple ROOTDataFrame
DOWNLOAD_DATAFILES B2HHH~none.ntuple
DOWNLOAD_DATAFILES B2HHH~none.rc2.ntuple
LABEL short)
endif()
endif()
Expand Down
6 changes: 3 additions & 3 deletions root/tree/dataframe/RNTupleDSBenchmarks.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <ROOT/RNTuple.hxx>
#include <ROOT/RNTupleDS.hxx>
#include <ROOT/RNTupleReader.hxx>
#include <ROOT/RDataFrame.hxx>

#include <benchmark/benchmark.h>
Expand Down Expand Up @@ -58,10 +58,10 @@ auto Dataframe(DF &frame)

static void BM_RNTupleDS_LHCB(benchmark::State &state)
{
auto ntuple = ROOT::Experimental::RNTupleReader::Open("DecayTree", RB::GetDataDir() + "/B2HHH~none.ntuple");
auto ntuple = ROOT::Experimental::RNTupleReader::Open("DecayTree", RB::GetDataDir() + "/B2HHH~none.rc2.ntuple");
const Long64_t nEntries = ntuple->GetNEntries() * (state.range(0) / 100.);

auto df = ROOT::RDF::Experimental::FromRNTuple("DecayTree", RB::GetDataDir() + "/B2HHH~none.ntuple");
ROOT::RDataFrame df(RB::GetDataDir() + "/B2HHH~none.rc2.ntuple", "DecayTree");
auto df2 = df.Range(nEntries);
auto h_ptr = Dataframe(df2);
for (auto _ : state)
Expand Down
2 changes: 1 addition & 1 deletion root/tree/tree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ if(ROOT_root7_FOUND AND rootbench-datafiles)
RNTupleLHCBBenchmarks.cxx
LABEL short
LIBRARIES Core Hist MathCore RIO Tree ROOTNTuple
DOWNLOAD_DATAFILES B2HHH~none.ntuple)
DOWNLOAD_DATAFILES B2HHH~none.rc2.ntuple)
endif(ROOT_root7_FOUND AND rootbench-datafiles)
9 changes: 3 additions & 6 deletions root/tree/tree/RNTupleH1Benchmarks.cxx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#include <benchmark/benchmark.h>

#include <ROOT/RDataFrame.hxx>
#include <ROOT/RNTuple.hxx>
#include <ROOT/RNTupleDS.hxx>
#include <ROOT/RNTupleOptions.hxx>
#include <ROOT/RNTupleView.hxx>
#include <ROOT/RNTupleReader.hxx>

#include <TCanvas.h>
#include <TChain.h>
Expand Down Expand Up @@ -40,13 +37,13 @@ static void BM_RNTuple_H1(benchmark::State &state, const std::string &comprAlgor
auto ipiView = ntuple->GetView<std::int32_t>("event.ipi");
auto ipisView = ntuple->GetView<std::int32_t>("event.ipis");
auto md0_dView = ntuple->GetView<float>("event.md0_d");
auto trackView = ntuple->GetViewCollection("event.tracks");
auto trackView = ntuple->GetCollectionView("event.tracks");
auto nhitrpView = ntuple->GetView<std::int32_t>("event.tracks._0.nhitrp");
auto rstartView = ntuple->GetView<float>("event.tracks._0.rstart");
auto rendView = ntuple->GetView<float>("event.tracks._0.rend");
auto nlhkView = ntuple->GetView<float>("event.tracks._0.nlhk");
auto nlhpiView = ntuple->GetView<float>("event.tracks._0.nlhpi");
auto njetsView = ntuple->GetViewCollection("event.jets");
auto njetsView = ntuple->GetCollectionView("event.jets");
// Check print info (minitest)
std::ostringstream os;
ntuple->PrintInfo(ROOT::Experimental::ENTupleInfo::kSummary, os);
Expand Down
4 changes: 2 additions & 2 deletions root/tree/tree/RNTupleLHCBBenchmarks.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <ROOT/RNTuple.hxx>
#include <ROOT/RNTupleReader.hxx>
#include <TH1D.h>
#include <benchmark/benchmark.h>
#include <rootbench/RBConfig.h>
Expand All @@ -22,7 +22,7 @@ static void BM_RNTuple_LHCB(benchmark::State &state)
{
using RNTupleReader = ROOT::Experimental::RNTupleReader;

auto ntuple = RNTupleReader::Open("DecayTree", RB::GetDataDir() + "/B2HHH~none.ntuple");
auto ntuple = RNTupleReader::Open("DecayTree", RB::GetDataDir() + "/B2HHH~none.rc2.ntuple");
auto viewH1IsMuon = ntuple->GetView<int>("H1_isMuon");
auto viewH2IsMuon = ntuple->GetView<int>("H2_isMuon");
auto viewH3IsMuon = ntuple->GetView<int>("H3_isMuon");
Expand Down
5 changes: 2 additions & 3 deletions root/tree/tree/gen_h1.cxx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <ROOT/RField.hxx>
#include <ROOT/RNTuple.hxx>
#include <ROOT/RNTupleModel.hxx>
#include <ROOT/RNTupleOptions.hxx>
#include <ROOT/RNTupleWriteOptions.hxx>
#include <ROOT/RNTupleWriter.hxx>

#include <TBranch.h>
#include <TCanvas.h>
Expand Down

0 comments on commit 1fb0396

Please sign in to comment.