Current status of the development of the Unified Solids library Marek Gayer CERN PH/SFT.

Slides:



Advertisements
Similar presentations
Programming Paradigms and languages
Advertisements

G. Alonso, D. Kossmann Systems Group
Quick Sort, Shell Sort, Counting Sort, Radix Sort AND Bucket Sort
CS447/ Realistic Rendering -- Solids Modeling -- Introduction to 2D and 3D Computer Graphics.
July 11 th, 2005 Software Engineering with Reusable Components RiSE’s Seminars Sametinger’s book :: Chapters 16, 17 and 18 Fred Durão.
Eliminating Stack Overflow by Abstract Interpretation John Regehr Alastair Reid Kirk Webb University of Utah.
Finding Aggregates from Streaming Data in Single Pass Medha Atre Course Project for CS631 (Autumn 2002) under Prof. Krithi Ramamritham (IITB).
1 Java Grande Introduction  Grande Application: a GA is any application, scientific or industrial, that requires a large number of computing resources(CPUs,
1 Presenter: Chien-Chih Chen Proceedings of the 2002 workshop on Memory system performance.
Witek Pokorski, Radovan Chytracek, Jeremy McCormick, Giovanni Santin
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
Navigating and Browsing 3D Models in 3DLIB Hesham Anan, Kurt Maly, Mohammad Zubair Computer Science Dept. Old Dominion University, Norfolk, VA, (anan,
Performance Analysis and Optimization Tool Andres S. CHARIF-RUBIAL Emmanuel OSERET Performance Analysis Team, University.
I. Pribela, M. Ivanović Neum, Content Automated assessment Testovid system Test generator Module generators Conclusion.
Software Engineering Reuse.
U-Solids: new geometrical primitives library for Geant4 and ROOT Marek Gayer CERN Physics Department (PH) Group Software Development for Experiments (SFT)
Recursion, Complexity, and Searching and Sorting By Andrew Zeng.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Performance Concepts Mark A. Magumba. Introduction Research done on 1058 correspondents in 2006 found that 75% OF them would not return to a website that.
Winrunner Usage - Best Practices S.A.Christopher.
Data Structures for Scenes, The Basics of Scene Graphs Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday,
Geant4 Acceptance Suite for Key Observables CHEP06, T.I.F.R. Mumbai, February 2006 J. Apostolakis, I. MacLaren, J. Apostolakis, I. MacLaren, P. Mendez.
HW/SW PARTITIONING OF FLOATING POINT SOFTWARE APPLICATIONS TO FIXED - POINTED COPROCESSOR CIRCUITS - Nalini Kumar Gaurav Chitroda Komal Kasat.
Unified Solids Marek Gayer, John Apostolakis, Gabriele Cosmo, Andrei Gheata, Jean-Marie Guyader, Tatiana Nikitina CERN PH/SFT The 17 th Geant4 Collaboration.
Tot 15 LTPDA Graphic User Interface summary and status N. Tateo 26/06/2007.
Nick Draper 05/11/2008 Mantid Manipulation and Analysis Toolkit for ISIS data.
Use of Coverity & Valgrind in Geant4 Gabriele Cosmo.
Complexity of Algorithms
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Detector Simulation on Modern Processors Vectorization of Physics Models Philippe Canal, Soon Yung Jun (FNAL) John Apostolakis, Mihaly Novak, Sandro Wenzel.
Mark Marron 1, Deepak Kapur 2, Manuel Hermenegildo 1 1 Imdea-Software (Spain) 2 University of New Mexico 1.
CSC 221: Recursion. Recursion: Definition Function that solves a problem by relying on itself to compute the correct solution for a smaller version of.
- DHRUVA TIRUMALA BUKKAPATNAM Geant4 Geometry on a GPU.
Towards Practical Automated Motion Synthesis Auslander, Fukunaga, Partovi, Christensen, Hsu, Reiss, Shuman, Marks, Ngo.
Investigating Adaptive Compilation using the MIPSpro Compiler Keith D. Cooper Todd Waterman Department of Computer Science Rice University Houston, TX.
Visual Computing Geometric Modelling 1 INFO410 & INFO350 S2 2015
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Python template engines and implementation in Indico Marius Damarackas (Vilnius University)
New software library of geometrical primitives for modelling of solids used in Monte Carlo detector simulations Marek Gayer, John Apostolakis, Gabriele.
Jump to first page The new ROOT geometry package Andrei Gheata - ALICE Institute of Space Sciences, Bucharest.
Parallelization of likelihood functions for data analysis Alfio Lazzaro CERN openlab Forum on Concurrent Programming Models and Frameworks.
QCAdesigner – CUDA HPPS project
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
USolids Multi-Union notes Marek Gayer 1. GetCandidatesVoxelArray method, on which Inside very much relies Finding voxel candidates did not delete buffers.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
STATUS OF THE UNIFIED SOLIDS LIBRARY Gabriele Cosmo/CERN Tatiana Nikitina/CERN.
Outline  Developments/fixes in the last year  Introduced in release 9.6 and patches  Planned for release 10.0 and ongoing …  Currently under development.
U-Solids: new geometrical primitives library for Geant4 and ROOT Marek Gayer CERN Physics Department (PH) Group Software Development for Experiments (SFT)
LCG – AA review 1 Simulation LCG/AA review Sept 2006.
STAR VMC project Maxim Potekhin for the STAR Collaboration VMC workshop at CERN Nov
GDML “Geometry Description Markup Language” by Daniele Francesco Kruse University of Rome “Tor Vergata” European Organization for Nuclear Research.
CSCI-455/552 Introduction to High Performance Computing Lecture 21.
Outline  Developments/fixes in the last year  Introduced in release 10.1 and patches (also to 10.0)  Planned for release 10.2 and ongoing …  Currently.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Status of the development of the Unified Solids library Marek Gayer, CERN PH/SFT 2 nd AIDA Annual Meeting, Frascati 2013.
LECTURE 19 Subroutines and Parameter Passing. ABSTRACTION Recall: Abstraction is the process by which we can hide larger or more complex code fragments.
DGrid: A Library of Large-Scale Distributed Spatial Data Structures Pieter Hooimeijer,
MAUS Status A. Dobbs CM43 29 th October Contents MAUS Overview Infrastructure Geometry and CDB Detector Updates CKOV EMR KL TOF Tracker Global Tracking.
CERN, 7 November 2011 Anton Pytel Slovak Technical University TRIP FROM GENERATORS TO GEOMETRIES.
Lecture 1 Golden Measure and other terms (appropriate for pracs) Lecturer: Simon Winberg Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
Update on USolids/VecGeom integration in Geant4 Gabriele Cosmo, CERN EP/SFT.
Common Geometry Primitives library WP3 – date
Designing High Performance BIRT Reports
CSCI1600: Embedded and Real Time Software
Objective of This Course
Case Study 1 By : Shweta Agarwal Nikhil Walecha Amit Goyal
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Current status of the development of the Unified Solids library Marek Gayer CERN PH/SFT

Motivations for a common solids library Optimize and guarantee better long-term maintenance of ROOT and Gean4 solids libraries o A rough estimation indicates that about 70-80% of code investment for the geometry modeler concerns solids, to guarantee the required precision and efficiency in a huge variety of combinations Create a single high quality library to replace solid libraries in Geant4 and ROOT o Starting from what exists today in Geant4 and ROOT o Adopt a single type for each shape o Significantly optimize (Multi-Union, Tessellated Solid, Polyhedra, Polycone) o Reach complete conformance to GDML solids schema Create extensive testing suite Current status of the development of the Unified Solids library2

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) Current status of the development of the Unified Solids library3

Testing Suite Unified Solid Batch Test Optical Escape Specialized tests (e.g. quick performance scalability test for multi-union) Current status of the development of the Unified Solids library4

Unified Solid Batch Test New powerful diagnosis tool for testing solids of ROOT, Geant4 and Unified Solids library designed for transition to Unified Solids Compares performance and output values from different codes Helps us to make sure we have similar or better performance in each method and different test cases Support for batch configuration and execution of tests Useful to detect, report and fix numerous bugs or suspect return values in Geant4, ROOT and Unified Solids Two phases o Sampling phase (generation of data sets, implemented in C++ o Analysis phase (data post-processing, implemented as MATLAB scripts) Current status of the development of the Unified Solids library5

Visualization of scalar and vector data sets Current status of the development of the Unified Solids library6

3D plots allowing to overview data sets Current status of the development of the Unified Solids library7

3D visualization of investigated shapes Current status of the development of the Unified Solids library8

Support for regions of data, focusing on sub-parts Current status of the development of the Unified Solids library9

Visual analysis of differences Current status of the development of the Unified Solids library10

Visual analysis of differences in 3D Current status of the development of the Unified Solids library11

Graphs with comparison of performance Current status of the development of the Unified Solids library12

Visualization of scalability performance for specific solids Current status of the development of the Unified Solids library13

New Multi-Union solid Current status of the development of the Unified Solids library14

Multi-Union solid We implemented a new solid as a union of many solids using voxelization technique to optimize speed and scalability o 3D space partition for fast localization of components o Aiming for a log(n) scalability, unlike the Geant4 Boolean solid Useful for complex composites made of many solids Current status of the development of the Unified Solids library15

Test multi-union solid for scalability measurements Current status of the development of the Unified Solids library Union of random boxes, orbs and trapezoids (on pictures with 5, 10, 20 solids) 16

The most performance critical methods Current status of the development of the Unified Solids library17

Fast Tessellated Solid Current status of the development of the Unified Solids library18

Fast Tessellated Solid Made from connected triangular and quadrangular facets forming solid Old implementation was slow, no spatial optimization We use spatial division of facets into 3D grid forming voxels Voxelization is based on: o Bitmasks and logical and operations during initialization o NEW: Bitmasks are not used at runtime, only pre-calculated lists of facets candidates are used during runtime Speedup factor ~10x additional improvement since the previous Geant4 collaboration meeting Current status of the development of the Unified Solids library19

Fast Tessellated Solid Old Tessellated Solid had also several weak parts of algorithm, used at initialization with n 2 complexity o This sometimes caused very huge delays when loading (e.g. in case of foil with 164k faces) o Rewrote to have n ∙ log n complexity o Loading the solid is much faster. What before took minutes, now takes seconds Backported in autumn 2012 also to Geant4 9.6 By improving design of classes and removing inefficiencies, total memory save is about ~50%, o Voxelization has overhead vs. original G4TS, which reduces to a total memory save of ~25% Current status of the development of the Unified Solids library20

LHCb VELO foil benchmark Current status of the development of the Unified Solids library MethodSpeedup Inside2423x DistanceToIn1334x DistanceToOut1976x InformationValue Number of facets Number of voxels Memory saved compared with original Geant4 22% (51MB) 21

OLD Speedup: 240x None 10000x+ None 133x 397x NEW Speedup: 894x 10.3x 10000x+ ~8.7x 412x 1183x NEW Speedup: 2423x 72x 10000x+ ~10.9x 1334x 1976x NEW Speedup: 2925x 46x 10000x+ ~9.8x 1332x 2968x Performance – 164k/SCL5 with 10k/100k/1M voxels Current status of the development of the Unified Solids library22

Polycone Current status of the development of the Unified Solids library23

New Ordinary Polycone implementation Polycone is an important solid, heavily used in most experimental setups Special optimization for common cases: Z sections can only increase (big majority of real cases) o Based on composition of separate instances of cones, tubes (or their sections) o This way, providing brief, readable, clean and fast code o Excellent scalability over the number of Z sections o Very significant performance improvement Will make visible CPU improvement in full simulation of complex setups like ATLAS and CMS o In CMS, 6.92% was measured as the total CPU share of Polycone methods o Assuming possible speedup factor ~5x, this would save around 5% total time of the whole CMS experiment o Cost of polycone in ATLAS is “around 10%” Current status of the development of the Unified Solids library24

Ordinary Polycone performance, 3 z sections Speedup factor 3.3x vs. Geant4, 7.6x vs. ROOT for most performance critical methods, i.e.: Inside, DistanceToOut, DistanceToIn Current status of the development of the Unified Solids library25

Ordinary Polycone performance, 10 z sections Speedup factor 8.3x vs. Geant4, 7.9x vs. ROOT for most performance critical methods Current status of the development of the Unified Solids library26

Ordinary Polycone performance, 100 z sections Speedup factor 34.3x vs. Geant4, 10.7x vs. ROOT for most performance critical methods Current status of the development of the Unified Solids library27

Ordinary Polycone scalability Current status of the development of the Unified Solids library28 Geant4 poor performance scalability is explained by the lack of spatial optimization

Ordinary Polycone: sometimes only proper, careful coding makes big difference Performance gain over Geant4 could be explained due to lack of spatial division by voxelization But new USolids polycone uses very similar algorithms and voxelization as ROOT does: why it is factor 7 – 10x faster, much more clear, shorter, readable and easier to maintain? Answer is given in 2 backup slides in the end of presentation Current status of the development of the Unified Solids library29

Generic Polycone Optimization made as well o Using voxelization on generalized surface facet model o Performance improvement over Geant4 (generic polycone does not exist in ROOT) o Performance improvement depends on the number of sections and is less than in case of ordinary polycone o Scalability is excellent as well as for the ordinary polycone case o Tested and measured on original Geant4 test cases of solids o Values are 100% conformal with Geant4 This work was achieved thanks to the 3 month extension negotiated by John Harvey and supported by the Linear Collider Detector Team Current status of the development of the Unified Solids library30

Ordinary vs. Generic Polycone Current status of the development of the Unified Solids library31 Geant4 poor performance scalability is explained by the lack of spatial optimization

Polyhedra Current status of the development of the Unified Solids library32

New Polyhedra implementation Uses similar methodology as was done for the Generic Polycone Works for both ordinary and generic polyhedra Provides improvement of performance and scalability Values are 100% conformal with Geant4 Same as for the case of generic polycone, this work was made during my last 3 months contract extension Current status of the development of the Unified Solids library33

Inside scalability Current status of the development of the Unified Solids library34 Geant4 poor performance scalability is explained by the lack of spatial optimization

DistanceToIn scalability Current status of the development of the Unified Solids library35 Geant4 poor performance scalability is explained by the lack of spatial optimization

DistanceToOut scalability Current status of the development of the Unified Solids library36 Geant4 poor performance scalability is explained by the lack of spatial optimization

Normal scalability Current status of the development of the Unified Solids library37 Geant4 poor performance scalability is explained by the lack of spatial optimization

SafetyFromInside scalability Current status of the development of the Unified Solids library38 Geant4 poor performance scalability is explained by the lack of spatial optimization

SafetyFromOutside scalability Current status of the development of the Unified Solids library39 TODO Geant4 poor performance scalability is explained by the lack of spatial optimization

Status of work Types and Unified Solids interface are defined Bridge classes for comparison with Geant4 and ROOT implemented Testing suite defined and deployed Implemented 9 solid primitives New, high performance implementation of composed solids: Multi-Union, Tessellated solid, Polycone, Polyhedra and Extruded-Solid (ongoing) Code and knowledge is being passed since Q to Tatiana Nikitina Current status of the development of the Unified Solids library40

Future work plan Marek Gayer o Finish documentation Tatiana Nikitina o Analyze and implement remaining solids for the new library o Verify implementation of secondary methods for all solids o Integration to Geant4 10 Current status of the development of the Unified Solids library41

Thank you for your attention. ?????? Questions and Answers Current status of the development of the Unified Solids library42

Backup Current status of the development of the Unified Solids library43

Polycone: sometimes only proper, careful coding makes huge difference 1/2 But new USolids polycone uses very similar algorithms and voxelization as ROOT does: why it is factor 7 – 10x faster, much more clear, shorter, readable and easier to maintain? Pre-calculates as much as possible in the constructor and not during runtime, not needing to do it in navigation methods again (e.g. if it is cylindrical or tubular section) Using directly methods from Tubs on Cons for polycone section to separate and move the logic from Polycone to Polycone sections o not re-implementing it again in new methods => difficult to read, maintain Lot of polycone data is instead contained in Tubs and Cons Current status of the development of the Unified Solids library44

Polycone: sometimes only proper, careful coding makes huge difference 2/2 No use of recursion, troubling compiler, processor and code readability DistanceToIn moves point to bounding box std::lower_bound is much faster than doing binary search by own coding C++, not feeling of mere C wrapped in classes Using class for vector (x,y,z) is better than using C array No use of pointers, memcpy, memset, … Section data not contained in Tubs, Cons are grouped together in a std::vector of struct’s Logical components, namely repeatedly used are in separated methods, often inlined Current status of the development of the Unified Solids library45