heterodb/pg-strom

[VTJ-JP]インストールガイドへのUbuntuの言及

Closed this issue · 7 comments

HeteroDB Software Distribution Centerにheterodb-extraのDebianパッケージが公開されており、Experimentalではあるが、開発ツール、GUDA、MOFEDを揃えるとUbuntuでも動かせる点について言及があってもいい気がします。

https://heterodb.github.io/swdc/

Ubuntuの場合にインストールできるかどうか、一度、通しで試してみたい気はしますね。

次の構成で手元で動作することを確認できています。

  • Ubuntu 22.04.4 LTS
  • Linux 5.15.0-94-generic
  • PostgreSQL 16.2
  • heterodb-extra_5.2-3_amd64.deb
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Jul_11_02:20:44_PDT_2023
Cuda compilation tools, release 12.2, V12.2.128
Build cuda_12.2.r12.2/compiler.33053471_0
CREATE TABLE t_test1 AS
 SELECT       x, 'a'::char(100) AS y, 'b'::char(100) AS z
 FROM   generate_series(1, 5000000) AS x
 ORDER BY random();

sudo su - postgres
cd /opt/nvme/test
pg2arrow -u postgres -d testdb -c "SELECT * FROM t_test1" -o ./arrow_t_test1.arrow

IMPORT FOREIGN SCHEMA arrow_t_test1
  FROM SERVER arrow_fdw
  INTO public
OPTIONS (file '/opt/nvme/test/arrow_t_test1.arrow');

EXPLAIN VERBOSE SELECT count(*)
 FROM   arrow_t_test1
 WHERE sqrt(x) > 0
 GROUP BY y;

                                                                                  QUERY PLAN                                                                                   
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 HashAggregate  (cost=28216.25..28218.25 rows=200 width=412)
   Output: pgstrom.fcount((pgstrom.nrows())), y
   Group Key: arrow_t_test1.y
   ->  Gather  (cost=28172.25..28214.25 rows=400 width=412)
         Output: (pgstrom.nrows()), y
         Workers Planned: 2
         ->  Parallel Custom Scan (GpuPreAgg) on public.arrow_t_test1  (cost=27172.25..27174.25 rows=200 width=412)
               Output: (pgstrom.nrows()), y
               GPU Projection: pgstrom.nrows(), y
               GPU Scan Quals: (sqrt((x)::double precision) > '0'::double precision) [rows: 5000000 -> 694445]
               referenced: x, y
               file0: /opt/nvme/test/arrow_t_test1.arrow (read: 495.91MB, size: 972.75MB)
                 x: 19.07MB
                 y: 476.84MB
               GPU-Direct SQL: enabled (GPU-0)
               KVars-Slot: <slot=0, type='int4', expr='x'>, <slot=1, type='bpchar', expr='y'>, <slot=2, type='bpchar', expr='y'>
               KVecs-Buffer: nbytes: 36864, ndims: 2, items=[kvec0=<0x0000-27ff, type='int4', expr='x'>, kvec1=<0x2800-8fff, type='bpchar', expr='y'>]
               LoadVars OpCode: {Packed items[0]={LoadVars(depth=0): kvars=[<slot=0, type='int4' resno=1(x)>, <slot=1, type='bpchar' resno=2(y)>]}}
               MoveVars OpCode: {Packed items[0]={MoveVars(depth=0): items=[<slot=1, offset=0x2800-8fff, type='bpchar', expr='y'>]}}}
               Scan Quals OpCode: {Func(bool)::float8gt args=[{Func(float8)::sqrt arg={Func(float8)::float8 arg={Var(int4): slot=0, expr='x'}}}, {Const(float8): value='0'}]}
               Group-By KeyHash OpCode: {HashValue arg={SaveExpr: <slot=1, type='bpchar'> arg={Var(bpchar): kvec=0x2800-9000, expr='y'}}}
               Group-By KeyLoad OpCode: {LoadVars(depth=-2): kvars=[<slot=2, type='bpchar' resno=2(y)>]}
               Group-By KeyComp OpCode: {Func(bool)::bpchareq args=[{Var(bpchar): slot=1, expr='y'}, {Var(bpchar): slot=2, expr='y'}]}
               Partial Aggregation OpCode: {AggFuncs <nrows[*], vref[slot=1, expr='y']> arg={SaveExpr: <slot=1, type='bpchar'> arg={Var(bpchar): kvec=0x2800-9000, expr='y'}}}
               Partial Function BufSz: 8
(25 rows)

次も共有します。

Ubuntu 22.04 + GPU-Direct SQLの導入手順

  • 開発ツールを入れる
sudo apt-get install -y build-essential libicu-dev dracut
  • CUI起動するように設定する(GUIが不要な場合)
sudo systemctl set-default multi-user.target
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
git clone https://github.com/heterodb/pg-strom.git
cd pg-strom/src
make PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config
sudo make install PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config
  • PG-Strom heterodb-extraのインストール(OSS版として使う場合は不要)
wget https://heterodb.github.io/swdc/deb/heterodb-extra_5.2-3_amd64.deb
sudo dpkg -i heterodb-extra_5.2-3_amd64.deb
sudo cp heterodb.license /etc/heterodb.license
  • サービスを再起動して利用
sudo systemctl restart postgresql@16-main.service
sudo su - postgres
psql
...

v5.2のライムラインで、ドキュメントにUbuntuインストールの章を追加します。

困っている人を発見しました...。
https://twitter.com/Ryuzot1112/status/1775872239025766886

なんでrpmが...なんて話になるんだろうか。

ま、当面はソースコードインストールのつもりなので、それを明記しちゃいましょうということで。

SWDCからheterodb-extra.deb を入手してインストールする事を追記しました。