Huge CPU Memory+Time Expense
OptiX Raytracing Pipeline
Analogous to OpenGL rasterization pipeline:
OptiX makes GPU ray tracing accessible
NVIDIA expertise:
https://developer.nvidia.com/rtx
User provides (Yellow):
[1] Turing+ GPUs eg NVIDIA TITAN RTX
NVIDIA OptiX 7 : Entirely new API
NVIDIA OptiX 7 Features
"managed by application" -> difficult development
More control/flexibility over everything.
Materials/Surfaces -> GPU Texture
Material/Surface/Scintillator properties
Material/surface boundary : 4 indices
Primitives labelled with unique boundary index
simple/fast properties + reemission wavelength
G4 Structure Tree -> Instance+Global Arrays -> OptiX
Group structure into repeated instances + global remainder:
instancing -> huge memory savings for JUNO PMTs
(Feb 2020) Workshop on Efficient Computing for HEP, Edinburgh
(May 2020) HSF (HEP Software Foundation) Meeting : GPUs in Simulations
(10+24 June 2020) HSF Meeting : R&D on accelerators in Simulations 3/9 talks discussed Opticks
(Aug 2020) HSF Publication : HL-LHC Computing Review: Common Tools and Community Software
(Sep 2020) Geant4 : R&D Task Force Meeting 3+ Geant4 teams pursuing GPUs, 1 based on Opticks
(Aug 2020) Shanghai SJTU : Next-gen Neutrino Telescope Simulation Workshop
(Aug 2020) Snowmass 2021 : Three LoI based on Opticks : Multi-expt Dark Matter group invited me to sign LoI
(Aug 2020) NERSC Users Group (NUG) meeting : LZ aiming to deploy Opticks on Perlmutter supercomputer
Email Group + Web Archive
https://groups.io/g/opticks
25 Members, 33 Topics
Year | 2018 | 2019 | 2020 |
New Members | 5 | 9 | 11 |
Plan for G4OpticksTest
(Nov 2020) HSF WLCG Virtual Workshop : https://indico.cern.ch/event/941278/timetable/#20201123.detailed
Worked closely with Hans for several years
Geant4 Bug 2305
https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2305
Five Geant4 releases are unusable:
Unfortunately it took me five releases to notice this showstopper
Any GDML using expt. with > 1 optical surface, should not use these five releases of Geant4.
Important to test ahead, checking lastest Geant4:
Geant4 Bug 2311
https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2311
Effected Geant4 releases: 1070+
bordersurface std::vector -> std::map API Change
Problem noticed in first release
Geant4 team seem willing to follow my suggestion that will avoid any lasting impact.
UOM : Plan 0.5 FTE over 12 months
details yet to be determined
SWIFT-HEP : Newly funded (1.5M GBP over 3 yrs)
University of Manchester (UOM), Adam Davis
(Jan 2021) SwiftHep/ExcaliburHep workshop presentation
Ben Morgan, University of Warwick + Geant4
LHCb Opticks Users
Several LHCb members are using Opticks
(June 2020) HSF (HEP Software Foundation) Meeting
(Aug 2020) Shanghai SJTU : Next-gen Neutrino Telescope Simulation Workshop
(Aug 2020) NERSC Users Group (NUG) meeting : LZ aiming to deploy Opticks on Perlmutter supercomputer
Opportunity for Expert Assistance
(8 Jan 2021) Zoom Introduction Meeting of >12 people : LZ/NERSC(6), NVIDIA(5), Opticks(1)
Prepared Opticks codebase orientation for developers
From February 8:
Adapt Opticks to all new NVIDIA OptiX 7 API
ε, ε [θ, φ] -> GPU Tex
Separate Textures for each sensor type
Culling result photon flags set on GPU:
Testing angular efficiency GPU texture machinery
https://simoncblyth.bitbucket.io/opticks/optixrap/tests/OSensorLibGeoTest.cc.html
https://bitbucket.org/simoncblyth/opticks/src/master/notes/progress.rst
void G4Opticks::getHit(unsigned i, G4OpticksHit* hit, G4OpticksHitExtra* hit_extra ) const
G4OpticksHit + G4OpticksHitExtra
struct G4OpticksHit // from photon->hit buffers { // global+local,... all from (4,4) photon item G4ThreeVector local_position ; G4ThreeVector global_position ; G4double time ; G4ThreeVector local_direction ; G4ThreeVector global_direction ; G4double weight ; G4ThreeVector local_polarization ; G4ThreeVector global_polarization ; G4double wavelength ; G4int boundary ; G4int sensorIndex ; G4int nodeIndex ; G4int photonIndex ; G4int flag_mask ; G4int sensor_identifier ; G4bool is_cerenkov ; G4bool is_reemission ; }; struct G4OpticksHitExtra // from way->hiy buffers { // extras from (2,4) "way" item G4ThreeVector boundary_pos ; G4double boundary_time ; G4double origin_time ; G4int origin_trackID ; };
Geant4 approach
// Simulation/DetSimV2/PMTSim/src/junoSD_PMT_v2.cc junoHit_PMT* hit = new junoHit_PMT(); // junoSD_PMT_v2::ProcessHits hit->SetPMTID(pmtid); hit->SetWeight(1.0); hit->SetTime(hittime); hit->SetWavelength(wavelength); hit->SetKineticEnergy(edep); hit->SetPosition(local_pos); hit->SetTheta(local_pos.theta()); hit->SetPhi(local_pos.phi()); hit->SetMomentum(local_dir); hit->SetPolarization(local_pol); hit->SetGlobalPosition(global_pos); hit->SetGlobalMomentum(track->GetMomentum()); hit->SetGlobalPolarization(track->GetPolarization()); // optional extras normally from NormalTrackInfo/NormalAnaMgr hit->SetProducerID(producerID); hit->SetFromCerenkov(is_from_cerenkov); hit->SetReemission(is_reemission); hit->SetOriginalOP(is_original_op); hit->SetOriginalOPStartT(t_start); hit->SetBoundaryPosition(boundary_pos); // pAcrylic/pInnerWater[1]
[1] set in NormalTrackInfo by NormalAnaMgr::UserSteppingAction
cluster level optimizations
Opticks Server + many Clients
Prototype : Network Transport of NP Arrays
For example with N = 4
Experimentation required to find optimum
Flexibility -> maximizes resource usage -> solves problems:
Distributed compute advantage
Currently (only on GPU nodes):
Instead : split CPU and GPU compute
On any CPU node:
On GPU cluster:
splitting -> drastic leap in flexibility
General compute server structure:
Exploration phase: find/evaluate open source basis projects
Plan ? too early to set timeline
computing student/postdoc/.. welcome to assist
[1] OKOP package : no Geant4, OpenGL : (Opticks structured as tree of ~20 packages according to external dependencies, only the four highest level packages depend on Geant4)
0.1.0 : "Basic Validation" Release : Enabling Statistical hit comparison : Estimate : During February | |
---|---|
Completed: | Remaining: |
|
|
students/postdocs with Geant4 geometry experience can assist with "Basic Validation" distribution comparison |
0.2.0 : "Full Validation" Release : Enabling Random Aligned step-by-step comparison : Estimate March-April | |
---|---|
Completed: | Remaining: |
|
|
students/postdocs with NumPy + Geant4 geometry experience can assist with "Full Validation" step-by-step comparison |
Next Steps
Opticks : state-of-the-art GPU ray traced optical simulation integrated with Geant4. Now integrated with JUNO Offline Pioneer users welcome
- Opticks gained many new users in 2020, some getting serious
- JUNO Opticks users are needed to assist with validation
https://bitbucket.org/simoncblyth/opticks | code repository |
https://github.com/simoncblyth/opticks/releases | .zip .tar.gz archives |
https://simoncblyth.bitbucket.io | presentations and videos |
https://groups.io/g/opticks | forum/mailing list archive |
email:opticks+subscribe@groups.io | subscribe to mailing list |
Opticks Build Generalized
Builds against CMAKE_PREFIX_PATH
opticks-config (pkg-config .pc file based)
releases on github : latest v0.1.0-rc2
https://github.com/simoncblyth/opticks/releases/tag/v0.1.0-rc2
Add Opticks to an existing installation (SVN trunk r3990+):
bash junoenv libs all opticks
Four mandatory envvars :
export CMTEXTRATAGS=opticks # -> Opticks ON in JunoENV + CMT export OPTICKS_COMPUTE_CAPABILITY=70 # -> nvcc flags export OPTICKS_CUDA_PREFIX=/usr/local/cuda-10.1 export OPTICKS_OPTIX_PREFIX=/usr/local/OptiX_650 # location of CUDA and OptiX installs
Build all JUNO externals, including Opticks (takes ~1hr, 13G) :
jlibs(){ mkdir -p $JUNOTOP && cd $JUNOTOP svn co https://juno.ihep.ac.cn/svn/offline/trunk/installation/junoenv && cd $JUNOTOP/junoenv local libs=$(bash junoenv libs list | perl -ne 'm, (\S*)@, && print "$1\n"' -) for lib in $libs ; do bash junoenv libs all $lib || return 1 done }
Offline Opticks : #ifdef WITH_G4OPTICKS ... #endif + if(m_opticksMode > 0){ ... }
cd $JUNOTOP/offline/Simulation/DetSimV2 ; find . -type f -exec grep -l WITH_G4OPTICKS {} \+ ./DetSimOptions/src/DetSim0Svc.cc ## initialize/finalize ./DetSimOptions/src/LSExpDetectorConstruction.cc ## translate geometry to GPU ./PhysiSim/src/DsG4Scintillation.cc ## collect Scintillation gensteps, excluding reemission ./PhysiSim/src/LocalG4Cerenkov1042.cc ## collect Cerenkov gensteps ./PhysiSim/src/DsPhysConsOptical.cc ## use LocalG4Cerenkov1042 rather than G4Cerenkov ./PMTSim/src/PMTSDMgr.cc ## setup separate PMTHitMerger m_pmthitmerger_opticks ./PMTSim/src/junoSD_PMT_v2.cc ## bulk hit creation+collection at EndOfEvent
tut_detsim.py options relevant to Opticks usage : TODO: user friendly Opticks control interface
tds : Example Bash Function :
tds-(){ python $JUNOTOP/offline/Examples/Tutorial/share/tut_detsim.py $* ; } tds(){ tds- --opticks-mode 1 --no-guide_tube --pmt20inch-polycone-neck --evtmax 2 gun ; }
Why Avoid Torus ?
Double heavy quartic root finding
Alternative Approaches To Cope With Torus
tut_detsim.py options (in SVN trunk r3990)
"cylinder - torus" -> polycone
simpler+faster CSG, same geometry