Hi,
I found references to parallel unzipping online, and tried to get a speedup that way, but it looks like the unzipping is still single-threaded. My test code and output are below. Am I missing something?
Thanks,
Phil
Code:
#include "TSystem.h"
#include "TChain.h"
#include "TMath.h"
#include "TTreeCacheUnzip.h"
#include "TROOT.h"
#include "TError.h"
#include "TStopwatch.h"
#include "TEnv.h"
#include <iostream>
#include <cstdio>
int main(int argc, char** argv)
{
if(argc!=3){
std::cerr << "Usage: parallelunzip filename parallel" << std::endl;
exit(1);
}
const char* filename=argv[1];
bool parallel=atoi(argv[2]);
std::cout << "parallel unzip? " << parallel << std::endl;
if(parallel){
ROOT::EnableImplicitMT();
TTreeCacheUnzip::SetParallelUnzip(TTreeCacheUnzip::kEnable);
}
TChain ch("CCInclusiveReco");
if(parallel){
ch.SetParallelUnzip(true);
}
ch.SetCacheSize(30000000);
ch.Add(filename);
ProcInfo_t before;
gSystem->GetProcInfo(&before);
TStopwatch ts;
for(size_t entry=0; entry<ch.GetEntries()/5; ++entry){
if(entry%100000==0) std::cout << (entry/1000) << "k " << std::endl;
ch.GetEntry();
}
ts.Stop();
ProcInfo_t after;
gSystem->GetProcInfo(&after);
double cpu=(after.fCpuUser+after.fCpuSys - before.fCpuUser-before.fCpuSys);
double real=ts.RealTime();
printf("real time %.1fs, cpu time %.1fs = %.0f%% cpu\n", real, cpu, 100*cpu/real);
return 0;
}
Output:
> ./parallelunzip /dune/data/users/rodriges/CCInclusiveReco-merged-minervame1ABCD.root 1
parallel unzip? 1
[...]
real time 8.0s, cpu time 8.0s = 100% cpu```
___
_ROOT Version:_ 6.16.00
_Platform:_ Linux
_Compiler:_ Not Provided
___