GPU Accelerated Databases

Subtitle: Database Driven OpenCL Programming

by Tim Child
MRSC 2011

Speaker Biography
• Tim Child • 35 years experience of software development • Formerly
• • • • VP Oracle Corporation VP BEA Systems Inc. VP Informix Leader at Illustra, Autodesk, Navteq, Intuit, …

• 30+ years experience in 3D, CAD, GIS and DBMS

MRSC 2011

Outline
• Speakers Biography • Outline
• OpenCL Programming Challenge

• • • • • • •

Review of GPU Accelerated Databases Swiss Army Knife of Data OpenCL Bindings to PostgreSQL Challenges Example Use Cases Benefits of the Approach Q&A

MRSC 2011

OpenCL Programming Problem
• Write a OpenCL Applications that :– – – – Reads data from DBMS or File Publishes Results as Web Pages Handles Frequent Data Updates Data Size >> System RAM >> GPU RAM

• Possible Solutions

or – C/C++ Binding using Web CGI Database Driven – Java/Perl/Python Bindings in App Server GPU – ??? Programming

MRSC 2011

GPU Co-Process Architecture
TCP/IP DBMS Client IPC / RPC

PCI Bus
GPU Language Co-Process

GPGPU DRAM

DBMS Server

Examples • 2004 Bandi, Sun, et al • Many others

Data Tables

GPGPU

MRSC 2011

GPU Hosted Data Architecture
TCP/IP DBMS Client DBMS Sever + GPU Host PCI Bus GPGPU DRAM

Data Tables Copy

GPGPU

Examples • 2008 Bakkum, Skardon • 2010 Palo OLAP • 2010 ParStream

Data Tables

MRSC 2011

PostgeSQL Swiss Army Knife of Data
SQL Extensible Types
(Declarative Language, Set Operations)

Extensible Procedural Languages
(Java, Perl, …)

Rules System

Extensible Indices

Open Source

Vibrant Community

Native API’s

MRSC 2011

Remote Data Access

PostGIS
(Vector, Raster)

OpenCL

Procedural Language Architecture
TCP/IP DBMS Client PCI Bus GPGPU DRAM

DBMS Server Results

GPGPU Host
Queries GPGPU

10G B

RAM Cache

Examples • 1995 Illustra/Intel • 2010 3DMashUp

MRSC 2011

Data Tables

10T B

Comparison Table
Co-Process Functionality Queries Spatial Joins Specific Queries SQL IPC/RPC Large GPU Hosted OLAP Select statements SQL Direct Limited Procedural Generic SQL

Data Types Performance Scalability

SQL + OpenCL Direct Large

Data Transfer

Per Query

ETL database

Per Query

MRSC 2011

OpenCL SQL Binding
CREATE or REPLACE FUNCTION VectorAdd(IN Id int[], IN a real[], IN B real[], OUT C real[] ) AS $BODY$ __kernel void VectorAdd( __global int * id, __global float *a, __global float *b, __global float *c) { int i = get_global_id(0); /* Query OpenCL for the Array Subscript **/ c[i] = a[i] + b[i]; }

$BODY$
Language PgOpenCL;
Select VectorAadd(Id, a, c) from Vectors;

MRSC 2011

Table

Database Driven OpenCL
A B
Select Table to Array 100’s - 1000’s of Threads (Kernels)

A

+

B
Copy

xPU VectorAdd(A, B) Returns C

=
Copy

C

Unnest Array To Table

Table C C C C C C C C C C C C C

MRSC 2011

Challenges
• Type Mapping
– Extend SQL Types with √ • OpenCL Vectors Types √ • OpenCL Image Types

• Problem Size
– DBMS Table Size >> GPU RAM – # Work Groups / # Work Items √ • Runtime Partitioning

• Setup –> Runtime √ • Caching kernel info • Data Transfer

• Device Management
– CPU vs. GPU √ • Runtime Selection

– CPU ↔ GPU = • Still present – SQL Queries X • + ∆ Overhead ( < 4µs ) X • Map – Array – Bulk Data Loaders

• Concurrency
– No Pre-emptive Multi-Tasking X • Time-out Long Queries X • Partitioning / Scheduling

X

• New Task

MRSC 2011

Some Example Uses Cases
• 3D Content Management / GIS
– Spatial Selections – Coordinate Transformations – Image Processing

• Bioinformatics
– DNA & Protein Sequence Matching

• Database Internal Operations
– Joins – Sorting – Query Planning
MRSC 2011

Benefits of the Approach
PostgreSQL OpenCL

MRSC 2011

Open Source Release

Database Internal Operations

Questions? More Information
• PgOpenCL
• • Twitter @3DMashUp Blog www.scribd.com/3dmashup

Paper at AMD Fusion Summit, Jun 13 – 16, Seattle, USA

OpenCL

• • • •

www.khronos.org/opencl/

www.amd.com/us/products/technologies/stream-technology/opencl/

http://software.intel.com/en-us/articles/intel-opencl-sdk

http://www.nvidia.com/object/cuda_opencl_new.html

MRSC 2011

Sign up to vote on this title
UsefulNot useful