Warning, /eic-opticks/CSGOptiX/index.rst is written in an unsupported language. File is not indexed.
0001 CSGOptiX : expt with OptiX 7 geometry and rendering
0002 ======================================================
0003
0004
0005 TODO
0006 -----
0007
0008 * cxr paths need to have the digest in them
0009 * cxs paths need to keep the digest at pub stage
0010
0011
0012 3D render scripts (most using the OptiX 7 CSG,CSGOptiX machinery, a few using pre7 OpSnapTest,OptiXRap)
0013 --------------------------------------------------------------------------------------------------------
0014
0015 cxr.sh
0016 script that runs the CSGOptiXRenderTest executable
0017 this is a basis script that most of the below scripts invoke after setting controlling envvars
0018
0019 [not intended to be used bare, this script is invoked from other scripts]
0020
0021 cxr_min.sh
0022 minimal variant using CSGOptixRdrTest executable which just invokes CSGOptiX::RenderMain
0023 [tested Jun 2023]
0024
0025 cxr_overview.sh
0026 overview viewpoint by targeting the entire geomery
0027 uses envvar MOI=-1 to set an overview viewpoint intended to see the entire geometry
0028 principal controls are EMM envvar for excluding/selecting solids
0029
0030 CSGFoundry::parseMOI/CSGName::parseMOI parses MOI string eg sWorld:0:0 into three integers:
0031 (export CSGName=INFO to see whats happening)
0032
0033 Midx
0034 mesh index (equivalent for Geant4 LV index or Solid index, selecting a shape)
0035 mOrd
0036 mesh ordinal (when more than one such mesh in geometry this is used to select one of them)
0037 Iidx
0038 instance index
0039
0040 [tested Jun 2023]
0041
0042 cxr_scan.sh
0043 runs one of the other scripts (default cxr_overview.sh) multiple times with different values
0044 for the EMM envvar which is picked up by the basis cxr.sh script and fed to the executable
0045 via the "-e" option which is short for --enabledmergedmesh which feeds into a bitset
0046 queryable by Opticks::isEnabledMergedMesh
0047
0048 [tested Jun 2023]
0049
0050 cxr_table.sh
0051 rst table creation using snap.py
0052
0053 one of the input arguments is a glob pattern that identifies a set of .jpg renders
0054 which are expected to have .json metadata sidecars
0055
0056 the data for the table is collected from .json metadata sidecars to .jpg renders,
0057 so this works on laptop after grabbing the rendered .jpg and .json sidecars
0058
0059 [tested Dec 2021]
0060
0061 cxr_solid.sh
0062 single solid render, for example ./cxr_solid.sh r0@
0063 NB here solid is in the CSGSolid sense which corresponds to a GMergedMesh
0064
0065 The SLA envvar set by the script is passed into the executable via option --solid_label
0066 which is accessed from Opticks::getSolidLabel within CSGOptiX/tests/CSGOptiXRender.cc
0067 which uses CSGFoundry::findSolidIdx to select one or more solids based on the solid_label
0068
0069 [tested Dec 2021]
0070
0071 cxr_solids.sh
0072 multiple invokations of cxr_solid.sh for different solids,
0073 currently using seq 0 9 for running all JUNO solids::
0074
0075 ./cxr_solid.sh r0@
0076 ./cxr_solid.sh r1@
0077 ...
0078
0079 [tested Dec 2021]
0080
0081 cxr_view.sh
0082 sets MOI viewpoint (sWaterTube) deep within geometry and invokes ./cxr.sh
0083
0084 [tested Jun 2023]
0085
0086 cxr_views.sh
0087 multiple invokations of cxr_view.sh varying EMM to change included geometry
0088
0089 [tested Dec 2021]
0090
0091
0092
0093 cxr_flight.sh
0094 creates sequence of jpg snaps and puts them together into mp4
0095
0096 TODO: compare with ../bin/flight7.sh AND MERGE OR REMOVE ONE
0097
0098 ../bin/flight7.sh
0099
0100 looks to be an update to flight.sh but using the OptiX 7 executable CSGOptiXFlight
0101
0102 TODO: this is setting CFBASE, that is no longer the way to pick standard geometry
0103
0104 ../bin/flight.sh
0105
0106 PRE 7 RENDERING
0107
0108 flight-render-jpg
0109 uses single OpFlightPathTest executable invokation with --flightconfig option
0110 to create potentially many .jpg snaps into --flightoutdir
0111
0112 flight-make-mp4
0113 uses ffmpeg to create .mp4 from the .jpg
0114
0115
0116 ../docs/misc/making_flightpath_raytrace_movies.rst
0117
0118 PRE 7 NOTES
0119
0120 OpSnapTest --savegparts
0121
0122 using python machinery to inspect geometry :
0123
0124 TODO: update with instructions for 7
0125
0126
0127
0128
0129
0130
0131 cxr_demo.sh
0132 renders Demo CSGFoundry geometry created by::
0133
0134 cd ~/CSG # c
0135 ./CSGDemoTest.sh
0136
0137 [tested Dec 2021]
0138
0139 cxr_demos.sh
0140 perl grabs all geometry names from ../CSG/CSGDemoTest.sh
0141 and then runs cxr_demo.sh on every one of them
0142
0143
0144 cxr_geochain.sh
0145 renders geometry created by the GeoChain executable that can be
0146 anything from a single node to an entire detector geometry
0147
0148 This geometry is identified by CFNAME which cxr.sh uses
0149 for form an override CFBASE envvar /tmp/$USER/opticks/${CFNAME}
0150
0151
0152
0153
0154
0155 cxr_pub.sh
0156 pub.py promotes from SRC_BASE=/tmp/$USER/opticks/CSGOptiX/CSGOptiXRender into presentation repo
0157
0158 cxr_rsync.sh
0159 SUSPECT HAVE REPLACED USE OF THIS WITH THE MORE CONTROLLABLE pub.py APPROACH see cxr_pub.sh
0160
0161
0162
0163 2D render scripts
0164 -------------------------
0165
0166 cxs.sh [run/ana/]
0167
0168 Two modes:
0169
0170 *run*
0171 (default mode on Linux)
0172 invokes CSGOptiXSimulateTest executable
0173 *ana*
0174 (default mode on Darwin, does not work remotely due to matplotlib/pyvista graphics)
0175 invokes tests/CSGOptiXSimulateTest.py script
0176 which uses matplotlib and/or pyvista to create mostly 2D geometry
0177 plots of the positions of intersects onto geometry
0178
0179 The *run* and *ana* are often invoked on different machines after *cxs_grab.sh* has
0180 been used to get the .npy results of *run* onto the local machine.
0181
0182
0183 cxs_grab.sh
0184 rsyncs from OPTICKS_KEYDIR_GRABBED/CSG_GGeo into local geocache dirs
0185
0186 cxsd.sh
0187 runs cxs.sh with GDB envvar defined to switch on lldb OR gdb debugger
0188
0189 cxs_pub.sh
0190 pub.py promotes from the below SRC_BASE into presentation repo::
0191
0192 $HOME/$opticks_keydir_grabbed/CSG_GGeo/CSGOptiXSimulateTest
0193
0194 Shell commands are emitted to stdout that copy images around.
0195 Also s5 text is generated for copy/pasting into presentations::
0196
0197 ./cxs_pub.sh cp | grep uni_acrylic | sh
0198 ./cxs_pub.sh s5 | grep uni_acrylic
0199
0200
0201
0202 admin scripts relevant to both cxs and cxr
0203 ----------------------------------------------
0204
0205 grab.sh
0206 rsync .jpg .png .mp4 .json etc.. outputs from P:/tmp/blyth/opticks/CSGOptiX/ to local (eg laptop)::
0207
0208 cx
0209 ./grab.sh
0210
0211 sync.sh
0212 sync PWD code to top level remote in directory of same name
0213 RSYNC : USE CAREFULLY
0214
0215 cf.sh
0216 find commands for manually comparison of renders
0217
0218
0219
0220
0221
0222 Census
0223 -------
0224
0225 ===================== ==================== ================= ============================
0226 commandline A:Darwin/OptiX 5 B:Linux/OptiX 6 C:Linux/OptiX 7
0227 ===================== ==================== ================= ============================
0228 CSGOptiXRender fail 1 fail 2 OR hang OK : long view, no detail
0229 CSGOptiXSimulate OK
0230 ./cxr_overview.sh OK fail 1 OK
0231 ./cxr_view.sh fail 1 hang OK : PMTs, no struts
0232 ./cxr_solid.sh fail 1 hang OK
0233 ./cxr.sh
0234 ===================== ==================== ================= ============================
0235
0236
0237 A
0238 build: cx ; om
0239 B
0240 build: cx ; om
0241 rsync: cx ; ./grab.sh
0242 C
0243 build: cx ; ./build7.sh
0244 rsync: cx ; ./grab.sh
0245
0246
0247
0248
0249
0250
0251
0252
0253 CSGOptiXSimulate
0254 -----------------
0255
0256 * requires OPTICKS_KEYDIR envvar (+OPTICKS_KEY?) pointing to a recent geocache with LS_ori material
0257
0258
0259 scratch workflow
0260 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0261
0262 CSGOptiX::prepareSimulateParam
0263
0264 1. upload gensteps
0265 2. create seeds from the gensteps (QSeed)
0266 3. set gensteps, seeds, photons refs in Params
0267
0268
0269 4. optix7 launch
0270 5. download photons
0271
0272
0273
0274
0275
0276
0277
0278
0279 Failure Modes
0280 ----------------
0281
0282 1::
0283
0284 2021-08-20 10:47:27.933 INFO [1880522] [CSGOptiX::render@287] [
0285 2021-08-20 10:47:27.933 INFO [1880522] [Six::launch@437] [ params.width 1920 params.height 1080
0286 libc++abi.dylib: terminating with uncaught exception of type optix::Exception: Unknown error (Details: Function "RTresult _rtContextLaunch2D(RTcontext, unsigned int, RTsize, RTsize)" caught exception: Encountered a CUDA error: cudaDriver().CuMemcpyDtoHAsync( dstHost, srcDevice, byteCount, hStream.get() ) returned (700): Illegal address)
0287 Abort trap: 6
0288 epsilon:CSGOptiX blyth$
0289
0290
0291 2::
0292
0293 2021-08-20 19:21:37.525 INFO [269834] [Six::createContextBuffer@99] node_buffer 0x7f7445a26c00
0294 terminate called after throwing an instance of 'optix::Exception'
0295 what(): Invalid value (Details: Function "RTresult _rtBufferSetDevicePointer(RTbuffer, int, void*)" caught exception: Setting buffer device pointers for devices on which OptiX isn't being run is disallowed.)
0296 Aborted (core dumped)
0297
0298
0299
0300
0301 code
0302 -------
0303
0304 tests/CSGOptiXRender.cc
0305 main that loads and uploads CSGFoundry geometry and creates
0306 one or more renders and saves them to jpg
0307
0308 CSGOptiX.h
0309 top level struct using either OptiX pre-7 OR 7
0310 holds PIP and SBT instances which handle the
0311 OptiX geometry
0312
0313 Params.h
0314 workhorse for communicating between CPU and GPU
0315
0316 Frame.h
0317 render pixels holder
0318
0319 BI.h
0320 wrapper for OptixBuildInput
0321 AS.h
0322 common acceleration structure base struct for GAS and IAS
0323 GAS.h
0324 bis vector of BI build inputs
0325 IAS.h
0326 vector of transforms and d_instances
0327
0328 GAS_Builder.h
0329 building OptiX geometry acceleration structure,
0330 canonical usage from SBT::createGAS
0331
0332 IAS_Builder.h
0333 building OptiX instance acceleration structure,
0334 canonical usage from SBT::createIAS
0335
0336 Binding.h
0337 GPU/CPU types, including SbtRecord : RaygenData, MissData, HitGroupData (effectively Prim)
0338
0339 PIP.h
0340 OptiX render pipeline creation from ptx file
0341
0342 CSGOptiX7.cu
0343 compiled into ptx that gets loaded by PIP to create the GPU pipeline, with OptiX 7 entry points::
0344
0345 __raygen__rg
0346 __miss__ms
0347 __intersection__is
0348 __closesthit__ch
0349
0350 SBT.h
0351 brings together OptiX 7 geometry and render pipeline programs, nexus of control
0352
0353 * SBT::setFoundry SBT::createGeom converts the CSGFoundy geometry into an OptiX geometry
0354
0355 Ctx.h
0356 holder of OptixDeviceContext and Params and Properties instances
0357
0358 Properties.h
0359 holder of information gleaned from OptiX 7
0360
0361 InstanceId.h
0362 encode/decode identity info
0363
0364 OPTIX_CHECK.h
0365 error check macro for optix 7 calls
0366
0367 Six.h
0368 optix pre-7 rendering of CSGFoundary geometry
0369
0370 OptiX6Test.cu geo_OptiX6Test.cu
0371 compiled into ptx that gets loaded by Six to create OptiX < 7 pipeline
0372
0373
0374