Adding option for multithreaded query mode#27
Adding option for multithreaded query mode#27GeorgiLH wants to merge 6 commits intocompiler-research:developfrom
Conversation
| @@ -0,0 +1,9 @@ | |||
| #ifndef RAMCORE_RDF_RAMNTUPLEVIEW_H | |||
| #define RAMCORE_RDF_RAMNTUPLEVIEW_H | |||
There was a problem hiding this comment.
warning: header guard does not follow preferred style [llvm-header-guard]
| #define RAMCORE_RDF_RAMNTUPLEVIEW_H | |
| #ifndef GITHUB_WORKSPACE_INC_RAMCORE_RDF_RAMNTUPLEVIEW_H | |
| #define GITHUB_WORKSPACE_INC_RAMCORE_RDF_RAMNTUPLEVIEW_H |
inc/ramcore/RDF_RAMNTupleView.h:7:
- #endif //RAMCORE_RDF_RAMNTUPLEVIEW_H
+ #endif // GITHUB_WORKSPACE_INC_RAMCORE_RDF_RAMNTUPLEVIEW_H| @@ -0,0 +1,9 @@ | |||
| #ifndef RAMCORE_RDF_RAMNTUPLEVIEW_H | |||
| #define RAMCORE_RDF_RAMNTUPLEVIEW_H | |||
| #include <RtypesCore.h> | |||
There was a problem hiding this comment.
warning: 'RtypesCore.h' file not found [clang-diagnostic-error]
#include <RtypesCore.h>
^| @@ -0,0 +1,13 @@ | |||
| #include <ROOT/RDataFrame.hxx> | |||
There was a problem hiding this comment.
warning: 'ROOT/RDataFrame.hxx' file not found [clang-diagnostic-error]
#include <ROOT/RDataFrame.hxx>
^| #include <ROOT/RDataFrame.hxx> | ||
| #include <ramcore/RDF_RAMNTupleView.h> | ||
|
|
||
| ULong64_t rdf_ramntupleview(const char *file, const char *query, bool cache, bool perfstats, const char *perfstatsfilename){ |
There was a problem hiding this comment.
warning: function 'rdf_ramntupleview' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
| ULong64_t rdf_ramntupleview(const char *file, const char *query, bool cache, bool perfstats, const char *perfstatsfilename){ | |
| ULong64_t rdf_ramntupleviewstatic (const char *file, const char *query, bool cache, bool perfstats, const char *perfstatsfilename){ |
|
|
||
|
|
||
| #include <iostream> | ||
| #include <ramcore/RDF_RAMNTupleview.h> |
There was a problem hiding this comment.
warning: 'ramcore/RDF_RAMNTupleview.h' file not found [clang-diagnostic-error]
#include <ramcore/RDF_RAMNTupleview.h>
^| int main(int argc, char **argv){ | ||
|
|
||
| if (argc < 2){ | ||
| std::cerr << "Usage: " << argv[0] << " <file.root> [rname:start-end]\n"; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
std::cerr << "Usage: " << argv[0] << " <file.root> [rname:start-end]\n";
^|
|
||
| if (argc < 2){ | ||
| std::cerr << "Usage: " << argv[0] << " <file.root> [rname:start-end]\n"; | ||
| std::cerr << "Example: " << argv[0] << " output.root chr1:1000-2000\n"; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
std::cerr << "Example: " << argv[0] << " output.root chr1:1000-2000\n";
^| return 1; | ||
| } | ||
|
|
||
| const char* file = argv[1]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
const char* file = argv[1];
^|
|
||
| const char* file = argv[1]; | ||
|
|
||
| const char* query = argv[2]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
const char* query = argv[2];
^|
@GeorgiLH We can make changes in the existing |
| @@ -0,0 +1,8 @@ | |||
| #ifndef RAMCORE_RDF_RAMNTUPLEVIEW_H | |||
| #define RAMCORE_RDF_RAMNTUPLEVIEW_H | |||
There was a problem hiding this comment.
warning: header guard does not follow preferred style [llvm-header-guard]
| #define RAMCORE_RDF_RAMNTUPLEVIEW_H | |
| #ifndef GITHUB_WORKSPACE_INC_RAMCORE_RDF_RAMNTUPLEVIEW_H | |
| #define GITHUB_WORKSPACE_INC_RAMCORE_RDF_RAMNTUPLEVIEW_H |
inc/ramcore/RDF_RAMNTupleView.h:7:
- #endif // RAMCORE_RDF_RAMNTUPLEVIEW_H
+ #endif // GITHUB_WORKSPACE_INC_RAMCORE_RDF_RAMNTUPLEVIEW_H| #include <ramcore/RDF_RAMNTupleView.h> | ||
|
|
||
| ULong64_t | ||
| rdf_ramntupleview(const char *file, const char *query, bool cache, bool perfstats, const char *perfstatsfilename) |
There was a problem hiding this comment.
warning: function 'rdf_ramntupleview' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]
| rdf_ramntupleview(const char *file, const char *query, bool cache, bool perfstats, const char *perfstatsfilename) | |
| rdf_ramntupleviewstatic (const char *file, const char *query, bool cache, bool perfstats, const char *perfstatsfilename) |
| @@ -1,4 +1,5 @@ | |||
| #include "ramcore/RAMNTupleView.h" | |||
There was a problem hiding this comment.
warning: 'ramcore/RAMNTupleView.h' file not found [clang-diagnostic-error]
#include "ramcore/RAMNTupleView.h"
^
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #27 +/- ##
===========================================
- Coverage 64.78% 63.19% -1.60%
===========================================
Files 16 16
Lines 1525 1565 +40
Branches 632 659 +27
===========================================
+ Hits 988 989 +1
- Misses 462 502 +40
+ Partials 75 74 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes
🚀 New features to boost your workflow:
|
|
Gives the same results as samtools but uses multiple threads |
|
@AdityaPandeyCN, can you take a look? |
| #define RAMCORE_RDF_RAMNTUPLEVIEW_H | ||
| #include <RtypesCore.h> | ||
|
|
||
| Long64_t rdf_ramntupleview(const int num_threads, const char *file, const char *query = "", bool cache = true, |
There was a problem hiding this comment.
warning: parameter 'num_threads' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
| Long64_t rdf_ramntupleview(const int num_threads, const char *file, const char *query = "", bool cache = true, | |
| Long64_t rdf_ramntupleview(int num_threads, const char *file, const char *query = "", bool cache = true, |
| using namespace ROOT::RDF; | ||
| namespace rdf { | ||
|
|
||
| static int GetRefId(ROOT::RDataFrame &df, const std::string &rname) |
There was a problem hiding this comment.
warning: no header providing "std::string" is directly included [misc-include-cleaner]
src/ramcore/RDF_RAMNTupleView.cxx:2:
- using namespace ROOT::RDF;
+ #include <string>
+ using namespace ROOT::RDF;| if (rname == "*") | ||
| return -1; | ||
|
|
||
| auto refs = df.Take<std::vector<std::string>>("rname_refs"); |
There was a problem hiding this comment.
warning: no header providing "std::vector" is directly included [misc-include-cleaner]
src/ramcore/RDF_RAMNTupleView.cxx:2:
- using namespace ROOT::RDF;
+ #include <vector>
+ using namespace ROOT::RDF;| auto refs = df.Take<std::vector<std::string>>("rname_refs"); | ||
| const auto &vec = refs.GetValue()[0]; | ||
|
|
||
| auto it = std::find(vec.begin(), vec.end(), rname); |
There was a problem hiding this comment.
warning: no header providing "std::find" is directly included [misc-include-cleaner]
src/ramcore/RDF_RAMNTupleView.cxx:1:
- #include <ramcore/RDF_RAMNTupleView.h>
+ #include <algorithm>
+ #include <ramcore/RDF_RAMNTupleView.h>| const auto &vec = refs.GetValue()[0]; | ||
|
|
||
| auto it = std::find(vec.begin(), vec.end(), rname); | ||
| return (it == vec.end()) ? -1 : std::distance(vec.begin(), it); |
There was a problem hiding this comment.
warning: narrowing conversion from 'typename iterator_traits<__normal_iterator<const basic_string *, vector<basic_string>>>::difference_type' (aka 'long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
return (it == vec.end()) ? -1 : std::distance(vec.begin(), it);
^| const auto &vec = refs.GetValue()[0]; | ||
|
|
||
| auto it = std::find(vec.begin(), vec.end(), rname); | ||
| return (it == vec.end()) ? -1 : std::distance(vec.begin(), it); |
There was a problem hiding this comment.
warning: no header providing "std::distance" is directly included [misc-include-cleaner]
src/ramcore/RDF_RAMNTupleView.cxx:1:
- #include <ramcore/RDF_RAMNTupleView.h>
+ #include <iterator>
+ #include <ramcore/RDF_RAMNTupleView.h>| } | ||
| } // namespace rdf | ||
|
|
||
| Long64_t rdf_ramntupleview(const int num_threads, const char *file, const char *query, bool cache, bool perfstats, |
There was a problem hiding this comment.
warning: no header providing "Long64_t" is directly included [misc-include-cleaner]
src/ramcore/RDF_RAMNTupleView.cxx:1:
- #include <ramcore/RDF_RAMNTupleView.h>
+ #include <RtypesCore.h>
+ #include <ramcore/RDF_RAMNTupleView.h>| Long64_t rdf_ramntupleview(const int num_threads, const char *file, const char *query, bool cache, bool perfstats, | ||
| const char *perfstatsfilename) | ||
| { | ||
| TStopwatch ts; |
There was a problem hiding this comment.
warning: no header providing "TStopwatch" is directly included [misc-include-cleaner]
src/ramcore/RDF_RAMNTupleView.cxx:0:
- #include <ROOT/RDataFrame.hxx>
+ #include <TStopwatch.h>
+ #include <ROOT/RDataFrame.hxx>| TStopwatch ts; | ||
| ts.Start(); | ||
| std::string region = query; | ||
| int chrDelimiterPos = region.find(":"); |
There was a problem hiding this comment.
warning: 'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character [performance-faster-string-find]
| int chrDelimiterPos = region.find(":"); | |
| int chrDelimiterPos = region.find(':'); |
| TStopwatch ts; | ||
| ts.Start(); | ||
| std::string region = query; | ||
| int chrDelimiterPos = region.find(":"); |
There was a problem hiding this comment.
warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
int chrDelimiterPos = region.find(":");
^
We should have a single file for viewing |
Forgot about that. All done now |
|
@AdityaPandeyCN, @vgvassilev i made some changes; could you check them and run the workflows |
| Long64_t ramntupleview(const char *file, const char *query = "", bool cache = true, bool perfstats = false, | ||
| const char *perfstatsfilename = "perf.root"); | ||
|
|
||
| ULong64_t mt_ramntupleview(int numthreads, const char *file, const char *query = "", bool cache = true, bool perfstats = false, |
There was a problem hiding this comment.
warning: no header providing "ULong64_t" is directly included [misc-include-cleaner]
ULong64_t mt_ramntupleview(int numthreads, const char *file, const char *query = "", bool cache = true, bool perfstats = false,
^| const auto &refids = refs.GetValue()[0]; | ||
|
|
||
| auto it = std::find(refids.begin(), refids.end(), rname); | ||
| return (it == refids.end()) ? -1 : std::distance(refids.begin(), it); |
There was a problem hiding this comment.
warning: narrowing conversion from 'typename iterator_traits<__normal_iterator<const basic_string *, vector<basic_string>>>::difference_type' (aka 'long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
return (it == refids.end()) ? -1 : std::distance(refids.begin(), it);
^| const auto &refids = refs.GetValue()[0]; | ||
|
|
||
| auto it = std::find(refids.begin(), refids.end(), rname); | ||
| return (it == refids.end()) ? -1 : std::distance(refids.begin(), it); |
There was a problem hiding this comment.
warning: no header providing "std::distance" is directly included [misc-include-cleaner]
src/ramcore/RAMNTupleView.cxx:9:
- #include <string>
+ #include <iterator>
+ #include <string>| } No newline at end of file | ||
| } | ||
| //NOLINTNEXTLINE(misc-use-internal-linkage) | ||
| ULong64_t mt_ramntupleview(const int numthreads, const char *file, const char *query, bool /*cache*/, bool /*perfstats*/, |
There was a problem hiding this comment.
warning: no header providing "ULong64_t" is directly included [misc-include-cleaner]
ge)
^| bool mt_set = false; | ||
| int num_threads = 0; | ||
| if (argc > 3) { | ||
| std::string mt_flag = argv[3]; |
There was a problem hiding this comment.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
std::string mt_flag = argv[3];
^| bool mt_set = false; | ||
| int num_threads = 0; | ||
| if (argc > 3) { | ||
| std::string mt_flag = argv[3]; |
There was a problem hiding this comment.
warning: no header providing "std::string" is directly included [misc-include-cleaner]
tools/ramntupleview.cxx:4:
- int main(int argc, char *argv[])
+ #include <string>
+ int main(int argc, char *argv[])| std::string mt_flag = argv[3]; | ||
| if (mt_flag.find("-m") != std::string::npos) { | ||
| mt_set = true; | ||
| num_threads = std::atoi(mt_flag.substr(2).data()); |
There was a problem hiding this comment.
warning: no header providing "std::atoi" is directly included [misc-include-cleaner]
tools/ramntupleview.cxx:1:
- #include <iostream>
+ #include <cstdlib>
+ #include <iostream>| Long64_t read_count = ramntupleview(file, region_str); | ||
|
|
||
| printf("Found %lld records in region %s\n", read_count, region_str); | ||
| ULong64_t read_count; |
There was a problem hiding this comment.
warning: no header providing "ULong64_t" is directly included [misc-include-cleaner]
tools/ramntupleview.cxx:1:
- #include <iostream>
+ #include <RtypesCore.h>
+ #include <iostream>| Long64_t read_count = ramntupleview(file, region_str); | ||
|
|
||
| printf("Found %lld records in region %s\n", read_count, region_str); | ||
| ULong64_t read_count; |
There was a problem hiding this comment.
warning: variable 'read_count' is not initialized [cppcoreguidelines-init-variables]
| ULong64_t read_count; | |
| ULong64_t read_count = 0; |
| } else { | ||
| read_count = ramntupleview(file, region_str); | ||
| } | ||
| printf("Found %lld records in region %s", read_count, region_str); |
There was a problem hiding this comment.
warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]
printf("Found %lld records in region %s", read_count, region_str);
^|
Squashed last two commits and applied clang-format |
|
Can you attach a result showing the speedups? |
|
This version does not show speedups because it does not have indexing. I wanted to get this merged before making pull requests about flag filtering and indexing although I could just push the commits to this PR. |
Currently only prints details about the supplied file.