-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into model-selection-integration
- Loading branch information
Showing
34 changed files
with
902 additions
and
554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# base image off ubuntu image | ||
ARG UBUNTU_TAG=22.04 | ||
FROM docker.io/ubuntu:${UBUNTU_TAG} | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
# dependencies | ||
libboost-all-dev \ | ||
# optional dependencies | ||
libtbb-dev \ | ||
python3-dev \ | ||
python3-pip \ | ||
python3-pyparsing \ | ||
python3-numpy \ | ||
# build dependencies | ||
build-essential \ | ||
cmake \ | ||
# download dependencies | ||
git \ | ||
ca-certificates && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# build flags | ||
ARG GTSAM_GIT_TAG=4.2.0 | ||
ARG GTSAM_WITH_TBB=ON | ||
ARG GTSAM_BUILD_PYTHON=ON | ||
ARG CORES=4 | ||
|
||
# build and install gtsam | ||
RUN mkdir -p /src/github/borglab && cd /src/github/borglab && \ | ||
git clone https://github.com/borglab/gtsam --depth 1 --branch ${GTSAM_GIT_TAG} && \ | ||
cd gtsam && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DGTSAM_BUILD_TESTS=OFF \ | ||
-DGTSAM_WITH_TBB=${GTSAM_WITH_TBB} \ | ||
-DGTSAM_BUILD_PYTHON=${GTSAM_BUILD_PYTHON} \ | ||
.. && \ | ||
make -j${CORES} install && \ | ||
if [ "${GTSAM_BUILD_PYTHON}" = "ON" ] ; then \ | ||
make python-install; \ | ||
fi | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# GTSAM Containers | ||
|
||
- container files to build images | ||
- script to push images to a registry | ||
- instructions to pull images and run containers | ||
|
||
## Dependencies | ||
|
||
- a container engine such as [`Docker Engine`](https://docs.docker.com/engine/install/) | ||
|
||
## Pull from Docker Hub | ||
|
||
Various GTSAM image configurations are available at [`docker.io/borglab/gtsam`](https://hub.docker.com/r/borglab/gtsam). Determine which [tag](https://hub.docker.com/r/borglab/gtsam/tags) you want and pull the image. | ||
|
||
Example for pulling an image with GTSAM compiled with TBB and Python support on top of a base Ubuntu 22.04 image. | ||
|
||
```bash | ||
docker pull docker.io/borglab/gtsam:4.2.0-tbb-ON-python-ON_22.04 | ||
``` | ||
|
||
[`docker.io/borglab/gtsam-vnc`](https://hub.docker.com/r/borglab/gtsam-vnc) is also provided as an image with GTSAM that will run a VNC server to connect to. | ||
|
||
## Using the images | ||
|
||
### Just GTSAM | ||
|
||
To start the image, execute | ||
|
||
```bash | ||
docker run -it borglab/gtsam:4.2.0-tbb-ON-python-OFF_22.04 | ||
``` | ||
|
||
after you will find yourself in a bash shell. | ||
|
||
### GTSAM with Python wrapper | ||
|
||
To use GTSAM via the python wrapper, similarly execute | ||
|
||
```bash | ||
docker run -it borglab/gtsam:4.2.0-tbb-ON-python-ON_22.04 | ||
``` | ||
|
||
and then launch `python3`: | ||
|
||
```bash | ||
python3 | ||
>>> import gtsam | ||
>>> gtsam.Pose2(1,2,3) | ||
(1, 2, 3) | ||
``` | ||
|
||
### GTSAM with Python wrapper and VNC | ||
|
||
First, start the image, which will run a VNC server on port 5900: | ||
|
||
```bash | ||
docker run -p 5900:5900 borglab/gtsam-vnc:4.2.0-tbb-ON-python-ON_22.04 | ||
``` | ||
|
||
Then open a remote VNC X client, for example: | ||
|
||
#### Linux | ||
|
||
```bash | ||
sudo apt-get install tigervnc-viewer | ||
xtigervncviewer :5900 | ||
``` | ||
|
||
#### Mac | ||
|
||
The Finder's "Connect to Server..." with `vnc://127.0.0.1` does not work, for some reason. Using the free [VNC Viewer](https://www.realvnc.com/en/connect/download/viewer/), enter `0.0.0.0:5900` as the server. | ||
|
||
## Build images locally | ||
|
||
### Build Dependencies | ||
|
||
- a [Compose Spec](https://compose-spec.io/) implementation such as [docker-compose](https://docs.docker.com/compose/install/) | ||
|
||
### `gtsam` image | ||
|
||
#### `.env` file | ||
|
||
- `GTSAM_GIT_TAG`: [git tag from the gtsam repo](https://github.com/borglab/gtsam/tags) | ||
- `UBUNTU_TAG`: image tag provided by [ubuntu](https://hub.docker.com/_/ubuntu/tags) to base the image off of | ||
- `GTSAM_WITH_TBB`: to build GTSAM with TBB, set to `ON` | ||
- `GTSAM_BUILD_PYTHON`: to build python bindings, set to `ON` | ||
- `CORES`: number of cores to compile with | ||
|
||
#### Build `gtsam` image | ||
|
||
```bash | ||
docker compose build | ||
``` | ||
|
||
### `gtsam-vnc` image | ||
|
||
#### `gtsam-vnc/.env` file | ||
|
||
- `GTSAM_TAG`: image tag provided by [gtsam](https://hub.docker.com/r/borglab/gtsam/tags) | ||
|
||
#### Build `gtsam-vnc` image | ||
|
||
```bash | ||
docker compose --file gtsam-vnc/compose.yaml build | ||
``` | ||
|
||
## Push to Docker Hub | ||
|
||
Make sure you are logged in via: `docker login docker.io`. | ||
|
||
### `gtsam` images | ||
|
||
Specify the variables described in the `.env` file in the `hub_push.sh` script. | ||
To push images to Docker Hub, run as follows: | ||
|
||
```bash | ||
./hub_push.sh | ||
``` | ||
|
||
### `gtsam-vnc` images | ||
|
||
Specify the variables described in the `gtsam-vnc/.env` file in the `gtsam-vnc/hub_push.sh` script. | ||
To push images to Docker Hub, run as follows: | ||
|
||
```bash | ||
./gtsam-vnc/hub_push.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
services: | ||
gtsam: | ||
build: | ||
args: | ||
UBUNTU_TAG: ${UBUNTU_TAG} | ||
GTSAM_GIT_TAG: ${GTSAM_GIT_TAG} | ||
GTSAM_WITH_TBB: ${GTSAM_WITH_TBB} | ||
GTSAM_BUILD_PYTHON: ${GTSAM_BUILD_PYTHON} | ||
CORES: ${CORES} | ||
context: . | ||
dockerfile: Containerfile | ||
env_file: | ||
- .env | ||
image: gtsam:${GTSAM_GIT_TAG}-tbb-${GTSAM_WITH_TBB}-python-${GTSAM_BUILD_PYTHON}_${UBUNTU_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This image connects to the host X-server via VNC to provide a Graphical User Interface for interaction. | ||
|
||
# base image off gtsam image | ||
ARG GTSAM_TAG=4.2.0-tbb-ON-python-ON_22.04 | ||
FROM docker.io/borglab/gtsam:${GTSAM_TAG} | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
# Things needed to get a python GUI | ||
python3-tk \ | ||
python3-matplotlib \ | ||
# Install a VNC X-server, Frame buffer, and windows manager | ||
x11vnc \ | ||
xvfb \ | ||
fluxbox \ | ||
# Finally, install wmctrl needed for bootstrap script | ||
wmctrl \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY bootstrap.sh / | ||
CMD ["/bootstrap.sh"] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
services: | ||
gtsam_vnc: | ||
build: | ||
args: | ||
GTSAM_TAG: ${GTSAM_TAG} | ||
context: . | ||
dockerfile: Containerfile | ||
env_file: | ||
- .env | ||
image: gtsam-vnc:${GTSAM_TAG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
# A script to push images to Docker Hub | ||
|
||
declare -a gtsam_tags=("4.2.0-tbb-ON-python-ON_22.04") | ||
|
||
for gtsam_tag in "${gtsam_tags[@]}"; do | ||
|
||
touch gtsam-vnc/.env | ||
echo "GTSAM_TAG=${gtsam_tag}" > gtsam-vnc/.env | ||
|
||
docker compose --file gtsam-vnc/compose.yaml build | ||
|
||
docker tag gtsam-vnc:"${gtsam_tag}" \ | ||
docker.io/borglab/gtsam-vnc:"${gtsam_tag}" | ||
|
||
docker push docker.io/borglab/gtsam-vnc:"${gtsam_tag}" | ||
|
||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
# A script to push images to Docker Hub | ||
|
||
declare -a ubuntu_tags=("22.04") | ||
declare -a gtsam_git_tags=("4.2.0") | ||
declare -a gtsam_with_tbb_options=("OFF" "ON") | ||
declare -a gtsam_build_python_options=("OFF" "ON") | ||
|
||
for ubuntu_tag in "${ubuntu_tags[@]}"; do | ||
for gtsam_git_tag in "${gtsam_git_tags[@]}"; do | ||
for gtsam_with_tbb in "${gtsam_with_tbb_options[@]}"; do | ||
for gtsam_build_python in "${gtsam_build_python_options[@]}"; do | ||
|
||
touch .env | ||
echo "UBUNTU_TAG=${ubuntu_tag}" > .env | ||
echo "GTSAM_GIT_TAG=${gtsam_git_tag}" >> .env | ||
echo "GTSAM_WITH_TBB=${gtsam_with_tbb}" >> .env | ||
echo "GTSAM_BUILD_PYTHON=${gtsam_build_python}" >> .env | ||
echo "CORES=4" >> .env | ||
|
||
docker compose build | ||
|
||
docker tag gtsam:"${gtsam_git_tag}-tbb-${gtsam_with_tbb}-python-${gtsam_build_python}_${ubuntu_tag}" \ | ||
docker.io/borglab/gtsam:"${gtsam_git_tag}-tbb-${gtsam_with_tbb}-python-${gtsam_build_python}_${ubuntu_tag}" | ||
|
||
docker push docker.io/borglab/gtsam:"${gtsam_git_tag}-tbb-${gtsam_with_tbb}-python-${gtsam_build_python}_${ubuntu_tag}" | ||
|
||
done | ||
done | ||
done | ||
done |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.