diff --git a/.github/workflows/publish-docker-gpu.yaml b/.github/workflows/publish-docker-gpu.yaml new file mode 100644 index 00000000..f0c07dcb --- /dev/null +++ b/.github/workflows/publish-docker-gpu.yaml @@ -0,0 +1,32 @@ +name: Publish Docker GPU Images + +on: + push: + branches: + - master + tags: + - v* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push Docker image + id: docker_build + uses: docker/build-push-action@v2 + with: + file: ./gpu.Dockerfile + platforms: linux/amd64 + push: true + tags: opendronemap/odm:gpu diff --git a/configure.sh b/configure.sh index e5158848..4b3ff049 100755 --- a/configure.sh +++ b/configure.sh @@ -120,6 +120,9 @@ install() { pip install --ignore-installed -r requirements.txt + if [ ! -z "$GPU_INSTALL" ]; then + pip install --ignore-installed -r requirements.gpu.txt + fi if [ ! -z "$PORTABLE_INSTALL" ]; then echo "Replacing g++ and gcc with our scripts for portability..." diff --git a/gpu.Dockerfile b/gpu.Dockerfile index bd1069a2..63cedef0 100644 --- a/gpu.Dockerfile +++ b/gpu.Dockerfile @@ -12,7 +12,7 @@ WORKDIR /code COPY . ./ # Run the build -RUN bash configure.sh install +RUN PORTABLE_INSTALL=YES GPU_INSTALL=YES bash configure.sh install # Clean Superbuild RUN bash configure.sh clean diff --git a/opendm/gpu.py b/opendm/gpu.py index df288f9b..4284705d 100644 --- a/opendm/gpu.py +++ b/opendm/gpu.py @@ -3,7 +3,11 @@ from repoze.lru import lru_cache @lru_cache(maxsize=None) def has_gpus(): - import pyopencl + try: + import pyopencl + except: + log.ODM_INFO("PyOpenCL is missing (not a GPU build)") + return False try: platforms = pyopencl.get_platforms() diff --git a/opendm/osfm.py b/opendm/osfm.py index 5abebfc0..0d4fb751 100644 --- a/opendm/osfm.py +++ b/opendm/osfm.py @@ -217,10 +217,8 @@ class OSFMContext: # GPU acceleration? if has_gpus() and feature_type == "SIFT": log.ODM_INFO("Using GPU for extracting SIFT features") + log.ODM_INFO("--min-num-features will be ignored") feature_type = "SIFT_GPU" - - # TODO: REMOVE - config.append("matcher_type: SIFT_GPU") config.append("feature_type: %s" % feature_type) diff --git a/requirements.gpu.txt b/requirements.gpu.txt new file mode 100644 index 00000000..9b8e92e5 --- /dev/null +++ b/requirements.gpu.txt @@ -0,0 +1,2 @@ +silx>=0.12.0 +pyopencl==2021.1.1 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 783f4d04..8c852e51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,5 +27,3 @@ scikit-image==0.17.2 scipy==1.5.4 xmltodict==0.12.0 fpdf2==2.2.0rc2 -silx>=0.12.0 -pyopencl==2021.1.1 \ No newline at end of file