Skip to content

Commit

Permalink
Fix the MadGraph5 LO multithread utility (10_6_X)
Browse files Browse the repository at this point in the history
Backport cms-sw#34437 to 10_6_X
  • Loading branch information
colizz committed Jul 16, 2021
1 parent 0637fb2 commit 8d3c8fe
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Expand Up @@ -131,6 +131,27 @@ EOF
def launch(self, nb_event, seed):
EOF
fi

# fix another "readonly" mode issue related to proper handle of the integration grid,
# as identified in: https://answers.launchpad.net/mg5amcnlo/+question/696856
# this is fixed since 2.9.4 and 3.1.1, so we add a patch if MG is lower then these versions
if [[ ( ${MGVersion[0]} -eq 2 ) && ( ${MGVersion[1]} -lt 9 || ( ${MGVersion[1]} -eq 9 && ${MGVersion[2]} -le 3 ) ) ]] || \
[[ ( ${MGVersion[0]} -eq 3 ) && ( ${MGVersion[1]} -lt 1 || ( ${MGVersion[1]} -eq 1 && ${MGVersion[2]} -le 0 ) ) ]]; then
patch process/madevent/bin/internal/gen_ximprove.py << EOF
=== modified file 'madgraph/interface/gen_ximprove.py'
--- madgraph/interface/gen_ximprove.py
+++ madgraph/interface/gen_ximprove.py
@@ -1903,5 +1903,8 @@ class gen_ximprove_gridpack(gen_ximprove_v4):
'packet': None,
}
+ if self.readonly:
+ basedir = pjoin(os.path.dirname(__file__), '..','..','SubProcesses', info['P_dir'], info['directory'])
+ info['base_directory'] = basedir
jobs.append(info)
EOF
fi

# fix another multi-thread related bug for MG 2.6.1 only
if [[ ${MGVersion[1]} -eq 6 && ${MGVersion[2]} -eq 1 ]]; then
Expand Down
Expand Up @@ -45,7 +45,7 @@
@@ -98,1 +134,1 @@
- ./run.sh $submitting_event $run_random_seed
+ ../process/run.sh $submitting_event $run_random_seed
@@ -124,3 +160,53 @@
@@ -124,3 +160,58 @@
+cd $LHEWORKDIR
+
+} ### end of function
Expand All @@ -68,6 +68,11 @@
+
+ cd $LHEWORKDIR
+
+ # first do restore_data from the gridpack (necessary for the readonly mode)
+ cd process/madevent
+ ./bin/internal/restore_data default
+ cd ../..
+
+ # make the gridpack directory read-only to enable the multi-threading feature
+ if fs listacl &>/dev/null; then
+ fs sa -dir process/madevent -acl ${USER} read
Expand All @@ -90,7 +95,7 @@
+ cd process
+
+ # merge files produced in different threads
+ cp /cvmfs/cms.cern.ch/phys_generator/gridpacks/lhe_merger/merge.pl ./
+ curl -s -L -o merge.pl https://raw.githubusercontent.com/cms-sw/genproductions/master/bin/MadGraph5_aMCatNLO/Utilities/merge.pl
+ chmod 755 merge.pl
+ ./merge.pl ../thread*/events.lhe.gz events.lhe.gz banner.txt
+ rm -r ../thread* banner.txt;
Expand Down

0 comments on commit 8d3c8fe

Please sign in to comment.