source: trunk/examples/extended/parallel/info/NEW_APP_INSTALL@ 807

Last change on this file since 807 was 807, checked in by garnier, 17 years ago

update

File size: 8.0 KB
Line 
1$Id: NEW_APP_INSTALL,v 1.2 2002/03/09 08:07:55 cooperma Exp $
2------------------------------------------------------------------------------
3These are instructions for parallelizing a new application. Before
4doing so, try out the examples, ParN02 and ParN04, which have
5parallelized examples/novice/N02 and examples/novice/N04.
6These instructions are written relative to ParN02, but also see
7ParN04 for a more extended example of marshaling hits.
8
9TO INSTALL:
10
111. Install Geant4, CLHEP, and TOP-C
12 To ensure compatibility, use same compiler for all three.
13 (Currently, Geant4 recommends GNU g++ version 2.91.66 or 2.95.2 or higher.
14 Try `g++ --version' to check.)
15 TOP-C: http://www.ccs.neu.edu/home/gene/topc.html
16 Geant4: http://cern.ch/geant4/source/source.html
17 CLHEP: http://wwwinfo.cern.ch/asd/lhc++/DISTRIBUTION/hep.html
18
192. Source in the standard Geant4 and CLHEP environment variables.
20 Environment variables are described in the Geant4 Installation Guide from:
21 http://cern.ch/geant4/G4UsersDocuments/Overview/html
22
233. Use same compiler for TOP-C as recommended for Geant4. (currently GNU
24 g++ version 2.91.66 or 2.95.2 or higher are recommended)
25 (Try g++ --version to check)
26 Make sure that topc-config is in your path. (Try `which topc-config')
27 Test that TOP-C is working. (cd to TOP-C install dir and `make test')
28 Also test that a standard Geant4 application (such as novice/N02) works.
29
304. For clarity, we assume we are parallelizing novice/N02 from the Geant4
31 distribution. The instructions should work for most Geant4 applications.
32 First, copy the following files:
33 cp ParExample.icc ParGNUmakefile procgroup $G4INSTALL/example/novice/N02/
34 cp Par*.cc $G4INSTALL/example/novice/N02/src/
35 cp Par*.hh $G4INSTALL/example/novice/N02/include/
36
375. Change to the N02 directory:
38 cd $G4INSTALL/example/novice/N02/
39
406. Modify GNUmakefile by adding a line at the beginning:
41 include ParGNUmakefile
42
43 Modify exampleN02.cc by adding a line just before the definition of main():
44 [IMPORTANT: This must be the last include file in exampleN02.cc]
45 #include "ParTopC.icc"
46
477. Optionally modify include/ParRandomState.hh
48 If this is your first installation, I recommend using the provided default.
49 This arranges to generate a random seed on the master for
50 each event, and copy it to the slave processing that event.
51 The seed is a pseudorandom one explicitly depending on the event number.
52 This provides both reasonable efficiency and repeatability
53 that is independent of the number of slave process and of the
54 order in which slaves complete their tasks.
55
568. Modify src/ParExN02MarshaledHits.cc according to the comments in that file.
57 You will find examples of the required modification both in ParN02
58 and in ParN04/src/ParExN04MarshaledHits.cc. ParN04 illustrates a
59 larger variety of marshaled hits, but read those in ParN02 first,
60 in order to understand the principles.
61
62 The modifications are required to implement marshaling of each type of hit
63 (e.g. for N04: ExN04TrackerHit, ExN04MuonHit, ExN04CalorimeterHit)
64
65 You will need to modify the functions:
66 MarshaledHCofThisEvent::MarshalHitsCollection
67 MarshaledHCofThisEvent::UnmarshalSlaveHitsCollection
68 in order to add additional cases in the `if ... else if ...' statement.
69 You should also remove the existing case of ExN02TrackerHit
70 if you are not parallelizing examples/novice/N02.
71
72 There are already default template functions for each type of hit, T:
73 TMarshaledHitsCollection<T>::UnmarshalHit
74 TMarshaledHitsCollection<T>::MarshalHit
75 where T is a G4VHit class such as ExN02TrackerHit.
76 The default copies the entire class into a single buffer. If your
77 hit class includes pointers, and if you use those pointer in your
78 analysis (AnalyzeEvent), then you will need to override the default
79 with an explicit specialization that marshals the pointers.
80 You may also wish to override the default in order to write
81 more efficient marshaling code.
82
839. The file `procgroup' determines on which machines the remote processes run.
84 The makefile automatically copies the local procgroup to the G4BINDIR just
85 before each run.
86 For testing, you can use the provided file, as is, and it will set
87 up two slave processes on the localhost. For production runs, you
88 will want to change it. See the file procgroup for comments on
89 ways to change it. Note that the default procgroup redirects standard
90 output on the slave (within an event) into a file slave00X.out .
91 Without this, the output of the slaves and the master would be
92 displayed intermixed on the user console.
93
9410. Before you compile, make sure your Geant4 environment variables point to
95 where you want. This is important because your application binary
96 must be in a location visible to all the computers running your
97 parallel application. But your Geant4 source and libraries may have
98 to stay on a different partition, where you have more disk space.
99
100 For example, in my case, I was using source from $G4INSTALL,
101 but I was building my application binary and libraries elsewhere.
102 I had: setenv $4SYSTEM Linux-g++
103 I wanted to build my application libraries in: ~/geant4-cern/lib/Linux-g++
104 So, I did: setenv G4WORKDIR ~/geant4-cern
105 I also made sure that ~/geant4-cern/bin/Linux-g++ existed, since the
106 default for the application binary was $G4WORKDIR/bin/$G4SYSTEM .
107 Because I copied the precompiled Geant4 libraries
108 into ~/geant4-cern/lib-geant4/Linux-g++
109 I also needed to tell Geant4 about this non-standard location
110 via: setenv G4LIB ~/geant4-cern/lib-geant4
111 For more information, see:
112 http://cern.ch/geant4/G4UsersDocuments/UsersGuides/ (cont.)
113 InstallationGuide/html/UnixMachines/unixMachines.html
114
115 As always, if you are using shared libaries (.so) under Linux, you may
116 have to update your LD_LIBRARY_PATH . Since you will be running
117 a parallel application, put this in your shell initialization file
118 (in my case, in ~.tcshrc), so it will also be availabe for the remote
119 processes that are generated.
120 I use the original Geant4 libraries (lib-gent4), the application
121 libraries (lib), and the CLHEP library. So, I do:
122 setenv LD_LIBRARY_PATH \
123 ${LD_LIBRARY_PATH}:$HOME/geant4-cern/geant4.4.0/lib-geant4/Linux-g++
124 setenv LD_LIBRARY_PATH \
125 ${LD_LIBRARY_PATH}:$HOME/geant4-cern/geant4.4.0/lib/Linux-g++
126 setenv LD_LIBRARY_PATH \
127 ${LD_LIBRARY_PATH}:/afs/cern.ch/sw/lhcxx/specific/redhat61/CLHEP/1.7.0.0/lib
128
129
13011. Modify ParGNUmakefile according to your goals.
131 It may be enough to only change:
132 MACROFILE (current default: ParN02.in)
133 If you have a datafile (e.g.: examples/novice/N04/pythia_main.data)
134 then also set DATAFILE.
135 The GNUmakefile copies the MACROFILE and DATAFILE to the G4BINDIR.
136 If you require other files (e.g.: pythia_event.data for ExN04), then
137 copy them to the G4BINDIR manually or modify ParGNUmakefile to do so.
138 Then choose your desired makefile target and go. Try one of:
139 make compile
140 make run
141 make run-debug [Runs application inside gdb.]
142 make parclean
143
144============================================================================
145Further possible customizations:
146
147If you wish to customize your code further, note that ParGNUmakefile
148contains TOP-C parameters. Try other parameters such as:
149 --TOPC-verbose=0
150 --TOPC-trace=0
151 --TOPC-slave-timeout=XXX [ units are seconds, default 1800 seconds ]
152 --TOPC-num-slaves=XXX
153 --TOPC-help
154
155If you wish to make some of these the default, add a line like:
156 TOPC_OPT_trace = 0;
157between `main( ... )' and `TOPC_init( ... )' in the main function.
158
159Read the TOP-C manual, available from the home page
160 http://www.ccs.neu.edu/home/gene/topc.html
161for further customizations and uses of TOP-C.
162
163Read ParMarshaledObj.hh for the full set of primitive marshaling functions
164that you might want to use in writing MarshalHit() and UnmarshalHit().
Note: See TracBrowser for help on using the repository browser.