TWiki> ArdaGrid Web>NSS2008DemoAndTutorial (revision 4)EditAttachPDF

Short Course NSS2008

Demo 1: compile and run a brachytherapy simulation locally

The objective is to understand the basics of a Geant 4 simulation application.

$ cd G4Brachy
$ source
$ gmake

$ ./workdir/bin/Linux-g++/Brachy macros/default.mac 1

$ show_hist brachytherapy.xml 20 30

Exercise 1: Running a Geant4 application: particle beam

Perform the following steps:
  • Compile the Geant4 particle beam example application. Solution:
         $ cd G4ParticleBeam
         $ source
         $ gmake
  • Execute the particle beam example using the macro file electronbeam.mac. The application simulates 5.5 MeV electrons impinging on a water box and computes the longitudinal energy deposition profile inside the box. By default 100 events are simulated. Solution:
         ./workdir/bin/Linux-g++/ParticleBeam macros/electronbeam.mac 1
  • The simulation program created an xml file (simoutput.xml) containing a histogram "energydeposit". Visualize the computed energy deposition profile by executing
         show_hist simoutput.xml energydeposit
  • Rerun the application with an increased number of events (3000) and visualize the output. Solution: Change in the macro file the following command:
         \run\beamOn 3000
    and execute again
         $ ./workdir/bin/Linux-g++/ParticleBeam macros/electronbeam.mac 1
         $ show_hist simoutput.xml energydeposit
  • As a next step change the incident angle of the beam to 60 deg and rerun the application. Visualize the results. Solution: Change in the macro file the following command:
         /source/incidentAngle 60.0 deg

Demo 2.1: Ganga Primer

The objective here is learn how Ganga works using very basic commands.

Create a small executable file (using editor or shell cat command):

$ cat > say_hello
#!/usr/bin/env bash
echo Hello $*
$ chmod u+x say_hello
$ ./say_hello XXX
Hello XXX

Submit jobs using ganga (interactively):

$ ganga 

j = Job()
j.application.args = ['DRESDEN']'Hello Dresden!'
print j

j2 = j.copy()

j2.application.args = ['GRID','AUS', 'DRESDEN!!!']'Hello Grid!'

Useful commands and options in the interactive shell:

# optionally select the CE, one of:


!ls -l $j.outputdir


Demo 2.1: Geant4 with Ganga

First create a small wrapper file which will source the environment and run the application. Use editor or cat command. The wrapper command assumes that both executable and are in the current working directory. This is where ganga puts them when the job starts.

$cd G4Brachy
$cat > run_brachy
#!/usr/bin/env bash
./Brachy $*
$ chmod u+x run_brachy

$ ganga

j = Job()
j.inputsandbox=[File('./workdir/bin/Linux-g++/Brachy'), File('./')]
j.application.args=[File('macros/default.mac'), '1']

j2 = j.copy()

if j.status == 'completed': 
 !show_hist $j.outputdir/brachytherapy.xml 20 30

Exercise 2.1: Particle Beam

To be defined.

Demo 2.2: Geant4 with Ganga (split jobs)

Objective: simulate more events using a fixed number of processors

Now the code gets more complex, so we will save it in a file and let ganga execute in one go.

$ cd G4Brachy
$ cat > submit_brachy

j = Job()
j.inputsandbox=[File('./workdir/bin/Linux-g++/Brachy'), File('./'), File('macros/default.mac')]

j.splitter = ArgSplitter()
for i in range(10):
  j.splitter.args.append(['default.mac', str(i)])



Now you may run all the commands in one go:

$ ganga submit_brachy

Start ganga in the interactive mode and have a look at the job - it should contain 10 subjobs:

$ ganga

j = jobs[-1]
print j

Exercise 2.2: Particle Beam

increase the statistics

Demo 3.0: Geant4 with Ganga + DIANE on the Grid

Objective: simulate more events using variable number of processors (up to specified number) and splitting job into many more smaller pieces.

The easiest way to understand what's going on is to start two windows.

Window 1: master

diane-run G4Brachy/macros/

Take note of the run directory.

Window 2: submission of jobs and visualisation

diane-env -d ganga --diane-worker-number=10 rundir/merged1D_brachytherapy.xml

Exercise 3.0: Particle Beam


-- JakubMoscicki - 17 Oct 2008

Edit | Attach | Watch | Print version | History: r8 | r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r4 - 2008-10-17 - AntonLechner
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    ArdaGrid All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback