Is there a way to tell MG/ME where to write temp files/folders?

Asked by Terry Pilkington

Hi,
 I am trying to use MG/ME to automatically calculate the branching ratios for a large number of points in the parameter space of my models (~11k points). The script (pasted below) works, but has two related problems that I'm hoping you have some advice on.

= Script ====================================================================

#$ -S /bin/sh
workingdir=/data/data035/tpilking/brcalc_n6_000
procdir=$workingdir/proc_n6
cp $workingdir/me5_configuration.txt $procdir/Cards/me5_configuration.txt
for filename in $workingdir/paramcards/*.dat
do
        rm -v $procdir/RunWeb
        rm -rvf $procdir/Events/*
        rm -v $procdir/Cards/pythia_card*.dat
        rm -v $procdir/Cards/pgs_card*.dat
        rm -v $procdir/Cards/delphes_card*.dat

        echo "**** Processing: $filename ****"
        cp $filename $procdir/Cards/param_card.dat
        $procdir/bin/generate_events -f

        echo "**** Writing: $filename ****"
        cp $procdir/Cards/param_card.dat $filename
done

= End script =================================================================

The param_cards all have "auto" set as their width, and the process being run is just "p p > t t~" with all options set as default. In testing, the script runs without issue. It's only once I try to run multiple copies of the script (each in a separate directory) with a large number of param_cards.

The first problem is that when I run the script by submitting through qsub, the temporary files required to do the BR calculations get created in my home directory (in folders called tmpXXXX where the XXXX is a random identifier), which causes slowdowns for the mail server of the department. This is not ideal. If I run multiple copies of the script, then the folders quickly start to pile up.

The other problem is that the temporary folders do not seem to be deleted after each iteration of the loop, only after the script has terminated. This means that I would end up with up to ~11k temporary folders in my home directory, slowing down the mail server and taking up far too much space.

My question is then: is there a way to specify where these temporary files are written? Ideally, I would like to set it the same as $workingdir in the script above. If there is no way to fix the "not deleting until script is finished" part, then at least I could add a line at the end of the loop saying "rm -r $workingdir/tmp*".

Thanks in advance for any help,
Terry

Question information

Language:
English Edit question
Status:
Answered
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Dear Terry,

Let me first stress that this is very dangerous to remove by hand the RunWeb file blindly.

The way MadGraph works is that he is suppose to do the submission for you. None of your script are designed to be part of a qsub or anything of this kind.
So the first question that I have is how do you ask madgraph to run? Do you run it in mode cluster? in mode multicore? or in single-core?
I guess that in the first two case you might have problem with your sys-admin.

> the temporary files required to do the BR calculations get created in my home directory

The temporary files are created in the local directory.
if you start your script by cd /tmp
then those directory will be created in /tmp (of the local node)

Otherwise, you can change the path where those directory are created at line 6453 of madgraph/madgraph_interface.py

        # Do the MadEvent integration!!
        with misc.TMP_directory(dir=os.getcwd()) as path:

This structure should remove automatically the created directory (even in case of crash) as soon as you quit the “with" block.
If this is not the case, you should see a warning in the log (after three attempt to remove the directory).

Cheers,

Olivier

On 15 Apr 2015, at 18:06, Terry Pilkington <email address hidden> wrote:

> New question #265259 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/265259
>
> Hi,
> I am trying to use MG/ME to automatically calculate the branching ratios for a large number of points in the parameter space of my models (~11k points). The script (pasted below) works, but has two related problems that I'm hoping you have some advice on.
>
> = Script ====================================================================
>
> #$ -S /bin/sh
> workingdir=/data/data035/tpilking/brcalc_n6_000
> procdir=$workingdir/proc_n6
> cp $workingdir/me5_configuration.txt $procdir/Cards/me5_configuration.txt
> for filename in $workingdir/paramcards/*.dat
> do
> rm -v $procdir/RunWeb
> rm -rvf $procdir/Events/*
> rm -v $procdir/Cards/pythia_card*.dat
> rm -v $procdir/Cards/pgs_card*.dat
> rm -v $procdir/Cards/delphes_card*.dat
>
> echo "**** Processing: $filename ****"
> cp $filename $procdir/Cards/param_card.dat
> $procdir/bin/generate_events -f
>
> echo "**** Writing: $filename ****"
> cp $procdir/Cards/param_card.dat $filename
> done
>
> = End script =================================================================
>
> The param_cards all have "auto" set as their width, and the process being run is just "p p > t t~" with all options set as default. In testing, the script runs without issue. It's only once I try to run multiple copies of the script (each in a separate directory) with a large number of param_cards.
>
> The first problem is that when I run the script by submitting through qsub, the temporary files required to do the BR calculations get created in my home directory (in folders called tmpXXXX where the XXXX is a random identifier), which causes slowdowns for the mail server of the department. This is not ideal. If I run multiple copies of the script, then the folders quickly start to pile up.
>
> The other problem is that the temporary folders do not seem to be deleted after each iteration of the loop, only after the script has terminated. This means that I would end up with up to ~11k temporary folders in my home directory, slowing down the mail server and taking up far too much space.
>
> My question is then: is there a way to specify where these temporary files are written? Ideally, I would like to set it the same as $workingdir in the script above. If there is no way to fix the "not deleting until script is finished" part, then at least I could add a line at the end of the loop saying "rm -r $workingdir/tmp*".
>
> Thanks in advance for any help,
> Terry
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Can you help with this problem?

Provide an answer of your own, or ask Terry Pilkington for more information if necessary.

To post a message you must log in.