cupug is a standard PostgreSQL extension built with PGXS. Testing can run locally in Docker or on remote GPU instances via vast.ai.
cupug compiles against a PostgreSQL installation using pg_config:
make PG_CONFIG=/path/to/pg_config
make install PG_CONFIG=/path/to/pg_config
If pg_config is already on your PATH, the PG_CONFIG variable can
be omitted.
The extension ships with pg_regress tests in expected/ and sql/.
After building and installing:
make installcheck
This requires a running PostgreSQL instance with the test database
contrib_regression already created.
Docker targets build a self-contained image, compile the extension inside it, and run pg_regress automatically. No local PostgreSQL installation is needed.
make test-pg16 # test against PostgreSQL 16
make test-pg17 # test against PostgreSQL 17
make test-all # both versions, sequentially
The image is based on the official postgres:XX Docker image. The
Dockerfile is at test/Dockerfile and the in-container test runner is
test/run_tests.sh.
For testing on real GPU hardware, cupug can rent a GPU instance on vast.ai, run the tests, and tear it down automatically.
pip install vastai~/.vast_api_keyDOCKER_REGISTRY to a registry you can push to (e.g.,
export DOCKER_REGISTRY=docker.io/myuser)docker login has been run for that registrymake vast-build # build the CUDA Docker image locally
make vast-push # build + push to DOCKER_REGISTRY
make test-vast-pg16 # full lifecycle: build, push, rent GPU, test, destroy
make test-vast-pg17 # same for PostgreSQL 17
make test-vast-all # PG 16 then PG 17
All vast.ai targets accept these Make variables:
| Variable | Default | Description |
|---|---|---|
CUDA_TAG |
12.4.1-cudnn-devel-ubuntu22.04 |
CUDA base image tag |
DOCKER_REGISTRY |
(required) | Docker registry for push |
VAST_TIMEOUT |
600 |
Seconds before timeout |
VAST_MAX_PRICE |
0.20 |
Max dollars per hour for GPU rental |
Example:
make test-vast-pg17 VAST_MAX_PRICE=0.30 VAST_TIMEOUT=900
The lifecycle is managed by test/vast-run.sh:
test/Dockerfile.vast – a CUDA-enabled Ubuntu image with
PostgreSQL from the PGDG apt repository. The extension source is
copied in but not compiled at build time (compilation needs the
target GPU environment).DOCKER_REGISTRY.test/vast-test.sh as the startup command.CUPUG_VAST_TESTS_PASSED or CUPUG_VAST_TESTS_FAILED.test/vast-run.sh can also be invoked directly with finer control:
bash test/vast-run.sh --pg-major 17 --gpu-name RTX_4090 --max-price 0.50
| Flag | Default | Description |
|---|---|---|
--pg-major |
16 |
PostgreSQL major version |
--cuda-tag |
12.4.1-cudnn-devel-ubuntu22.04 |
CUDA base image tag |
--gpu-name |
RTX_3060 |
GPU type to request |
--disk |
16 |
Disk space in GB |
--max-price |
0.20 |
Max $/hr |
--timeout |
600 |
Timeout in seconds |
--image |
(auto) | Use a pre-built remote image |
--skip-build |
off | Skip docker build/push |
The vast.ai image can be tested locally without GPU hardware or API credentials:
docker build -f test/Dockerfile.vast --build-arg PG_MAJOR=17 -t cupug-vast:pg17 .
docker run --rm cupug-vast:pg17 bash /build/cupug/test/vast-test.sh
This runs the same test sequence on CPU, which is sufficient for validating the extension logic and the test infrastructure itself.
test/
Dockerfile # CPU-only test image (postgres:XX base)
Dockerfile.vast # GPU test image (CUDA + PGDG PostgreSQL)
run_tests.sh # in-container runner for Docker tests
vast-test.sh # in-container runner for vast.ai tests
vast-run.sh # developer-machine orchestrator for vast.ai