diff --git a/Dockerfile.benchmark b/Dockerfile.benchmark deleted file mode 100644 index 51402e38..00000000 --- a/Dockerfile.benchmark +++ /dev/null @@ -1,28 +0,0 @@ -FROM ubuntu:trusty - -RUN apt-get update -RUN apt-get install -y software-properties-common unzip -RUN add-apt-repository -y ppa:openjdk-r/ppa -RUN apt-get update -RUN apt-get install -y openjdk-8-jdk -RUN apt-get install -y wget -RUN apt-get clean - -ADD archives/geotrellis-contrib.tar / -ADD archives/imageio-ext-1.1.24-jars.zip /tmp -RUN (cd /geotrellis-contrib/lib ; unzip /tmp/imageio-ext-1.1.24-jars.zip) -ADD archives/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz /geotrellis-contrib/benchmark/gdal/native/ -ADD archives/gdal-data.zip /tmp -RUN (cd /geotrellis-contrib/benchmark/gdal ; unzip /tmp/gdal-data.zip) -ADD archives/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb /tmp/ -RUN (dpkg -x /tmp/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb /tmp/moop ; \ - cp -f /tmp/moop/usr/lib/jni/*.so /geotrellis-contrib/benchmark/gdal/native/ ; \ - cp -f /tmp/moop/usr/share/java/gdal.jar /geotrellis-contrib/lib/) - -RUN update-ca-certificates -f -RUN (cd /geotrellis-contrib ; ./sbt "project benchmark" compile) - -ADD benchmark/src/main/resources/LC08_L1GT_001003_20170921_20170921_01_RT_B1.TIF /geotrellis-contrib/benchmark/src/main/resources/ - -ENV GDAL_DATA=/geotrellis-contrib/benchmark/gdal/gdal-data -ENV LD_LIBRARY_PATH=/geotrellis-contrib/benchmark/gdal/native:${LD_LIBRARY_PATH} diff --git a/Makefile.benchmark b/Makefile.benchmark deleted file mode 100644 index 10a871c3..00000000 --- a/Makefile.benchmark +++ /dev/null @@ -1,28 +0,0 @@ -.PHONY: all - - -all: archives/geotrellis-contrib.tar \ - archives/imageio-ext-1.1.24-jars.zip \ - archives/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz \ - archives/gdal-data.zip \ - archives/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb \ - benchmark/src/main/resources/LC08_L1GT_001003_20170921_20170921_01_RT_B1.TIF - docker build -t benchmark -f Dockerfile.benchmark . - -archives/geotrellis-contrib.tar: - git archive --format=tar --prefix=geotrellis-contrib/ -o $@ HEAD - -archives/imageio-ext-1.1.24-jars.zip: - curl -L "https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/imageio-ext-1.1.24-jars.zip" -o $@ - -archives/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz: - curl -L "https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/native/gdal/linux/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz" -o $@ - -archives/gdal-data.zip: - curl -L "https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/native/gdal/gdal-data.zip" -o $@ - -archives/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb: - curl -L "http://mirrors.kernel.org/ubuntu/pool/universe/g/gdal/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb" -o $@ - -benchmark/src/main/resources/LC08_L1GT_001003_20170921_20170921_01_RT_B1.TIF: - curl -L "http://landsat-pds.s3.amazonaws.com/c1/L8/001/003/LC08_L1GT_001003_20170921_20170921_01_RT/LC08_L1GT_001003_20170921_20170921_01_RT_B1.TIF" -o $@ diff --git a/benchmark/Dockerfile b/benchmark/Dockerfile new file mode 100644 index 00000000..8453fbcc --- /dev/null +++ b/benchmark/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:trusty + +RUN set -ex \ + && apt-get update \ + && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:openjdk-r/ppa \ + && apt-get update \ + && deps=" \ + unzip \ + openjdk-8-jdk \ + wget \ + " \ + && apt-get install -y $deps --no-install-recommends \ + && update-ca-certificates -f \ + && rm -rf /var/lib/apt/lists/* + +ADD archives/imageio-ext-1.1.24-jars.zip /tmp +ADD archives/gdal-data.zip /tmp +ADD archives/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb /tmp/ + +COPY . /opt/geotrellis-contrib + +RUN set -ex \ + && unzip /tmp/imageio-ext-1.1.24-jars.zip -d /opt/geotrellis-contrib/lib \ + && unzip /tmp/gdal-data.zip -d /opt/geotrellis-contrib/benchmark/gdal + +WORKDIR /opt/geotrellis-contrib + +ADD archives/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz /opt/geotrellis-contrib/benchmark/gdal/native/ +ADD benchmark/src/main/resources/LC08_L1GT_001003_20170921_20170921_01_RT_B1.TIF /opt/geotrellis-contrib/benchmark/src/main/resources/ + +RUN set -ex \ + && dpkg -x /tmp/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb /tmp/moop \ + && cp -f /tmp/moop/usr/lib/jni/*.so /opt/geotrellis-contrib/benchmark/gdal/native/ \ + && cp -f /tmp/moop/usr/share/java/gdal.jar /opt/geotrellis-contrib/lib/ +RUN ./sbt "project benchmark" compile + +ENV GDAL_DATA=/opt/geotrellis-contrib/benchmark/gdal/gdal-data +ENV LD_LIBRARY_PATH=/opt/geotrellis-contrib/benchmark/gdal/native:${LD_LIBRARY_PATH} diff --git a/benchmark/Makefile b/benchmark/Makefile new file mode 100644 index 00000000..6ef22cd0 --- /dev/null +++ b/benchmark/Makefile @@ -0,0 +1,23 @@ +.PHONY: all + + +all: ../archives/imageio-ext-1.1.24-jars.zip \ + ../archives/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz \ + ../archives/gdal-data.zip \ + ../archives/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb \ + src/main/resources/LC08_L1GT_001003_20170921_20170921_01_RT_B1.TIF + +../archives/imageio-ext-1.1.24-jars.zip: + curl -L "https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/imageio-ext-1.1.24-jars.zip" -o $@ + +../archives/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz: + curl -L "https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/native/gdal/linux/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz" -o $@ + +../archives/gdal-data.zip: + curl -L "https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/native/gdal/gdal-data.zip" -o $@ + +../archives/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb: + curl -L "http://mirrors.kernel.org/ubuntu/pool/universe/g/gdal/libgdal-java_1.10.1+dfsg-5ubuntu1_amd64.deb" -o $@ + +src/main/resources/LC08_L1GT_001003_20170921_20170921_01_RT_B1.TIF: + curl -L "http://landsat-pds.s3.amazonaws.com/c1/L8/001/003/LC08_L1GT_001003_20170921_20170921_01_RT/LC08_L1GT_001003_20170921_20170921_01_RT_B1.TIF" -o $@ diff --git a/benchmark/README.md b/benchmark/README.md index 723e3e14..b0ab3d94 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -1,49 +1,38 @@ -# With Docker # +# With Docker -## Build ## +In the root of the repository, run `./scripts/benchmark` -In the root of the repository, type `make -f Makefile.benchmark`. +# Without Docker -## Run ## +## Get Dependencies -With the Docker image built, type `docker run -it --rm benchmark`. -Inside of the docker container, type -```bash -cd /geotrellis-contrib -./sbt "project benchmark" "jmh:run" -``` - -# Without Docker # - -## Get Dependencies ## - -### Dependency Jars ### +### Dependency Jars Pre-built ImageIO jars can be found [here](https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/). The jars are in [this](https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/imageio-ext-1.1.24-jars.zip) archive. -### Native Dependencies ### +### Native Dependencies Pre-built native dependencies can be found [here](https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/native/gdal/). For Ubuntu 12.04 and compatible systems, [this tarball](https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/native/gdal/linux/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz) is known to work. GDAL also needs certain data to operate, those files can be found [here](https://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.24/native/gdal/gdal-data.zip). -### GDAL Java Bindings ### +### GDAL Java Bindings Java bindings are also needed. For Ubuntu 12.04 and compatible systems, [this package](https://packages.ubuntu.com/trusty/amd64/libgdal-java/download) contains the needed files. -## Get Data ## +## Get Data The test data can be found [here](https://landsatonaws.com/L8/001/003/LC08_L1GT_001003_20170921_20170921_01_RT). -## Run ## +## Run ```bash GDAL_DATA=$(pwd)/benchmark/gdal/gdal-data LD_LIBRARY_PATH=$(pwd)/benchmark/gdal/native:$LD_LIBRARY_PATH ./sbt "project benchmark" "jmh:run" ``` -# Using JMH # +# Using JMH We use JMH to wire up all benchmarks. Understanding the semantics of the JMH annotations takes some time. For clues, take a look at this diff --git a/docker-compose.yml b/docker-compose.yml index 12c3e76e..6b33b936 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,3 +30,18 @@ services: - $HOME/.sbt:/root/.sbt working_dir: /opt/geotrellis-contrib entrypoint: ./sbt + benchmark: + build: + context: . + dockerfile: benchmark/Dockerfile + environment: + - AWS_PROFILE=geotrellis + - COURSIER_CACHE=/root/.coursier + volumes: + - .:/opt/geotrellis-contrib + - $HOME/.aws:/root/.aws:ro + - $HOME/.coursier:/root/.coursier + - $HOME/.ivy2:/root/.ivy2 + - $HOME/.sbt:/root/.sbt + working_dir: /opt/geotrellis-contrib + entrypoint: ./sbt diff --git a/scripts/benchmark b/scripts/benchmark new file mode 100755 index 00000000..a0f1fb58 --- /dev/null +++ b/scripts/benchmark @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e + +if [[ -n "${GEOTRELLIS_CONTRIB_DEBUG}" ]]; then + set -x +fi + +function usage() { + echo -n \ + "Usage: $(basename "$0") +Run GeoTrellis Contrib benchmarks +" +} + +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + if [[ "${1:-}" == "--help" ]]; then + usage + else + echo "Executing GeoTrellis Contrib benchmarks" + pushd benchmark + make + popd + docker-compose run --rm benchmark "project benchmark" "jmh:run" + fi +fi