[VTJ-JP]GPU Error at MAX(<<timestamp column>>).
Closed this issue · 3 comments
sakaik commented
概要
TIMESTAMP 型へのMAX() 関数処理で GPUエラーが発生します。
実施クエリとエラー内容
291572b17cf751f54752b05f949af246a342d125
(2024-01-29 committed) でのエラー内容
sakaitest_nvme5=# SELECT MAX(dt) FROM z;
ERROR: gpu_service.c:1997 failed on cuEventSynchronize: CUDA_ERROR_ASSERT
HINT: device at GPU-0, function at gpuservHandleGpuTaskExec
最新 39e0c100fcfffca63435de96cfaf7a57fd44b717
(2024-02-01 committed) でのエラー内容
sakaitest_nvme5=# SELECT MAX(dt) FROM z;
ERROR: gpudirect.c:830 extra-module: failed on cuFileRead(len=37289984, at 67067904 of 'pg_tblspc/16389/PG_16_202307071/19650/28635') = -1
HINT: device at GPU-0, function at cufile__read_file_iov_v3
テーブル例
sakaitest_nvme5=# SELECT * FROM z LIMIT 5;
num | dt | add_seconds
-----+---------------------+-------------
1 | 2023-12-01 00:00:00 | 0
2 | 2023-12-01 00:00:00 | 8
3 | 2023-12-01 00:00:08 | 18
4 | 2023-12-01 00:00:18 | 20
5 | 2023-12-01 00:00:20 | 26
(5 rows)
sakaitest_nvme5=# \d z
Table "public.z"
Column | Type | Collation | Nullable | Default
-------------+-----------------------------+-----------+----------+---------
num | integer | | |
dt | timestamp without time zone | | |
add_seconds | integer | | |
再現方法
データ作成方法(例:200万件)
psqlで実施:
\set nof_data 2000000
\set start_date '2023-12-01 00:00:00'
\set expected_seconds 6
CREATE TABLE z AS
WITH RECURSIVE recseq AS (
SELECT 1 AS num , :'start_date'::TIMESTAMP AS dt, 0 as add_seconds
UNION ALL
SELECT num+1,
:'start_date'::TIMESTAMP + add_seconds * INTERVAL '1 seconds' AS dt,
add_seconds + (floor(random() * :expected_seconds *2)+1)::INTEGER
FROM recseq WHERE num< :nof_data
)
SELECT * FROM recseq;
-- エラーとなるクエリ
SELECT MAX(dt) FROM z;
-- 参考: INTEGERカラムに対してはエラーとならない
sakaitest_nvme5=# SELECT MAX(num) FROM z;
max
---------
2000000
その他
/var/lib/pgsql/16/data/cufile.log
に以下の出力あり
05-02-2024 06:23:07:515 [pid=1103547 tid=1103574] ERROR 0:1140 cuMemcpyPeer failed with error num: 710 error: CUDA_ERROR_ASSERT
kaigai commented
これ #720 の問題と同じ根っこですね。
ただ直し方が悪かったので、money型で直ってもtimestamp型で同じ問題が出てしまっています。
明日、コードを修正します。
kaigai commented
cf541b850daa00bfa8006738d0887f1a7a73c75b
で修正しました。
sakaik commented
修正後、正常に動作することを確認しました。
修正前
sakaitest_nvme5=# SELECT pgstrom.githash();
githash
------------------------------------------
39e0c100fcfffca63435de96cfaf7a57fd44b717
sakaitest_nvme5=# select MIN(dt) FROM z;
ERROR: gpu_service.c:1997 failed on cuEventSynchronize: CUDA_ERROR_ASSERT
HINT: device at GPU-0, function at gpuservHandleGpuTaskExec
sakaitest_nvme5=# select MAX(dt) FROM z;
ERROR: failed on connect('.pg_strom.16070.gpu0.sock'): Connection refused
CONTEXT: parallel worker
修正後
sakaitest_nvme5=# SELECT pgstrom.githash();
githash
------------------------------------------
cf541b850daa00bfa8006738d0887f1a7a73c75b
sakaitest_nvme5=# select MAX(dt) FROM z;
max
---------------------
2024-04-29 11:34:46
sakaitest_nvme5=# select MIN(dt) FROM z;
min
---------------------
2023-12-01 00:00:00