Vis enkel innførsel

dc.contributor.advisorElster, Anne Cathrine
dc.contributor.authorBjerke, Håvard
dc.date.accessioned2023-05-15T17:27:10Z
dc.date.available2023-05-15T17:27:10Z
dc.date.issued2020
dc.identifierno.ntnu:inspera:57384149:10095714
dc.identifier.urihttps://hdl.handle.net/11250/3068076
dc.descriptionFull text not available
dc.description.abstractNTNU HPC-Laben har en lang historie med å implementere parallelle løsninger for komplekse problemer, hvorav et av prosjektene er HPC-Labens snøsimulator. Den startet som en røyksimulering som kjørte på CPU, som senere ble utvidet til å støtte snø og vind-felt. Senere ble den integrert med store terreng og en realistisk nedbørsmodell på grafikkprosessorer via NVIDIA Compute Unified Device Architecture (CUDA) for å forbedre ytelse. Dette var kombinert med en visualisering i Open Graphics Library (OpenGL) for å kunne observere simuleringen i sanntid. Denne oppgaven omhandler en implementasjon av en partikkelsimuleringsmetode som tidligere ikke har vært i bruk ved HPC-Labens snøsimulator ved navnet Material Point Method. Denne metoden er tyngre å prosessere en de tidligere brukte metodene, men har potensial til å gi en simulering av høyere kvalitet for partikkelinteraksjoner, og er også utvidbar for å ta hensyn til flere fysiske fenomen slik som temperatur og vind. Parametrene for MPM blir justert for ytelse, merkbart mellomromskonstanten slik at færre minneoperasjoner er nødvendig. Metoden er implementert i CUDA for å kunne simulere partikler i sanntid på NVIDIA RTX 2080 Ti. Implementasjonen er i stand til å simulere en million partikler med 16ms per tidssteg, to millioner partikler med 27ms per tidssteg, eller fire millioner partikler med 57ms per tidssteg. I tilfellene for en og to millioner partikler oppnår implementasjonen 60Hz og 30Hz i den rekkefølgen under optimale forhold. Dette oppnås ved å optimalisere minnehåndtering gjennom CUDA-spesifikke funksjoner og å ta nytte av konstante uttrykk i C++. I MPM sine felt-beregninger blir minne lest i større blokker og gir total prosesseringstid rundt 2ms for alle disse operasjonene. For partiklene blir en lignende strategi brukt for å integrere posisjonen til partikler på under 500 mikrosekund for fire millioner partikler. Simuleringen er konfiguererbar med partikler som enten kan genereres i minne, eller bli lastet fra disk for forhåndslagde partikler, og blir også brukt for å teste implementasjonens ytelse under optimale og suboptimale forhold. Partiklene interagerer også med terreng for å emulere snø som faller på fjellet, hvor terrenget er definert som et bilde delt mellom CUDA og OpenGL for bruk i visualisering og kollisjonstesting. Sammenlignet med de tidligere brukte modellene, hvor en enkeltverdi på terrenget definerte hvor mye snø som dekket et enkelt punkt, kan det i MPM dekkes med et lag partikler som utgjør snødekket, og som fortsatt kan interagere med resten av simulasjonen uten å skille mellom de to tilfellene. Simuleringen er også integrert med en visualisering av partikkeldataene i sanntid for å kunne observere partiklene uten å avbryte simuleringen. Denne er også nyttig for a evaluere simuleringen, eller for å finne feil ved implementasjonen ved å se på partiklene i sin helhet. Det er også nyttig som et brukergrensesnitt til simulatoren for å tilby steg-for-steg simulering, ytelsesinformasjon og kontroll over kameraet. Ideer for fremtidig arbeid og forbedringer blir diskutert, kildekode og et appendiks med brukermanual er også inkludert.
dc.description.abstractThe NTNU HPC-Lab has a long history of implementing parallel solutions to complex problems, with one particular project being the HPC-Lab Snow-Simulator. Starting with a smoke simulator running on a central processing unit (CPU), the simulation was extended to support snow and wind fields on CPU, and later on large terrains with clouds and realistic precipitation models using graphics processing units (GPU) with NVIDIA's Compute Unified Device Architecture (CUDA) in order to improve performance. The simulation was paired with graphics rendering for users to observe, implemented using the Open Graphics Library (OpenGL). This thesis implements a particle simulation method previously not used in the HPC-Lab Snow-Simulator called the Material Point Method. The method is more computationally heavy compared to the earlier employed methods, however, it offers a greater simulation quality for particle interactions, and may also be extended for more physical properties such as temperature and wind. The parameters of the MPM are tuned for performance, notably the spacing parameter in order to require fewer memory operations, and the delta time which trades some quality for performance. The goal of our project is to provide a real-time or near-real-time solution by parallelizing and optimizing the MPM to take advantage of the computational power of modern GPUs. We developed the code on the NVIDIA RTX 2080 Ti and also tested on earlier NVIDIA GTX 1070. On the RTX 2080 Ti our implementation is able to simulate one million particles with a frame time of 16ms, two million particles with a frame time of 27ms, or four million particles with a frame time of 57ms. For one and two million particles it manages to maintain a real-time target of 60Hz and 30Hz respectively under optimal conditions. This is achieved by optimizing the program for memory throughput with intrinsics and using constant expressions from C++. For MPM's grid computations, memory loads and stores are coalesced, resulting in only 2 milliseconds spent on these operations, with the same applying for particle operations such as explicit integration, which consume less than 500 microseconds when integrating the particle positions of four million particles. The simulation may be initialized with particles generated in memory or from disk, allowing big data sets to be imported with little delay, which is also used to test the solution with best-case and worst-case particle inputs. The particles interact with terrain, such that they may emulate snow falling on the mountain. Differently from the earlier works on the Snow-Simulator, where a scalar value indicated the amount of snow covering a particular vertex of the terrain, the MPM makes it possible to simulate the snow covering the ground as particles, which may still interact with the rest of the simulation without any special treatment. The terrain is imported as a heightmap and a normal map, allowing arbitrary terrains from the real world to be used, and is efficiently shared between CUDA and OpenGL for both rendering and collision detection purposes. The simulation is paired with a real-time visualization of the particle data allowing the particles to be observed without taking too much time away from the simulation. The visualization not only serves as a valuable method of assessing results, it is also a valuable tool in debugging particle behavior, as it is possible to observe particles in bulk. This also serves as an interface to control the simulator, allowing frame-by-frame stepping, performance metrics and camera control. Ideas of future work and improvements are discussed, source code and an Appendix containing a user manual are provided.
dc.languageeng
dc.publisherNTNU
dc.titleReal-time Snow Simulation Using GPU-Based Material Point Method
dc.typeMaster thesis


Tilhørende fil(er)

FilerStørrelseFormatVis

Denne innførselen finnes i følgende samling(er)

Vis enkel innførsel