Skip to content
README.md 4.79 KiB
Newer Older
Matt Wala's avatar
Matt Wala committed
# Numerical experiments: A fast algorithm with error bounds for Quadrature by Expansion

Matt Wala's avatar
Matt Wala committed
[![DOI](https://zenodo.org/badge/214558364.svg)](https://zenodo.org/badge/latestdoi/214558364)

Matt Wala's avatar
Matt Wala committed
This repository contains the code for (corrected) numerical experiments in the paper 'A fast
Matt Wala's avatar
Matt Wala committed
algorithm with error bounds for Quadrature by Expansion,' available at
[doi:10.1016/j.jcp.2018.05.006](https://doi.org/10.1016/j.jcp.2018.05.006) or on
[arXiv](https://arxiv.org/abs/1801.04070).

The code that is included reproduces the following parts of the paper:

* Tables 3, 4, 5, and 6
* Figures 14 and 15
* Data presented in Section 5.2.2

## Running Everything

Install the [Docker image](https://doi.org/10.5281/zenodo.3483367), and from a shell running in a
container, go to the code directory and type:
Matt Wala's avatar
Matt Wala committed
```
./run.sh
```
This script re-runs all experiments, and generates an output file
`summary/summary.pdf` containing all the generated figures, tables, and
data.

It's also possible to have more selective control over what gets run. See
[below](#running-experiments).
Matt Wala's avatar
Matt Wala committed

## Installation Hints

This code uses a special branch of
[Pytential](https://github.com/inducer/pytential), available
[here](https://github.com/mattwala/pytential/tree/fix-cost-model-for-2d-paper-code-v2).
Two options are available for obtaining the needed revisions of Pytential and
its dependencies.

Matt Wala's avatar
Matt Wala committed
### Docker Image

The simplest way to install is to use the
Matt Wala's avatar
Matt Wala committed
[Docker image](https://doi.org/10.5281/zenodo.3483367). The code
and software are installed in the image directory
`/home/inteq/gigaqbx-2d-results`.
Matt Wala's avatar
Matt Wala committed

### Manual Installation

If you don't want to use the Docker image, you can install necessary software
manually using the command:
Matt Wala's avatar
Matt Wala committed
```
./install.sh
```
This script downloads and installs software in an isolated environment in this
Matt Wala's avatar
Matt Wala committed
directory using Conda and pip.
Matt Wala's avatar
Matt Wala committed

Matt Wala's avatar
Matt Wala committed
For producing figures and outputs, you also need LaTeX and the
Matt Wala's avatar
Matt Wala committed
[latexrun](https://github.com/aclements/latexrun) script.

### Post-Installation

Matt Wala's avatar
Matt Wala committed
Before directly running the Python scripts in this directory, activate the
Conda environment and instruct PyOpenCL to use POCL, as follows:
Matt Wala's avatar
Matt Wala committed
```
source .miniconda3/bin/activate inteq
Matt Wala's avatar
Matt Wala committed
export PYOPENCL_TEST=portable
```

To ensure that everything works, you can run a short test:
```
py.test --disable-warnings utils.py
```

A more extensive set of tests can be found in the Pytential test suite (included
in `src/pytential/test`), which should also pass.

## Running Experiments

Matt Wala's avatar
Matt Wala committed
The scripts `generate-data.py` and `generate-figures-and-tables.py` can be used
to run individual experiments or groups of experiments, and postprocess
experimental outputs, respectively. Pass the `--help` option for more
documentation and the list of available experiments.
Matt Wala's avatar
Matt Wala committed

Matt Wala's avatar
Matt Wala committed
The `raw-data` directory is written to by `generate-data.py` and holds
experimental outputs. The `out` directory contains generated figures and tables
and is written to by `generate-figures-and-tables.py`.
Matt Wala's avatar
Matt Wala committed

To regenerate all outputs from the data that is already in the `raw-data`
directory, run

```
./generate-figures-and-tables.py --all
make -f makefile.summary
```

To run an individual experiment or to regenerate the data for a single
experiments, supply the command line option `-x experiment-name`. For instance, to
regenerate the results for the `bvp` experiment, run

```
./generate-data.py -x bvp
./generate-figures-and-tables.py -x bvp
```

Matt Wala's avatar
Matt Wala committed
## Contents

The following files and directories in this repository are included and/or
generated:

| Name | Description |
|----------------------------------|------------------------------------------------------------------------------------------------------------|
| `Dockerfile` | Used for generating the Docker image |
| `README.md` | This file |
| `install.sh` | Installation script |
| `generate-data.py` | Script for running experiments. Puts output in the `raw-data` directory |
| `generate-figures-and-tables.py` | Script for postprocessing experiments and producing figures and tables. Puts output in the `out` directory |
| `makefile.summary` | Makefile for generating the summary PDF |
| `utils.py` | Extra code used by `generate-data.py` |
| `summary.tex` | Source code for summary PDF |
| `run.sh` | Script for re-running all experiments and generating all outputs |
| `env` | Files used by the installer to set up the Conda and pip environments |
| `.miniconda3` | Conda install directory |
| `src` | Pip install directory |
| `raw-data` | Holds data generated by experiments |
| `out` | Holds generated figures and tables |
| `summary` | Holds generated summary PDF and auxiliary files |

## Citations

```
@article{gigaqbx2d,
  title = "A fast algorithm with error bounds for {Quadrature} by {Expansion}",
  journal = "Journal of Computational Physics",
  volume = "374",
  pages = "135 - 162",
  year = "2018",
  doi = "10.1016/j.jcp.2018.05.006",
  author = "Matt Wala and Andreas Klöckner",
}
```