Skip to content

Getting Started

Jack Feser edited this page May 25, 2020 · 5 revisions

Dependencies

  • CMPH: opam pin add cmph https://github.com/jfeser/ocaml-cmph.git
  • Genhash: opam pin add genhash https://github.com/jfeser/genhash.git
  • LLVM: You may want to build with -DCMAKE_BUILD_TYPE=RelWithDebInfo to get better errors.
  • PostgreSQL
  • Ocaml: Install OPAM dependencies with opam pin add castor . in source dir.

Building

Build with dune build.

Configuration

Castor looks for the following environment variables:

  • LLVM_ROOT: path to the current LLVM root directory
  • CASTOR_ROOT: path to the Castor source directory
  • CASTOR_DB: Postgres connection string for the DB to use when compiling
  • CASTOR_COST_DB: Postgres connection string for the DB to use for the cost model (should be a sample of CASTOR_DB)
  • CASTOR_TPCH_DB: Postgres connection string for a TPC-H DB
  • CASTOR_TPCH_TEST_DB: Postgres connection string for a sample of the TPC-H DB

Running tests

Run unit tests with dune runtest.

Some of the tests depend on the benchmark databases and will fail if they are not installed.

Benchmarks

We have two benchmark suites. One is based on TPC-H and one on data from Demomatch.

TPC-H

To set up the data for the TPC-H benchmark, use the generation script in https://github.com/jfeser/tpch-dbgen. It will create a database tpch containing the benchmark data.

Run the individual queries with bench/tpch/run-bench.py QUERY. The specialized queries are in files of the form bench/tpch/*-gold.txt. Benchmark results are in bench/tpch/results.csv. Temporary files, logs, and output are in a folder with the same name as the query.

Both the specialized and unspecialized forms of each query are committed to the repository. The specialized forms can be regenerated by running dune build @check_transforms. The arguments to the query transformer are in *.args files.

Demomatch

To set up the data for the Demomatch benchmark, run:

$ createdb demomatch
$ xz -d -c bench/demomatch/demomatch.sql.xz | pv | psql -d demomatch
Clone this wiki locally