160 likes | 175 Views
Learn how to seamlessly run Geant4 applications on the GRID using DIANE, enabling distributed computing and fine-tuning for efficient simulation execution. Explore step-by-step processes and tools for monitoring, implementation, and debugging.
E N D
How to run a Geant4 application on the GRID http://cern.ch/geant4
Contents • Requirements • Software tools • Geant4 application design • Geant4 application implementation • How to run on the GRID
Requirements • Same application code for sequential and parallel execution • Transparent execution in sequential/parallel mode • Transparent execution on a PC farm and on the Grid • Monitor the progress of the simulation execution • Traceability of failed tasks for debugging purposes
Software tools Execution in distributed computing Monte Carlo simulation Analysis DIANE Abstract Interfaces for Data Analysis www.cern.ch/geant4 www.cern.ch/diane Physicist Interface (PI) aida.freehep.org lcg-pi.web.cern.ch/lcg-pi/ Component-based architecture software tools
Hide complex details of underlying technology prototypefor an intermediate layer between applications and the GRID http://cern.ch/DIANE Developed by J. Moscicki, CERN/IT DIANE • R&D project • started in 2001 in CERN/IT with very limited resources • collaboration with Geant4 groups at CERN, INFN, ESA • succesful prototypes running on LSF and EDG Master-Worker architectural pattern Parallel cluster processing • make fine tuning and customisation easy • transparently using GRID technology • application independent By J. Moscicki (CERN)
Application design Generic Geant4 application design • Transparent execution of the simulation • In sequential mode • In parallel mode Steering the simulation execution in the DIANE framework Initialize () ExecuteMacro () Finish () SetSeed() Encapsulate the essential actions to execute a simulation Initialize, Concrete class derived from IG4Simulation
Implementation Example: geant4/examples/extended/parallel/ExDiane Derived from the Brachytherapy advanced example www.ge.infn.it/geant4/examples/index.html
Main #include “BrachySimulation.hh” Int main(int argc, char** argv) { BrachySimulation* simulation = new BrachySimulation(0); simulation -> initialize(argc, argv); If (argc > 1) mn = argv[1]; simulation -> executeMacro(mn); simulation -> finish(); delete simulation; return 0; }
BrachySimulation inherits from DIANE::IG4Simulation BrachySimulation.cc BrachySimulation::BrachySimulation(G4int seed) {…} BrachySimulation::~BrachySimulation() {} void BrachySimulation::setSeed(G4int sd) // Set the seed interactively { seed = sd; HepRandom::setTheSeed(seed); } G4bool BrachySimulation::initialize(int, char**) {…. runManager = new G4RunManager; runManager -> SetUserInitialization(detectorConstruction); runManager -> SetUserInitialization(physicsList); runManager -> SetUserAction(primaryParticles); …… runManager -> Initialize(); } void BrachySimulation::executeMacro(G4String fileName) { … } // Execution of the macro file void BrachySimulation::finish() {delete runManager;} DIANE::IG4Simulation* createG4Simulation(int seed) // This is all the application needs to run through DIANE {return new BrachySimulation(seed);} No other code changes
Task 1 Task 2 Task n Practical Example • Example: simulation with analysis • The job is divided into tasks • The tasks are executed on worker components • Each task produces a file with histograms • Job result = sum of histograms produced by tasks • Master-worker model • Client starts a job • Workers perform tasks and produce histograms • Master integrates the results Start the execution Result Result 1 Result n
Application = “G4Analysis” WorkerInitData = { ‘G4ApplicationcomponentName’ : “G4Brachy” ‘InitMacroFile’ : “”” /control/verbose 1 /run/verbose 1 /event/verbose 1 /run/initialize “”” } JobInitData = { ‘runParams’ : { ‘seed’ : 0, // Initial seed ‘eventNumber’ = 100000 // Total number of events of the job ‘macroFileTemplate’ : “/run/beamOn ”}, ‘eventsPerWorker’ : 10000 // The job is subdivided in 10 tasks ‘workerInit’ : WorkerInitData } Example of a macro
Running on the GRID Master • DIANE is installed • Source the environment of DIANE • cd G4Myapplication • eval `diane.app.setup –e csh` • Execute the job: • diane.startjob –j macroFileName –w workers@LCG • –wms LCG_SITES_LIST --ganga Name of the macro file Result n Result 1 Number of workers List of the sites • Workers on the GRID • Geant4, AIDA and PI are preinstalled • DIANE and G4Brachy are downloaded from the web • DIANE and G4Brachy are installed • The tasks are executed The results of the tasks (analysis objects) are sent back to the Master
Execution on the GRID through DIANE, 20 M events,180 tasks, 30 workers Worker number diane.plotprofile ID_job Time (seconds) Example of results On the Master • diane.workspace/jobs/ID_job • Contains the results of the simulation – analysis objects • profile.job contains the monitoring of the execution of the tasks
Documentation Documentation on DIANE • http://www.cern.ch/diane • Installing and compiling DIANE • Compiling and running a Geant4 application through DIANE