Skip to content

Commit

Permalink
[tuts] Re-organise multicore tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
dpiparo committed Dec 21, 2024
1 parent aa11bd7 commit 3b2a444
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 275 deletions.
25 changes: 12 additions & 13 deletions tutorials/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ if(MACOSX_VERSION VERSION_EQUAL 10.13)
endif()

if(NOT geom)
set(geom_veto visualisation/geom/*.C geom/*.C)
set(geom_veto visualisation/geom/*.C geom/*.C visualisation/geom/gdml/*.C)
endif()

if(NOT ROOT_proof_FOUND)
Expand Down Expand Up @@ -248,19 +248,19 @@ if(NOT GRAPHVIZ_FOUND)
endif()

if(NOT TBB_FOUND AND NOT builtin_tbb)
set(tbb_veto multicore/mtbb*.C)
set(tbb_veto analysis/mtbb*.C io/tree/mtbb*.C)
endif()

if(NOT ROOT_imt_FOUND)
set(imt_veto multicore/imt*.C multicore/mt*.C)
set(imt_veto io/tree/imt*.C io/tree/mt*.C analysis/mt*.C)
endif()
if(MSVC)
#---Multiproc is not supported on Windows
set(imt_veto ${imt_veto} multicore/mp*.C multicore/mtbb201_parallelHistoFill.C)
set(imt_veto ${imt_veto} analysis/mp*.C io/tree/mp*.C legacy/multicore/mp*.C multicore/mp*.C ./analysis/mtbb_parallelHistoFill.C)
endif()

if(ROOT_CLASSIC_BUILD)
set(classic_veto multicore/mp104_*.C multicore/mp105_*.C)
set(classic_veto legacy/multicore/mp_*.C analysis/mp_*.C io/tree/mp_*.C)
endif()

if(NOT gdml)
Expand Down Expand Up @@ -319,7 +319,7 @@ else()
list(APPEND tmva_veto machine_learning/RBatchGenerator_TensorFlow.py)
endif()
if (NOT PY_SKLEARN_FOUND)
list(APPEND tmva_veto machine_learning/TMVA_SOFIE_Models.py)
list(APPEND tmva_veto machine_learning/TMVA_SOFIE_Models.py roofit/rf617_simulation_based_inference_multidimensional.py)
endif()
if (NOT PY_TORCH_FOUND)
list(APPEND tmva_veto machine_learning/TMVA_SOFIE_PyTorch.C)
Expand Down Expand Up @@ -400,7 +400,7 @@ set(extra_veto
rootlogon.C # Helper macro
rootlogoff.C # Helper macro
legacy/rootmarks.C # Instrumentation. Not a standalone tutorial
multicore/mp_H1_lambdas.C # not a tutorial; used by mp104_processH1.C et al.
legacy/multicore/mp_H1_lambdas.C # not a tutorial; used by mp104_processH1.C et al.
html/*.C
legacy/net/*.C
legacy/proof/*.C
Expand Down Expand Up @@ -552,9 +552,8 @@ set(benchmarks-depends tutorial-hsimple
tutorial-io-loopdir
tutorial-io-copyFiles)
set(visualisation-geom-na49view-depends tutorial-visualisation-geom-geometry)
set(multicore-mt102_readNtuplesFillHistosAndFit-depends tutorial-multicore-mt101_fillNtuples)
set(multicore-mp102_readNtuplesFillHistosAndFit-depends tutorial-multicore-mp101_fillNtuples)
set(multicore-mp105_processEntryList-depends tutorial-multicore-mp104_processH1)
set(io-tree-mt_readNtuplesFillHistosAndFit-depends tutorial-io-tree-mt_fillNtuples)
set(io-tree-mp_readNtuplesFillHistosAndFit-depends tutorial-io-tree-mp_fillNtuples)

#--many histfactory and roostats tutorials depending on having creating the file first with histfactory and example_combined_GaussExample_model.root
foreach(tname histfactory-hf001_example
Expand Down Expand Up @@ -611,7 +610,7 @@ endif()
#--List long-running tutorials to label them as "longtest"
set (long_running
analysis/dataframe/df10[2-7]*
multicore/mp103*)
analysis/mp_processSelector.C)
file(GLOB long_running RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${long_running})
#--List multithreaded tutorials to run them serially
set(NProcessors 4)
Expand All @@ -621,7 +620,7 @@ set (multithreaded_all_cores
)
set (multithreaded
${multithreaded_all_cores}
multicore/mp103*
analysis/mp_processSelector.C
machine_learning/TMVAMulticlass.C
machine_learning/TMVA_CNN_Classification.C
machine_learning/TMVA_Higgs_Classification.C
Expand Down Expand Up @@ -804,7 +803,7 @@ if(ROOT_pyroot_FOUND)

find_python_module(xgboost QUIET)
if(NOT PY_XGBOOST_FOUND OR NOT dataframe)
file(GLOB tmva_veto_py RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} machine_learning/tmva10*.py)
file(GLOB tmva_veto_py RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} machine_learning/tmva10*.py roofit/rf618_mixture_models.py)
list(APPEND pyveto ${tmva_veto_py})
endif()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_analysis
/// \notebook -js
/// Parallel fill of a histogram
/// This tutorial shows how a histogram can be filled in parallel
Expand All @@ -13,7 +13,7 @@

const UInt_t poolSize = 4U;

Int_t mp201_parallelHistoFill()
Int_t mp_parallelHistoFill()
{
TH1::AddDirectory(false);
ROOT::TProcessExecutor pool(poolSize);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_analysis
/// \notebook -nodraw
/// Illustrate the usage of the multiproc TSelector interfaces with the h1 analysis
/// example.
Expand All @@ -25,7 +25,7 @@ const std::vector<std::string> files = {file0,
"http://root.cern/files/h1/dstarp1b.root",
"http://root.cern/files/h1/dstarp2.root"};

int mp103_processSelector()
int mp_processSelector()
{

// MacOSX may generate connection to WindowServer errors
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_analysis
/// \notebook
/// Fill histograms in parallel and write them on file.
/// The simplest meaningful possible example which shows ROOT thread awareness.
Expand All @@ -15,7 +15,7 @@ const UInt_t nNumbers = 20000000U;
// The number of workers
const UInt_t nWorkers = 4U;

Int_t mt001_fillHistos()
Int_t mt_fillHistos()
{

// The first, fundamental operation to be performed in order to make ROOT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_analysis
/// \notebook
/// Parallel fill of a histogram.
/// This tutorial shows how a histogram can be filled in parallel
Expand All @@ -18,7 +18,7 @@

const UInt_t poolSize = 4U;

Int_t mt201_parallelHistoFill()
Int_t mt_parallelHistoFill()
{
ROOT::EnableThreadSafety();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_analysis
/// \notebook
/// Fill histograms in parallel and write them on file.
/// This example expresses the parallelism of the mt001_fillHistos.C tutorial
Expand All @@ -16,7 +16,7 @@ const UInt_t nNumbers = 20000000U;
// The number of workers
const UInt_t nThreads = 4U;

Int_t mtbb001_fillHistos()
Int_t mtbb_fillHistos()
{
// We define our work item
auto workItem = [](UInt_t workerID) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \notebook
/// \ingroup tutorial_analysis
/// Parallel fill of a histogram.
/// This tutorial shows how a histogram can be filled in parallel
/// with a multiprocess approach.
Expand All @@ -13,7 +12,7 @@

const UInt_t poolSize = 4U;

Int_t mtbb201_parallelHistoFill()
Int_t mtbb_parallelHistoFill()
{
TH1::AddDirectory(false);
ROOT::TThreadExecutor pool(poolSize);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_tree
/// \notebook
/// Demonstrate how to activate and use the implicit parallelisation of TTree::GetEntry.
/// Such parallelisation creates one task per top-level branch of the tree being read.
Expand All @@ -12,7 +12,7 @@
/// \date 26/09/2016
/// \author Enric Tejedor

int imt001_parBranchProcessing()
int imt_parBranchProcessing()
{
// First enable implicit multi-threading globally, so that the implicit parallelisation is on.
// The parameter of the call specifies the number of threads to use.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_tree
/// \notebook
/// Illustrate the usage of the TTreeProcessorMT::Process method.
/// Such method provides an implicit parallelisation of the reading and processing of a TTree.
Expand All @@ -16,7 +16,7 @@
/// \date 26/09/2016
/// \author Enric Tejedor

int imt101_parTreeProcessing()
int imt_parTreeProcessing()
{
// First enable implicit multi-threading globally, so that the implicit parallelisation is on.
// The parameter of the call specifies the number of threads to use.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_tree
/// \notebook -nodraw
/// Fill n-tuples in distinct workers.
/// This tutorial illustrates the basics of how it's possible with ROOT to
Expand Down Expand Up @@ -30,7 +30,7 @@ void fillRandom(TNtuple &ntuple, TRandom3 &rndm, UInt_t n)
ntuple.Fill(rndm.Gaus());
}

Int_t mp101_fillNtuples()
Int_t mp_fillNtuples()
{

// No nuisance for batch execution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_tree
/// \notebook -js
/// Read n-tuples in distinct workers, fill histograms, merge them and fit.
/// We express parallelism with multiprocessing as it is done with multithreading
Expand All @@ -10,7 +10,7 @@
/// \date January 2016
/// \author Danilo Piparo

Int_t mp102_readNtuplesFillHistosAndFit()
Int_t mp_readNtuplesFillHistosAndFit()
{

// No nuisance for batch execution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_tree
/// \notebook
/// Fill the same TNtuple from different threads.
/// This tutorial illustrates the basics of how it's possible with ROOT
Expand All @@ -10,7 +10,7 @@
/// \date May 2017
/// \author Guilherme Amadio

void mt103_fillNtupleFromMultipleThreads()
void mt_fillNtupleFromMultipleThreads()
{
// Avoid unnecessary output
gROOT->SetBatch();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_tree
/// \notebook
/// Fill n-tuples in distinct workers.
/// This tutorial illustrates the basics of how it's possible with ROOT to
/// offload heavy operations on multiple threads and how it's possible to write
/// simultaneously multiple files. The operation performed in this case is the
/// creation of random gaussian numbers.
/// NOTE: this code can be executed in a macro, ACLiC'ed or not, but not yet at
/// the command line prompt.
///
/// \macro_code
///
Expand All @@ -32,7 +30,7 @@ void fillRandom(TNtuple &ntuple, TRandom3 &rndm, UInt_t n)
ntuple.Fill(rndm.Gaus());
}

Int_t mt101_fillNtuples()
Int_t mt_fillNtuples()
{

// No nuisance for batch execution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_tree
/// \notebook
/// Read n-tuples in distinct workers, fill histograms, merge them and fit.
/// Knowing that other facilities like TProcessExecutor might be more adequate for
Expand All @@ -13,7 +13,7 @@
/// \date January 2016
/// \author Danilo Piparo

Int_t mt102_readNtuplesFillHistosAndFit()
Int_t mt_readNtuplesFillHistosAndFit()
{

// No nuisance for batch execution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_tree
/// \notebook
/// Fill n-tuples in distinct workers.
/// This tutorial illustrates the basics of how it's possible with ROOT to
Expand Down Expand Up @@ -30,7 +30,7 @@ void fillRandom(TNtuple &ntuple, TRandom3 &rndm, UInt_t n)
ntuple.Fill(rndm.Gaus());
}

Int_t mtbb101_fillNtuples()
Int_t mtbb_fillNtuples()
{
// No nuisance for batch execution
gROOT->SetBatch();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_legacy
/// \notebook -nodraw
/// Illustrate the usage of the multiproc to process the H1 analysis
/// example.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_legacy
/// \notebook -nodraw
/// Lambdas used to check and fit the result of the H1 analysis.
/// Used by mp104_processH1.C, mp105_processEntryList.C and roottest/root/multicore/tProcessExecutorH1Test.C
/// Used by mp104_processH1.C and roottest/root/multicore/tProcessExecutorH1Test.cpp
///
/// \macro_code
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// \file
/// \ingroup tutorial_multicore
/// \ingroup tutorial_legacy
/// \notebook -js
/// Shows how to run items of work asynchronously with a TTaskGroup.
///
Expand Down
42 changes: 0 additions & 42 deletions tutorials/multicore/mp001_fillHistos.C

This file was deleted.

Loading

0 comments on commit 3b2a444

Please sign in to comment.