Step 7
Is your pion analysis running smoothly on your laptop? If yes, then it is time to 'scale things up' a bit. We will run your task on the Grid.
The macro
runAnalysis.C
that you used in the previous exercises already contains all the information that you need for running on the Grid. In fact, all that you have to do is open it, and make a minor change at the start of the macro
void runAnalysis()
{
// set if you want to run the analysis locally (kTRUE), or on grid (kFALSE)
Bool_t local = kFALSE;
// if you run on grid, specify test mode (kTRUE) or full grid model (kFALSE)
Bool_t gridTest = kTRUE;
Note that we will first test if our code is actually 'grid compatible', by simulating a Grid node on our computer. Before you launch this test, browse through the runAnalysis.C macro and try to convince yourself of the fact that you understand the logic, and whether or not the configuration makes sense.
Running a Grid test
AliEn-ROOT-Legacy tokens
In case you are using AliEn-ROOT-Legacy, for instance with ROOT5, then you should first create an access token using command alien-token-init.
If you think everything is OK, and run the Grid test by simply launching the runAnalysis macro
aliroot runAnalysis.C
You will notice that the running time for the task is now probably a bit longer, as we have to wait for data to be retrieved. Does your analysis run fine? If it exits without problems, make sure to check your histograms and see if the output is as you expected it to be !
Launching your job on Grid
If the Grid test was successful, you can launch your analysis on Grid. Set the flag ’gridTest’ in your macro to kFALSE,
void runAnalysis()
{
// set if you want to run the analysis locally (kTRUE), or on grid (kFALSE)
Bool_t local = kFALSE;
// if you run on grid, specify test mode (kTRUE) or full grid model (kFALSE)
Bool_t gridTest = kFALSE;
and relaunch your analysis.
Monitoring your jobs
Once you have submitted your job to Grid, you can track the progress at https://alimonitor.cern.ch/users/jobs.jsp. You will need your digital certificate to get access to the job pages!
Merging your job's output
Once your jobs are all in done, it is time to merge the output files that were generated on the independent Grid nodes into one output file that is on your laptop. We will do this in two stages
- Merge all the output files that were generated by one masterjob into one output file that is still stored on the Grid
- Merge these 'master' output files into one output file on your laptop.
Note that, since we only launched one masterjob, these two steps may seem a bit silly here. However, if you launch multiple masterjobs, this approach is very useful.
Merging: step 1
To perform step 1 of the merging, open the runAnalysis.C macro again, and change the argument of SetRunMode() into terminate
alienHandler->SetRunMode("terminate")
after you have made this change, you have to launch your job again. The job that you are now launching is a merging job: an instruction send to the grid nodes to combine the independent AnalysisResults.root files of sub-jobs into one merged file per master-job.
Just as with a normal job, you can monitor the progress of the merging job via https://alimonitor.cern.ch/users/jobs.jsp.
Merging: step 2
Once the merging job is finished, you will need to retrieve the final output on your laptop. One more change to your runAnalysis.C macro needs to be made. Open the file, and set
alienHandler->SetMergeViaJDL(kFALSE);
Then, launch the macro again. If all goes well, it should proceed to merge the output of the merging jobs into one final output file on your laptop.
Happy analyzing !