3 | | = OSG & VPB Build Environment in Linux as Step-By-Step Tutorial = |
| 3 | = How to Setup OSG & VPB Build Environment in Linux as Step-By-Step Tutorial = |
| 4 | |
| 5 | |
| 6 | |
| 7 | = Tutorial how build OSG on Linux and render a OSG !VirtualPlanetBuilder database clustered = |
| 8 | |
| 9 | Basically it is possible to render virtualPlanetBuilder Databases on MS Windows and Linux. Unfortunately MS Windows is not stable enough, maybe caused by NTFS and the heavy systemload (RAM, CPU, HDD). |
| 10 | To render large databases, it is absolutely necessary to use VPB on linux. |
| 11 | |
| 12 | |
| 13 | = System installation and basic preparation == |
| 14 | |
| 15 | * Install Kubuntu 9.10 64 bit (64 bit is important to prevent your system to crash due to some ressource limits) |
| 16 | * Activate proprietary video driver: Menu -> system -> driver. --> reboot |
| 17 | * Link shell to desktop |
| 18 | * install basic packages |
| 19 | <code> |
| 20 | aptitude update |
| 21 | aptitude install vim |
| 22 | </code> |
| 23 | |
| 24 | === Setup Raid, if nessecary === |
| 25 | * Install package: |
| 26 | <code> |
| 27 | aptitude install dmraid |
| 28 | </code> |
| 29 | * Read in existing Windows or Linux raids and activate them |
| 30 | <code> |
| 31 | dmraid -r |
| 32 | dmraid -ay -v |
| 33 | </code> |
| 34 | * Add raids an windows Drives to fstab |
| 35 | <code> |
| 36 | mkdir /mnt/disk1 |
| 37 | mkdir /mnt/disk2 |
| 38 | |
| 39 | vim /etc/fstab |
| 40 | |
| 41 | dev/mapper/isw_befejdgeeb_Volume01 /mnt/disk2 auto defaults 0 0 |
| 42 | /dev/sda2 /mnt/disk1 auto defaults 0 0 |
| 43 | </code> |
| 44 | lookup the devicename in /dev/mapper after the last dmraid command |
| 45 | |
| 46 | |
| 47 | |
| 48 | === [Optional] Using Synergy to control the whole cluster with only one keyboard and mouse === |
| 49 | * Install synergy |
| 50 | <code> |
| 51 | aptitude install synergy quicksynergy |
| 52 | </code> |
| 53 | |
| 54 | howto: http://www.mattcutts.com/blog/how-to-configure-synergy-in-six-steps/ |
| 55 | |
| 56 | |
| 57 | == Compile and install OSG and its dependencies == |
| 58 | |
| 59 | * Install osg-dependencies and osg like http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/Debian-Dependencies |
| 60 | Use this updated list which is adapted for kubuntu 9.10: |
| 61 | <code> |
| 62 | aptitude update |
| 63 | aptitude install cmake subversion g++ libx11-dev nvidia-glx-185-dev libglu-dev |
| 64 | aptitude install libpng-dev libjpeg-dev libtiff-dev libfreetype6-dev libgdal-dev gdal-bin |
| 65 | aptitude install libcurl4-dev dcmtk libdcmtk1-dev libgtk2.0-dev libxul-dev libpoppler-glib-dev |
| 66 | aptitude install libvncserver-dev librsvg2-dev libsdl-dev libxml2-dev |
| 67 | aptitude install xxdiff dos2unix libboost-regex doxygen graphviz subversion-tools |
| 68 | |
| 69 | </code> |
| 70 | To use the new introduced resume function, yu must use at least OSG 2.9.5 with VPB 0.9.11 |
| 71 | Basically: VPB versions are bound to special OSG versions. (like 0.9.10 is bound to osg 2.8.2) |
| 72 | |
| 73 | * Compile OSG 2.9.5 |
| 74 | <code> |
| 75 | cd /tmp |
| 76 | svn co http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-2.9.5 OpenSceneGraph |
| 77 | cd OpenSceneGraph |
| 78 | ./configure |
| 79 | make -j 8 |
| 80 | make install |
| 81 | cd .. |
| 82 | </code> |
| 83 | |
| 84 | * ... or Compile newest OSG from SVN |
| 85 | <code> |
| 86 | cd /tmp |
| 87 | svn co http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk OpenSceneGraph |
| 88 | cd OpenSceneGraph |
| 89 | ./configure |
| 90 | make -j 8 |
| 91 | make install |
| 92 | cd .. |
| 93 | </code> |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | * Add OSG environment variables to make all osg binaries callable via interactive shell: |
| 99 | <code> |
| 100 | vim /home/fsd/.bash_profile |
| 101 | export PATH=$PATH:/home/fsd/OpenSceneGraph/bin |
| 102 | export OSG_FILE_PATH=/home/fsd/sampledata/:/home/fsd/sampledata/Images |
| 103 | |
| 104 | vim /etc/bash.bashrc |
| 105 | export LD_LIBRARY_PATH=/home/fsd/OpenSceneGraph/lib/:/home/fsd/VirtualPlanetBuilder/lib/ |
| 106 | </code> |
| 107 | reboot to load changes and allow VPB compiling. |
| 108 | |
| 109 | |
| 110 | * Compile VPB 0.9.11: |
| 111 | <code> |
| 112 | svn checkout http://www.openscenegraph.org/svn/VirtualPlanetBuilder/tags/VirtualPlanetBuilder-0.9.11/ VirtualPlanetBuilder |
| 113 | cd VirtualPlanetBuilder |
| 114 | ./configure |
| 115 | make -j 8 |
| 116 | make install |
| 117 | </code> |
| 118 | |
| 119 | * or Compile newest VPB from SVN: |
| 120 | <code> |
| 121 | svn checkout http://www.openscenegraph.org/svn/VirtualPlanetBuilder/trunk VirtualPlanetBuilder |
| 122 | cd VirtualPlanetBuilder |
| 123 | ./configure |
| 124 | make -j 8 |
| 125 | make install |
| 126 | </code> |
| 127 | |
| 128 | * Download Sampledata : |
| 129 | <code> |
| 130 | svn co http://www.openscenegraph.org/svn/osg/OpenSceneGraph-Data/tags/OpenSceneGraph-Data-2.8.0 sampledata |
| 131 | </code> |
| 132 | |
| 133 | * Configure ressource limits |
| 134 | <code> |
| 135 | sudo vim /etc/security/limits.conf |
| 136 | |
| 137 | # End of file |
| 138 | fsd soft nofile 65353 |
| 139 | fsd hard nofile 65353 |
| 140 | </code> |
| 141 | |
| 142 | |
| 143 | |
| 144 | == Cluster preparation == |
| 145 | |
| 146 | |
| 147 | === Requirements for successful use of the cluster === |
| 148 | |
| 149 | * Source data must be available on all nodes under the identical path (best solution: local source data on each node located at the same path) |
| 150 | * Destination folder must be shared over any network file system and must be available on all nodes under the identical path. Easiest solution: sshfs) |
| 151 | * Compile-script must be called from the destination directory (because all tasks contain the "run-path", this must be accessible by the executing node -> "run-path" must be the shared destination folder). |
| 152 | |
| 153 | To fulfill this requirements, let's assume this setup: |
| 154 | * One node acts as server node and has the IP 192.168.0.55 |
| 155 | * Two nodes act as client nodes and have the IPs 192.168.0.54 and 192.168.0.56 |
| 156 | * sshfs is used as network filesystem |
| 157 | * the username on all nodes is fsd |
| 158 | * The destination folder for the compiled database is {{/geodata}} |
| 159 | * The local drive with geo source data is {{/localSourceData}} |
| 160 | |
| 161 | |
| 162 | To use vpbmaster clustered, all maschines must have access to the server node. |
| 163 | Open a fresh shell and typ in as standart user (NOT root!): |
| 164 | <code> |
| 165 | ssh-keygen -t rsa |
| 166 | <if asked for passphrase: Press enter for no passphrase - otherwise the login would not be passwordless :)> |
| 167 | |
| 168 | ssh-copy-id -i .ssh/id_rsa.pub fsd@192.168.0.55 |
| 169 | </code> |
| 170 | |
| 171 | Because remote ssh commands do not invoke the environment settings of an interactive shell, ssh must be prepared to provide the required environment variables also for ssh non-interactive-shell: |
| 172 | {{vim /etc/ssh/sshd_config}} |
| 173 | <code> |
| 174 | PermitUserEnvironment yes |
| 175 | |
| 176 | vim /home/fsd/.ssh/environment |
| 177 | LD_LIBRARY_PATH=/home/fsd/OpenSceneGraph/lib/:/home/fsd/VirtualPlanetBuilder/lib/ |
| 178 | OSG_FILE_PATH=/home/fsd/sampledata/:/home/fsd/sampledata/Images |
| 179 | </code> |
| 180 | |
| 181 | To share over network the destination folder to write the database in, install sshfs: |
| 182 | <code> |
| 183 | aptitude install sshfs |
| 184 | </code> |
| 185 | |
| 186 | Create Folder for the local source data and shared destination data |
| 187 | <code> |
| 188 | mkdir /mnt/disk3 # for source data |
| 189 | mkdir /geodata # for destination data, shared over sshfs |
| 190 | </code> |
| 191 | |
| 192 | |
| 193 | |
| 194 | == Use Cluster == |
| 195 | |
| 196 | === Preparation after boot of all clients === |
| 197 | * mount at the @@+++ server node @@ the destination harddrive into the appropriate folder: |
| 198 | <code> |
| 199 | mount /dev/sde1 /geodata |
| 200 | </code> |
| 201 | * mount on @@+++ all client nodes @@ the destination directory of the server node over sshfs. |
| 202 | Let's assume the server has the IP 192.168.0.56: |
| 203 | <code> |
| 204 | sshfs fsd@192.168.0.56:/geodata /geodata |
| 205 | <enter password of the server node> |
| 206 | </code> |
| 207 | |
| 208 | |
| 209 | === Create the compile script === |
| 210 | |
| 211 | To allow easy recalls of the database build command, create a script: |
| 212 | {{vim /etc/geodata/compile_BRD_Sued.sh}}: |
| 213 | {{{ |
| 214 | #!/bin/sh |
| 215 | |
| 216 | vpbmaster --machines machinepool.txt\ |
| 217 | --geocentric\ |
| 218 | --terrain\ |
| 219 | --compressed\ |
| 220 | -d /localSourceData/srtm-V4.2-europa\ |
| 221 | -t /localSourceData/Muenchen_25cm\ |
| 222 | -t /localSourceData/geocontent/Deutschland_1m/Sued\ |
| 223 | -t /localSourceData/bluemarble\ |
| 224 | -o /geoData/BRD1m_MUC0.25m_srtmEU_BM/terrain.ive |
| 225 | }}} |
| 226 | |
| 227 | |
| 228 | === Compile Database === |
| 229 | |
| 230 | If everything is setup correctly, the processing step ist very easy. Open an new shell on the server node and call as standard user (NOT ROOT!): |
| 231 | <code> |
| 232 | cd /geodata |
| 233 | ./compile_BRD_SUED.sh |
| 234 | </code> |
| 235 | |
| 236 | While the database is creating, it is possible to watch the actual progress in another console. Because files are written and modified, the viewer application will give warnings or will terminate in few cases. This happens due to the creation progress and does not affect or modify the database, please ignore it. |
| 237 | After finished creation, this should not happen, of course ;) |
| 238 | |
| 239 | Because system load during database creation is very high, on some systems the operation system or the compile process crash. |
| 240 | If these crashes happens at the beginning of the rendering process, please check if your "openfile" limits are set correctly |
| 241 | |
| 242 | |
| 243 | === Resume compiling database after crash === |
| 244 | |
| 245 | See http://www.openscenegraph.org/projects/VirtualPlanetBuilder/wiki/Resume |
| 246 | |
| 247 | To resume the crashed compile process, execute on the server node: |
| 248 | <code> |
| 249 | cd /geodata |
| 250 | vpbmaster --machines machinepool.txt --tasks build_master.tasks |
| 251 | </code> |
| 252 | |
| 253 | Take care @@+++ NOT @@ to call the compile script again, in this case all compiled tasks will be resetted to status "pending" |
| 254 | |
| 255 | |
| 256 | |
| 257 | == Source data aquisition == |
| 258 | |
| 259 | The following source data could be used: |
| 260 | * Digital Elevation Data |
| 261 | * Free global elevation data with 3 arcs resolution: SRTM data (NASA) |
| 262 | * Free local high resolution elevation models: DEM data (www.viewfinderpanoramas.org) |
| 263 | * Textures/Orthophotos |
| 264 | * Free global low resolution texture data : Bluemarble Next Generation (NASA) |
| 265 | * Free local low/medium resolution texture data: Landsat (NASA) |
| 266 | * Commercial global medium/high resolution texture data: Landsat (atlogis.com, ...) |
| 267 | * Commercial high resolution national texture data: e.g. Germany (Geocontent), USA (USGS), ... |
| 268 | |
| 269 | |
| 270 | === SRTM-Data === |
| 271 | |
| 272 | SRTM data with 3 arcs are available for free at |
| 273 | * http://www.csi.cgiar.org/index.asp (american server, very slow) |
| 274 | * ftp://xftp.jrc.it/pub/srtmV4/ (european mirror, very fast) |
| 275 | |
| 276 | Local high resolution DEM data (mainly based on SRTM) |
| 277 | * http://www.viewfinderpanoramas.org/dem3.html |
| 278 | |
| 279 | Tip: |
| 280 | Because SRTM data is delivery in many small .zip or tar.gz files, download and unpack it automatically: |
| 281 | <code> |
| 282 | wget -r ftp://xftp.jrc.it/pub/srtmV4/tiff/ |
| 283 | for zipfile in *.zip;do unzip -o "$zipfile" -d unpacked; done |
| 284 | </code> |
| 285 | |
| 286 | |
| 287 | === US texture data === |
| 288 | |
| 289 | Local High and global resolution Texture and DEM data |
| 290 | * http://edcsns17.cr.usgs.gov/EarthExplorer/ |
| 291 | * http://glovis.usgs.com |
| 292 | |
| 293 | To use LANDSAT arial images, read https://zulu.ssc.nasa.gov/mesid/tutorial/LandsatTutorial-V1.html for introduction. LANDSAT datasets are deliverey with up to seven images, each representing a different sensor with different wavelength. Three of this files (sensors for RGB) must be combined for the raw "natural" image. |
| 294 | |
| 295 | The image merging is possible with gdal_merge.py (available in FWTools): |
| 296 | <code> |
| 297 | gdal_merge.py -o outfile.tif R_sensor.tif G_sensor.tif B_sensor.tif |
| 298 | </code> |
| 299 | |
| 300 | === National high resolution data === |
| 301 | |
| 302 | National high resolution data is available from many companies. Germany: !GeoContent |
| 303 | |
| 304 | |
| 305 | == compress Data === |
| 306 | |
| 307 | To shift system load from HDD to CPU, compress all textures lossless with LZW. This will increase rendering time a lot, because usually the HDD ist the bottleneck. |
| 308 | {{{ |
| 309 | gdal_translate -co "COMPRESS=LZW" unsw ToDo |
| 310 | }}} |
| 311 | |
| 312 | === Moon Data === |
| 313 | |
| 314 | To animate earth rising above moon horizon, it could be usefull to model the moon. |
| 315 | |
| 316 | http://lunar.arc.nasa.gov/dataviz/datamaps/index.html |
| 317 | |
| 318 | == Troubleshooting == |
| 319 | |
| 320 | If compiling fails at the beginning: |
| 321 | * reboot |
| 322 | * Please check if you use a 64 bit operating system |
| 323 | * check your limits: {{limits -a}} |
| 324 | |
| 325 | If compiling fails after many hours or days: |
| 326 | * Maybe your OS runs out of any ressource, so reboot and resume (read above) |
| 327 | * Check your hardware if resuming do not help. |
| 328 | |
| 329 | If only local threads are executed, but no remote ones: |
| 330 | * Check your ssh setup, if you can login passwordless from the server node to the client nodes |
| 331 | * Check your ssh setup, if your environmental variables on the client nodes are available if you login to a client node |