PGStrom for Postgres

  • PGStrom
    • a tool to execute a special type of SQL query on the GPU.
    • 50x compared to standard Postgres
      • because they use the GPU
  • PGStrom is faster than Postgres,
    • but this is not because of the GPU.
  • a multi-core CPU can process this queries as fast as the GPU.
  • For the test-case described on the PGStrom wiki page the CPU is even a bit faster.

Introduction

  • colleagues mailed me the link to PGStrom,
    • they knew that this is in my domain
    • 10x speedups by using a GPU in my field of work usually makes me skeptical.
  • PGStrom executes statements in the form of
SELECT * FROM table WHERE <complex formula> 

…on the GPU.

  • This is not a bad idea at all.
  • If you take a look at my last blog post, you can see that we have easily 5 checks out of 6.
  • The algorithm can be processed in a SIMD fashion, streamed without overhead and we do not need to transfer data more than once (a.k.a. “fits into GPU memory”).
  • However, the most important check is missing, and that’s the part where I am skeptical: I am not sure if the transfer to the GPU is faster than the computation on the CPU.

  • not appropriate to compare Postgres against an optimized implementation on the GPU.
  • Pg processes 10 Mio records in 7 seconds in their experiment.
    • 10 Mio sounds like a huge number, but actually the example statement processes only two columns with floating point numbers.
    • Assuming these numbers are 32 bit-float types, the CPU processes only 76 MB – in 7 seconds!
    • Remember that one CPU thread is capable of transferring around 4 GB of data per second!

Experiment and Implementation

  • my opinion
    • a fair comparison of GPU vs CPU is to
    • hard-code this query in C and in CUDA and
    • compare the run-time.
  • Because of the detailed description of the PGStrom test setup on the wiki-page (better than in most research papers…),
    • we can easily reproduce their tests. This SQL statement
SELECT COUNT(*) FROM t1 WHERE sqrt((x-25.6)^2 + (y-12.8)^2) < 15;
Logo

昇腾计算产业是基于昇腾系列(HUAWEI Ascend)处理器和基础软件构建的全栈 AI计算基础设施、行业应用及服务,https://devpress.csdn.net/organization/setting/general/146749包括昇腾系列处理器、系列硬件、CANN、AI计算框架、应用使能、开发工具链、管理运维工具、行业应用及服务等全产业链

更多推荐