Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions root/multicore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ if(ROOTTEST_OS_ID MATCHES Ubuntu)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed")
endif()

ROOTTEST_GENERATE_EXECUTABLE(procPoolTreeTest tProcPoolTreeTest.cpp LIBRARIES MultiProc Core Net TreePlayer Tree RIO Hist)
ROOTTEST_GENERATE_EXECUTABLE(processExecutorTreeTest tProcessExecutorTreeTest.cpp LIBRARIES MultiProc Core Net TreePlayer Tree RIO Hist)

ROOTTEST_ADD_TEST(procPoolTreeTest
EXEC procPoolTreeTest
OUTREF tProcPoolTreeTest.ref
ROOTTEST_ADD_TEST(processExecutorTreeTest
EXEC processExecutorTreeTest
OUTREF tProcessExecutorTreeTest.ref
DEPENDS ${GENERATE_EXECUTABLE_TEST})

ROOTTEST_GENERATE_EXECUTABLE(procPoolProcessTest tProcPoolProcessTest.cpp LIBRARIES MultiProc Core Net TreePlayer Tree RIO Hist)
ROOTTEST_GENERATE_EXECUTABLE(processExecutorProcessTest tProcessExecutorProcessTest.cpp LIBRARIES MultiProc Core Net TreePlayer Tree RIO Hist)

ROOTTEST_ADD_TEST(procPoolProcess
EXEC procPoolProcessTest
OUTREF tProcPoolProcessTest.ref
ROOTTEST_ADD_TEST(processExecutorProcess
EXEC processExecutorProcessTest
OUTREF tProcessExecutorProcessTest.ref
DEPENDS ${GENERATE_EXECUTABLE_TEST})

ROOTTEST_GENERATE_EXECUTABLE(procPool tprocpool.cpp LIBRARIES MultiProc Core Net TreePlayer RIO Hist)
ROOTTEST_GENERATE_EXECUTABLE(processExecutor tProcessExecutor.cpp LIBRARIES MultiProc Core Net TreePlayer RIO Hist)

ROOTTEST_ADD_TEST(procPool
EXEC procPool
ROOTTEST_ADD_TEST(processExecutor
EXEC processExecutor
DEPENDS ${GENERATE_EXECUTABLE_TEST})

if(ROOT_imt_FOUND)
include_directories(${TBB_INCLUDE_DIRS})
ROOTTEST_GENERATE_EXECUTABLE(threadPool threadpool.cpp LIBRARIES MultiProc Core Net TreePlayer RIO Hist ${TBB_LIBRARIES})
ROOTTEST_GENERATE_EXECUTABLE(threadExecutor tThreadExecutor.cpp LIBRARIES MultiProc Core Net TreePlayer RIO Hist ${TBB_LIBRARIES})

ROOTTEST_ADD_TEST(threadPool
EXEC threadPool
ROOTTEST_ADD_TEST(tThreadExecutor
EXEC threadExecutor
DEPENDS ${GENERATE_EXECUTABLE_TEST})
endif()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "TH1F.h"
#include "TProcPool.h"
#include "ROOT/TProcessExecutor.hxx"
#include <functional>
#include <vector>
#include <numeric> //accumulate
Expand All @@ -25,11 +25,11 @@ TObject *rootF(TObject *o)
}

int PoolTest() {
TProcPool pool;
ROOT::TProcessExecutor pool;
fClass c;
auto boundF = std::bind(f, 1);

/**** TProcPool::Map ****/
/**** TProcessExecutor::Map ****/
std::vector<int> truth = {1,1,1,1};

// init list and lambda
Expand All @@ -53,7 +53,7 @@ int PoolTest() {
if(res6 != std::vector<int>(100,2))
return 4;

/**** TProcPool::MapReduce ****/
/**** TProcessExecutor::MapReduce ****/
int redtruth = 4;
auto redfunc = [](std::vector<int> a) -> int { return std::accumulate(a.begin(), a.end(), 0); };

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "TProcPool.h"
#include "ROOT/TProcessExecutor.hxx"
#include "TTreeReader.h"
#include "TTreeReaderValue.h"
#include "TFileCollection.h"
Expand Down Expand Up @@ -27,29 +27,29 @@ int main() {

std::vector<std::unique_ptr<TH1F>> res(6);
std::vector<std::string> files(4,hsimpleLocation.Data());
TProcPool pool(3);
ROOT::TProcessExecutor pool(3);

//TProcPool::Process with single file name and tree name
//TProcessExecutor::Process with single file name and tree name
//Note: we have less files than workers here
res[0].reset(pool.ProcTree(hsimpleLocation.Data(), myMacro, "ntuple"));

//TProcPool::Process with vector of files and tree name
//TProcessExecutor::Process with vector of files and tree name
//Note: we have more files than workers here (different behaviour)
res[1].reset(pool.ProcTree(files, myMacro, "ntuple"));

//TProcPool::Process with single file name, tree name and entries limit
//TProcessExecutor::Process with single file name, tree name and entries limit
res[2].reset(pool.ProcTree(hsimpleLocation.Data(), myMacro, "ntuple", 42));

//TProcPool::Process with vector of files, no tree name and entries limit
//TProcessExecutor::Process with vector of files, no tree name and entries limit
res[3].reset(pool.ProcTree(files, myMacro, "ntuple", 10000));

//TProcPool::Process with TFileCollection, no tree name and entries limit
//TProcessExecutor::Process with TFileCollection, no tree name and entries limit
TFileCollection fc;
fc.Add(hsimpleLocation.Data());
fc.Add(hsimpleLocation.Data());
res[4].reset(pool.ProcTree(fc, myMacro, "", 42));

//TProcPool::Process with TChain, no tree name and entries limit
//TProcessExecutor::Process with TChain, no tree name and entries limit
TChain c;
c.Add(hsimpleLocation.Data());
c.Add(hsimpleLocation.Data());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "TTree.h"
#include "TH1F.h"
#include "TTreeReader.h"
#include "TProcPool.h"
#include "ROOT/TProcessExecutor.hxx"

TH1F* myMacro(TTreeReader& reader) {

Expand All @@ -27,7 +27,7 @@ int main() {
TTree* tree;
fp->GetObject("ntuple",tree);

TProcPool pool(2);
ROOT::TProcessExecutor pool(2);
auto res = pool.ProcTree(*tree, myMacro);

std::cout << res->GetEntries() << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int PoolTest() {
fClass c;
auto boundF = std::bind(f, 1);

/**** TProcPool::Map ****/
/**** TThreadExecutor::Map ****/
std::vector<int> truth = {1,1,1,1};

// init list and lambda
Expand All @@ -52,7 +52,7 @@ int PoolTest() {
if(res6 != std::vector<int>(100,2))
return 4;

/**** TProcPool::MapReduce ****/
/**** TThreadExecutor::MapReduce ****/
int redtruth = 4;
auto redfunc = [](std::vector<int> a) -> int { return std::accumulate(a.begin(), a.end(), 0); };

Expand Down