Repository navigation
Reuse same instances in hybrid generator - #15983
jackal1-66 wants to merge 3 commits into
Conversation
99baa59 to
41ee248
Compare
|
Thanks @jackal1-66. This is a good step forward and should work fine. However, the reuse is implicit, which can be dangerous: it relies on two serialised configs matching exactly, so {
"mode": "sequential",
"generators": [
{ "name": "pythia8", "label": "mb",
"config": { "config": "$O2_ROOT/share/Generators/egconfig/pythia8_inel.cfg" } },
{ "cocktail": [
{ "ref": "mb" },
{ "name": "external",
"config": { "fileName": "${O2DPG_ROOT}/MC/config/PWGDQ/external/generator/GeneratorParamPromptJpsiToElectronEvtGen_pp13TeV.C",
"funcName": "GeneratorParamPromptJpsiToElectronEvtGen_pp13TeV()" } } ] }
],
"fractions": [3, 1]
}A whole cocktail can be labelled and referenced in the same way: "generators": [
{ "label": "jpsi", "cocktail": [ { "ref": "mb" }, { "name": "external", "config": { ... } } ] },
{ "ref": "mb" },
{ "ref": "jpsi" }
],
"fractions": [1, 3, 1]
I would recommend that a referenced entry reports the sub-generator ID of the entry it points to. I can propose an implementation on top of your branch, together with a small tool in O2DPG next to |
|
This PR did not have any update in the last 30 days. Is it still needed? Unless further action in will be closed in 5 days. |
Following the review, reuse becomes explicit: a generator or a whole cocktail is
named with "label" and reused by a later {"ref": "<label>"} entry. reuseIdenticalGenerators is
dropped and nothing changes for the existing configurations.
Descriptions are registered per entry so that every ID has one.
run/SimExamples/Hybrid_reuse shows the syntax and the resulting IDs.
|
Ciao @sawenzel, I followed the label/ref design as proposed, but in the end I had to change something: since a reference now points at the same generator instead of cloning a slot, mGroups already maps each entry of the list to the generators serving it, so mSlotToInstance in the end became redundant and I removed it. The instance queues are still filled from the references as you suggested, and the constructor and Init() are left untouched (with the only exception of the sub-generator description registration). I had to test it thoroughly because I was hitting a series of problems with some configurations, so I hope nothing more is left. I tried to make the example as complete as possible. In addition I found few small bugs while working on this that I will fix in different PRs. |
Launch single instances of generators which share the same exact configuration. This reduces configuration times and reduces memory usage as well. This is enabled by default, but it is configurable with a new parameter. In addition it is disabled by default when more than a single worker is set (per user decision)