Skip to content

Commit 9a126e1

Browse files
jolly-chenmartamaja10
authored andcommitted
[tutorials][doc] Improve parallel analysis docs
- Create a new Parallel subtopic in the analysis tutorials - Fixed comments in the parallel analysis tutorial files
1 parent a654759 commit 9a126e1

File tree

9 files changed

+53
-31
lines changed

9 files changed

+53
-31
lines changed

tutorials/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ if(NOT ROOT_imt_FOUND)
259259
endif()
260260
if(MSVC)
261261
#---Multiproc is not supported on Windows
262-
set(imt_veto ${imt_veto} analysis/mp*.C io/tree/mp*.C legacy/multicore/mp*.C multicore/mp*.C ./analysis/mtbb_parallelHistoFill.C)
262+
set(imt_veto ${imt_veto} analysis/mp*.C io/tree/mp*.C legacy/multicore/mp*.C multicore/mp*.C ./analysis/parallel/mtbb_parallelHistoFill.C)
263263
#---XRootD is not supported on Windows
264264
set(imt_veto ${imt_veto} io/tree/imt_parTreeProcessing.C)
265265
endif()
@@ -622,7 +622,7 @@ endif()
622622
#--List long-running tutorials to label them as "longtest"
623623
set (long_running
624624
analysis/dataframe/df10[2-7]*
625-
analysis/mp_processSelector.C)
625+
analysis/parallel/mp_processSelector.C)
626626
file(GLOB long_running RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${long_running})
627627
#--List multithreaded tutorials to run them serially
628628
set(NProcessors 4)
@@ -632,7 +632,7 @@ set (multithreaded_all_cores
632632
)
633633
set (multithreaded
634634
${multithreaded_all_cores}
635-
analysis/mp_processSelector.C
635+
analysis/parallel/mp_processSelector.C
636636
machine_learning/TMVAMulticlass.C
637637
machine_learning/TMVA_CNN_Classification.C
638638
machine_learning/TMVA_Higgs_Classification.C

tutorials/analysis/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@
88

99
\defgroup tutorial_unfold TUnfold tutorials
1010
\ingroup tutorial_analysis
11-
\brief Test programs for the classes TUnfold and related
11+
\brief Test programs for the classes TUnfold and related
12+
13+
\defgroup tutorial_analysis_parallel Parallel analysis tutorials
14+
\ingroup tutorial_analysis
15+
\brief These examples show data analyses with explicit multithreading and multiprocessing
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
\addtogroup tutorial_analysis_parallel
2+
3+
@{
4+
5+
When using [RDataFrame](classROOT_1_1RDataFrame.html), implicit multithreading can be enabled by simply calling
6+
`ROOT::EnableImplicitMT()`.
7+
8+
| **Tutorial** ||| **Description** |
9+
|------------------------|------------------------|--------------------------|---------------------------------------------------------- |
10+
| *Multiprocessing* | *Multithreading* || |
11+
| mp_parallelHistoFill.C | mt_parallelHistoFill.C | mtbb_parallelHistoFill.C | Fill histograms in parallel |
12+
| | mt_fillHistos.C | mtbb_fillHistos.C | Fill histograms in parallel and write them on file |
13+
| mp_processSelector.C | | | Usage of TTreeProcessorMP and TSelector with h1analysis.C |
14+
------------------------------------------------------------------------------------------------------------------------------------------
15+
@}

tutorials/analysis/mp_parallelHistoFill.C renamed to tutorials/analysis/parallel/mp_parallelHistoFill.C

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/// \file
2-
/// \ingroup tutorial_analysis
2+
/// \ingroup tutorial_analysis_parallel
33
/// \notebook -js
4-
/// Parallel fill of a histogram
5-
/// This tutorial shows how a histogram can be filled in parallel
6-
/// with a multiprocess approach.
4+
/// Fill histogram in parallel with a multiprocessing approach
5+
/// using TProcessExecutor and TExecutor::MapReduce.
76
///
87
/// \macro_image
98
/// \macro_code

tutorials/analysis/mp_processSelector.C renamed to tutorials/analysis/parallel/mp_processSelector.C

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/// \file
2-
/// \ingroup tutorial_analysis
2+
/// \ingroup tutorial_analysis_parallel
33
/// \notebook -nodraw
4-
/// Illustrate the usage of the multiproc TSelector interfaces with the h1 analysis
5-
/// example.
4+
/// Illustrate the usage of the multiprocessing TTreeProcessorMP
5+
/// and TSelector interfaces with the h1analysis.C example.
66
///
77
/// \macro_code
88
///

tutorials/analysis/mt_fillHistos.C renamed to tutorials/analysis/parallel/mt_fillHistos.C

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
/// \file
2-
/// \ingroup tutorial_analysis
2+
/// \ingroup tutorial_analysis_parallel
33
/// \notebook
4-
/// Fill histograms in parallel and write them on file.
5-
/// The simplest meaningful possible example which shows ROOT thread awareness.
4+
/// Fill histograms in parallel and write them on file
5+
/// with a multithreaded approach using std::thread.
6+
/// This is the simplest meaningful example which shows
7+
/// ROOT thread awareness.
68
///
79
/// \macro_code
810
///

tutorials/analysis/mt_parallelHistoFill.C renamed to tutorials/analysis/parallel/mt_parallelHistoFill.C

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
/// \file
2-
/// \ingroup tutorial_analysis
2+
/// \ingroup tutorial_analysis_parallel
33
/// \notebook
4-
/// Parallel fill of a histogram.
5-
/// This tutorial shows how a histogram can be filled in parallel
6-
/// with a multithreaded approach. The difference with the multiprocess case,
7-
/// see mp201, is that here we cannot count on the copy-on-write mechanism, but
8-
/// we rather need to protect the histogram resource with a TThreadedObject
9-
/// class. The result of the filling is monitored with the *SnapshotMerge*
10-
/// method. This method is not thread safe: in presence of ROOT histograms, the
11-
/// system will not crash but the result is not uniquely defined.
4+
/// Fill histogram in parallel with a multithreaded approach
5+
/// using TThreadedObject and TThreadedObject::SnapshotMerge.
6+
///
7+
/// The difference with the multiprocessing case,
8+
/// see mp_parallelHistoFill, is that we cannot count on
9+
/// the copy-on-write mechanism here. Instead, we need to protect
10+
/// the histogram resource with a TThreadedObject class.
11+
/// The result of the filling is monitored with the *SnapshotMerge*
12+
/// method. This method is not thread safe: in the presence of
13+
/// ROOT histograms, the system will not crash but the result
14+
/// is not uniquely defined.
1215
///
1316
/// \macro_image
1417
/// \macro_code

tutorials/analysis/mtbb_fillHistos.C renamed to tutorials/analysis/parallel/mtbb_fillHistos.C

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/// \file
2-
/// \ingroup tutorial_analysis
2+
/// \ingroup tutorial_analysis_parallel
33
/// \notebook
4-
/// Fill histograms in parallel and write them on file.
5-
/// This example expresses the parallelism of the mt001_fillHistos.C tutorial
6-
/// with multiprocessing techniques.
4+
/// Fill histograms in parallel and write them on file
5+
/// with a multithreaded approach using
6+
/// TThreadExecutor and TExecutor::Map.
77
///
88
/// \macro_code
99
///

tutorials/analysis/mtbb_parallelHistoFill.C renamed to tutorials/analysis/parallel/mtbb_parallelHistoFill.C

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/// \file
2-
/// \ingroup tutorial_analysis
3-
/// Parallel fill of a histogram.
4-
/// This tutorial shows how a histogram can be filled in parallel
5-
/// with a multiprocess approach.
2+
/// \ingroup tutorial_analysis_parallel
3+
/// Fill histogram in parallel with a multithreaded approach
4+
/// using TThreadExecutor and TExecutor::MapReduce.
65
///
76
/// \macro_image
87
/// \macro_code

0 commit comments

Comments
 (0)