--- myst: substitutions: bloc1: python: 1-5,16-72 cpp: 9-56,62 bloc2: python: 52-55 cpp: 36-39 --- # Macro "**relauncherCodeFlowrateThreaded.{{extension}}**" ## Objective The goal of this macro is to show how to handle a code run on several threads. In order to this, the usual sequential runner will be removed and another runner will be called to do the job. The `flowrate` code is provided with {{uranie}} and has been also used and discussed throughout these macros. (use_cases_macro_relauncher_threaded_macro)= ## Macro {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/relauncher/use_cases/" + language + "/relauncherCodeFlowrateThreaded." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} The only difference when comparing this macro to the previous one (see [](#use_cases_macro_relauncher_sequential_macro)) is the runner creation: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/relauncher/use_cases/" + language + "/relauncherCodeFlowrateThreaded." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + "```" }} The `TSequentialRun` object becomes a `TThreadedRun` object whose construction request on top of the assessor, the number of threads to be used. Apart from that, the master is created and the rest is crystal clear, leading to the following plot. ## Graph {{ "```{" "figure" "} " + parent_dir + "/roottest/build/uranie/doc/relauncher/use_cases/" + language + "/threaded/relauncherCodeFlowrateThreaded.png\n" ":align: center\n" ":name: usecases_relauncherCodeFlowrateThreaded\n" + figure_scale + "\n" "\n" "Representation of the output as a function of the first input with a colZ option\n" "```" }}