GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and...

49

Transcript of GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and...

Page 1: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 2: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

GPU Based Sound Simulation and Visualization

Torbjorn Loken,

Sergiu M. Dascalu, and

Frederick C Harris, Jr.

Department of Computer Science and Engineering

University of Nevada, Reno

Page 3: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 4: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Reno, Nevada

Page 5: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

University of Nevada, Reno

Page 6: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

GPU Based Sound Simulation and Visualization

Torbjorn Loken,

Sergiu M. Dascalu, and

Frederick C Harris, Jr.

Department of Computer Science and Engineering

University of Nevada, Reno

Page 7: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Coprocessors

Step back in time– Channel I/O

Page 8: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 9: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Channel I/O

I/O processing was taking a significant amount for processor time– Just renting an IBM 709 could cost upwards

of $55,000 a month

Page 10: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Channel IO

I/O channels hooked into data synchronizer units – Central Processor free to continue

Similar to the modern Southbridge chip found on motherboards

Page 11: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Coprocessors

Step back in time– Channel I/O– Floating Point Units

Page 12: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Floating Point Math

Before 1985 and the IEEE 754 standard the implementation of floating point math varied greatly– Word sizes varied, accuracy varied

Page 13: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Floating Point Math

IEEE Standard 754 and a consensus about word sizes (32-bits) helped greatly

Hardware implementations almost required– Complex– Slow– Valuable

Page 14: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Floating Point Numbers

Page 15: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Floating Point units

Initially off chip– One of the most popular coprocessors

Moore’s Law made room for them on chip

Page 16: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

SSE and AVX

New instruction sets Compute using 128-512 bit wide registers

– Multiple floating point numbers per register Non-blocking, CPU free to continue while

computations run. Modern, widely available.

Page 17: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 18: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Coprocessors

Step back in time– Channel I/O– Floating Point Units

Graphics Processing units

Page 19: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Games: FPU Powered

Page 20: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Games: GPU Powered

Page 21: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

GPU Design

Goal: Floating Point Throughput SIMD to the core Hardware Accelerate common operations

– Initially Transformation and Lighting calculations

– Later Transcendentals, Texture sampling, etc...

Page 22: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

The Original Pipeline

Page 23: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

The evolution of the pipeline

Page 24: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Increasing Programmability

Shaders– Intended for graphical use

– They were als used also to accelerate applications with a large amount of floating point math

Image processing, simulations, etc VFire

Page 25: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Enter CUDA

Page 26: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Changes

Unified Processor Architecture– No more vertex or fragment processors

Threading emphasized– Many cores running many many threads

Page 27: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 28: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 29: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 30: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

CUDA

A subset of C with some extensions – Thread identifiers – Launching kernels– Some data types

Mainly used for organizing thread numbering

Page 31: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Example Kernel

__global__ void kernel(float* a, int N) {int idx = threadIdx.x;if(idx < N) {

a[idx] = a[idx] * a[idx];}

}

Page 32: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Now back to Sound Simulation

Page 33: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Sound Simulation

What are the acoustic properties of a room?

What acoustic phenomena will be produced in a room?

Page 34: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Wave Simulation Techniques

Geometric – Ray tracing

Numeric– Finite Element Methods(FEM)

Breaks domain into many smaller domains

– Finite Difference Time Domain(FDTD) Grid based

Page 35: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

FDTD

Decomposes the space in a rectilinear grid Visualization easy. Naturally very data parallel

– Easy to fit to SIMD Computationally expensive

– Increased frequency range -> Increased resolution of grid and decreased timestep size

Page 36: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Radio Wave Propagation

Simulating a cellular telephone in an elevator

Page 37: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

FDTD Sound Simulation

Solve for the acoustic pressure across the each point in the grid every time step

4 Different cases based on the boundaries at a grid point

Page 38: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Implementation

1 array which encodes the boundaries for each point on the grid (the boundary is constant for the entire simulation)

A series of arrays for holding the current simulation state

Page 39: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

0110

1110

1010

1011

1111

0111

1001

1101

0101

Page 40: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

System architecture

3 Components– Simulation Manager– Memory Manager– Renderer

Page 41: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 42: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

System Architecture

Each component runs on its own thread Inter-thread communication done with

thread-safe queues

Page 43: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

CPU

GPU

Simulation Manager

RendererMemory Manager

Simulation Data

OpenGL Data

Frame Data

Page 44: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.
Page 45: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Texture Mapped Volume Rendering Uses alpha blending to quickly render

volumetric data.

Page 47: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

Thank you!

Page 48: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.

GPU Based Sound Simulation and Visualization

Torbjorn Loken,

Sergiu M. Dascalu, and

Frederick C Harris, Jr.

Department of Computer Science and Engineering

University of Nevada, Reno

Page 49: GPU Based Sound Simulation and Visualization Torbjorn Loken, Torbjorn Loken, Sergiu M. Dascalu, and Frederick C Harris, Jr. Department of Computer Science.