status of the unified solids library gabriele cosmo/cern tatiana nikitina/cern

18
STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

Upload: brice-wells

Post on 21-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

STATUS OF THE UNIFIED SOLIDS LIBRARYGabriele Cosmo/CERN

Tatiana Nikitina/CERN

Page 2: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

2

Motivations for a common solids library

• Optimize and guarantee better long-term maintenance of ROOT and Geant4 solids libraries

• Create a single high quality library to replace solid libraries in Geant4 and ROOT

• Starting from what exists today in Geant4 and ROOT• Adopt a single type for each shape• Significantly optimize (Multi-Union, Tessellated Solid, Polyhedra,

Polycone)• Reach complete conformance to GDML solids schema

• Create extensive testing suite

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 3: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

3

Solids implemented so far• Box• Orb• Trapezoid• Sphere (+ sphere section)• Tube (+ cylindrical section) • Cone (+ conical section) • Generic trapezoid• Tetrahedron• Arbitrary Trapezoid (ongoing)• Multi-Union• Tessellated Solid• Polycone• Polyhedra• Extruded solid (ongoing)

0

500

1000

0

500

1000

200

400

600

800

1000

-10-5

05x 10

4 -5

0

5

x 104

-6

-4

-2

0

2

4

6

x 104

-4000-3000

-2000-1000

01000

20003000

4000

-4000

-3000

-2000

-1000

0

1000

2000

3000

4000

-1000

0

1000

-1000

-500

0

500

1000

-1000

-500

0

500

1000-1000

-500

0

500

1000

-1000

-500

0

500

1000

-1000

-500

0

500

1000-1000

-500

0

500

1000

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 4: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

Polycone

Page 5: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

5

New Ordinary Polycone• Special optimization for common cases, where Z

sections can only increase (big majority of real cases)• New implementation based on composition of separate

instances of cones, tubes (or their sections)• With spatial optimisation over Z• Helping for more readable, more compact and faster code• Excellent scalability over the number of Z sections• Significant performance improvement

-500005000-500005000

2

4

6

8

10

12

x 104

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 6: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

6

Ordinary Polycone performance3 Z-sections• Speedup factor 3.3x vs. Geant4, 7.6x vs. ROOT for most

performance critical methods, i.e.:

Inside DistanceToOut DistanceToIn

Inside DistanceToOut DistanceToIn Normal SafetyFromOutsideSafetyFromInside0

500

1000

1500

2000

2500

Method

Tim

e pe

r on

e m

etho

d ca

ll [n

anos

econ

ds]

Performance of methods at folder polycone-3s-360-perf

Geant4

ROOTUSolids

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 7: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

7

Ordinary Polycone performance10 z sections • Speedup factor 8.3x vs. Geant4, 7.9x vs. ROOT for most

performance critical methods

Inside DistanceToOut DistanceToIn Normal SafetyFromOutsideSafetyFromInside0

200

400

600

800

1000

1200

1400

1600

1800

2000

Method

Tim

e pe

r on

e m

etho

d ca

ll [n

anos

econ

ds]

Performance of methods at folder polycone-10s-360-perf

Geant4

ROOTUSolids

NOTE: Geant4 poor performance scalability (high number of Z sections) due to absence of spatial optimization

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 8: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

8

Generic Polycone• Case in which either the outer or the inner surface has

more than one cone or tube section over a finite interval of Z values• Using voxelization on generalized surface

facet model• Performance improvement over Geant4

(generic polycone exists only in Geant4)• Performance improvement depends on the

number of sections and is slightly worse than in case of ordinary polycone

• Scalability is as excellent as for the ordinary polycone case

• Tested and measured on original Geant4 test cases of solids

• Values are 100% numerically coincident with Geant4

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 9: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

9

Ordinary vs. Generic Polycone

3s 10s 100s0

1000

2000

3000

4000

Count of solid parts

Tim

e [n

anos

econ

ds p

er o

pera

tion]Performance of method SafetyFromInside at folder combined

Geant4 Polycone

New Generic PolyconeNew Ordinary Polycone

3s 10s 100s0

2000

4000

6000

8000

Count of solid parts

Tim

e [n

anos

econ

ds p

er o

pera

tion] Performance of method DistanceToOut at folder combined

Geant4 Polycone

New Generic PolyconeNew Ordinary Polycone

3s 10s 100s0

1000

2000

3000

4000

Count of solid parts

Tim

e [n

anos

econ

ds p

er o

pera

tion]

Performance of method DistanceToIn at folder combined

Geant4 Polycone

New Generic PolyconeNew Ordinary Polycone

-500005000-500005000

2

4

6

8

10

12

x 104

3s 10s 100s0

500

1000

1500

2000

2500

Count of solid parts

Tim

e [n

anos

econ

ds p

er o

pera

tion] Performance of method Inside at folder combined

Geant4 Polycone

New Generic PolyconeNew Ordinary Polycone

NOTE: Geant4 poor performance scalability (high number of Z sections) due to absence of spatial optimization

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 10: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

Polyhedra

Page 11: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

11

New Polyhedra implementation• Similar methodology adopted as for the

Generic Polycone• Spatial optimisation for Z sections• Works for both ordinary and generic polyhedra• Provides improvement of performance and scalability

• Values are 100% numerical coincident with Geant4

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 12: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

12

Example: DistanceToIn() scalability

2 4 6 8 10 20 500

2000

4000

6000

8000

10000

12000

14000

16000

Count of solid parts

Tim

e [n

anos

econ

ds p

er o

pera

tion]

Performance of method DistanceToIn at folder log

Geant4

ROOTUSolid

NOTE: Geant4 poor performance scalability (high number of Z sections) due to absence of spatial optimization

Similar figures for the other key functions

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 13: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

13

Arbitrary Trap• Implemented first version of Arbitrary Trap• Optimization is done for main methods

• Still some methods to optimise:

SurfaceNormal(), SafetyFromInside()

Performance for UGenericTrap with twist

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 14: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

14

Extruded Solid• Implemented first version of ExtrudedSolid

based on TessellatedSolid• Scalability studies show that this shape can

be more optimized. Work in progress…

Scalability for DistanceToOut() in UExtrudedSolid

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 15: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

Current Status & Plans

Page 16: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

16

Status of USolids library• Review of secondary functions and tools for all implemented

primitives has been completed• Library in the current form (excluding few primitives) distributed

as optional module in latest Geant4 release 10.0• Expecting a lot of useful feedback !• Validation of available shapes on realistic detector geometries is ongoing

• Testing suite further extended for performance measurements and exact comparisons to Geant4 and ROOT

• Code available in the AIDA SVN repository• Using standard AIDA CMake setup for build/installation

• Documentation available from AIDA WP2 web• http://aidasoft.web.cern.ch/USolids

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 17: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

17

USolids plan of work• Short term (by end 2014)

• Complete implementation for missing shapes• Cut Tube, Torus, Ellipsoid, Hypeboloid, Paraboloid, Elliptical Tube,

Elliptical Cone

• Provide ability to perform Boolean operations• Simple Union, Subtraction, Intersection

• Medium/Long term (AIDA2 proposal)• Extend signatures of classes to enable use of vectorisation

• SIMD instructions

• Review algorithms on all developed shapes to efficiently apply vectorisation and strong code specialization• Define proper interfaces for use in Geant4, ROOT and Vector prototype

Thursday, 27 March 2014 AIDA 3rd Annual Meeting - WP2 / Status of the Unified Solids Library

Page 18: STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN

Thanks