From 0fb8786687ea872b175ea84fdf0d0cd3c3e1c41e Mon Sep 17 00:00:00 2001 From: Remi Cresson <remi.cresson@inrae.fr> Date: Thu, 22 Sep 2022 11:22:31 +0200 Subject: [PATCH 1/4] DOC: update docker images list --- doc/DOCKERUSE.md | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/doc/DOCKERUSE.md b/doc/DOCKERUSE.md index 50e505de..201b5b71 100644 --- a/doc/DOCKERUSE.md +++ b/doc/DOCKERUSE.md @@ -7,12 +7,12 @@ Since OTBTF >= 3.2.1 you can find latest docker images on [gitlab.irstea.fr](htt | Name | Os | TF | OTB | Description | Dev files | Compute capability | |------------------------------------------------------------------------------------| ------------- | ------ |-------| ---------------------- | --------- | ------------------ | -| **mdl4eo/otbtf:3.3.0-cpu** | Ubuntu Focal | r2.8 | 8.0.1 | CPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6| -| **mdl4eo/otbtf:3.3.0-cpu-dev** | Ubuntu Focal | r2.8 | 8.0.1 | CPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6| -| **mdl4eo/otbtf:3.3.0-gpu** | Ubuntu Focal | r2.8 | 8.0.1 | GPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6| -| **mdl4eo/otbtf:3.3.0-gpu-dev** | Ubuntu Focal | r2.8 | 8.0.1 | GPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6| -| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:3.3.0-gpu-opt** | Ubuntu Focal | r2.8 | 8.0.1 | GPU with opt. | no | 5.2,6.1,7.0,7.5,8.6| -| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:3.3.0-gpu-opt-dev** | Ubuntu Focal | r2.8 | 8.0.1 | GPU with opt. (dev) | yes | 5.2,6.1,7.0,7.5,8.6| +| **mdl4eo/otbtf:3.3.2-cpu** | Ubuntu Focal | r2.8 | 8.1.0 | CPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6| +| **mdl4eo/otbtf:3.3.2-cpu-dev** | Ubuntu Focal | r2.8 | 8.1.0 | CPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6| +| **mdl4eo/otbtf:3.3.2-gpu** | Ubuntu Focal | r2.8 | 8.1.0 | GPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6| +| **mdl4eo/otbtf:3.3.2-gpu-dev** | Ubuntu Focal | r2.8 | 8.1.0 | GPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6| +| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:3.3.2-gpu-opt** | Ubuntu Focal | r2.8 | 8.1.0 | GPU with opt. | no | 5.2,6.1,7.0,7.5,8.6| +| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:3.3.2-gpu-opt-dev** | Ubuntu Focal | r2.8 | 8.1.0 | GPU with opt. (dev) | yes | 5.2,6.1,7.0,7.5,8.6| The list of older releases is available [here](#older-docker-releases). @@ -37,7 +37,7 @@ For instance, suppose you have some data in `/mnt/my_device/` that you want to u The following command shows you how to access the folder from the docker image. ```bash -docker run -v /mnt/my_device/:/data/ -ti mdl4eo/otbtf:3.3.0-cpu bash -c "ls /data" +docker run -v /mnt/my_device/:/data/ -ti mdl4eo/otbtf:3.3.2-cpu bash -c "ls /data" ``` Beware of ownership issues! see the last section of this doc. @@ -50,13 +50,13 @@ You can then use the OTBTF `gpu` tagged docker images with the **NVIDIA runtime* With Docker version earlier than 19.03 : ```bash -docker run --runtime=nvidia -ti mdl4eo/otbtf:3.3.0-gpu bash +docker run --runtime=nvidia -ti mdl4eo/otbtf:3.3.2-gpu bash ``` With Docker version including and after 19.03 : ```bash -docker run --gpus all -ti mdl4eo/otbtf:3.3.0-gpu bash +docker run --gpus all -ti mdl4eo/otbtf:3.3.2-gpu bash ``` You can find some details on the **GPU docker image** and some **docker tips and tricks** on [this blog](https://mdl4eo.irstea.fr/2019/10/15/otbtf-docker-image-with-gpu/). @@ -69,7 +69,7 @@ Be careful though, these infos might be a bit outdated... 1. Install [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10#manual-installation-steps) (Windows Subsystem for Linux) 2. Install [docker desktop](https://www.docker.com/products/docker-desktop) 3. Start **docker desktop** and **enable WSL2** from *Settings* > *General* then tick the box *Use the WSL2 based engine* -3. Open a **cmd.exe** or **PowerShell** terminal, and type `docker create --name otbtf-cpu --interactive --tty mdl4eo/otbtf:3.3.0-cpu` +3. Open a **cmd.exe** or **PowerShell** terminal, and type `docker create --name otbtf-cpu --interactive --tty mdl4eo/otbtf:3.3.2-cpu` 4. Open **docker desktop**, and check that the docker is running in the **Container/Apps** menu  5. From **docker desktop**, click on the icon highlighted as shown below, and use the bash terminal that should pop up! @@ -118,12 +118,12 @@ sudo systemctl {status,enable,disable,start,stop} docker Run a simple command in a one-shot container: ```bash -docker run mdl4eo/otbtf:3.3.0-cpu otbcli_PatchesExtraction +docker run mdl4eo/otbtf:3.3.2-cpu otbcli_PatchesExtraction ``` You can also use the image in interactive mode with bash: ```bash -docker run -ti mdl4eo/otbtf:3.3.0-cpu bash +docker run -ti mdl4eo/otbtf:3.3.2-cpu bash ``` ### Persistent container @@ -133,7 +133,7 @@ Beware of ownership issues, see the last section of this doc. ```bash docker create --interactive --tty --volume /home/$USER:/home/otbuser/ \ - --name otbtf mdl4eo/otbtf:3.3.0-cpu /bin/bash + --name otbtf mdl4eo/otbtf:3.3.2-cpu /bin/bash ``` ### Interactive session @@ -197,7 +197,7 @@ Create a named container (here with your HOME as volume), Docker will automatica ```bash docker create --interactive --tty --volume /home/$USER:/home/otbuser \ - --name otbtf mdl4eo/otbtf:3.3.0-cpu /bin/bash + --name otbtf mdl4eo/otbtf:3.3.2-cpu /bin/bash ``` Start a background container process: @@ -264,4 +264,11 @@ Here you can find the list of older releases of OTBTF: | **mdl4eo/otbtf:3.1-gpu** | Ubuntu Focal | r2.8 | 7.4.0 | GPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6| | **mdl4eo/otbtf:3.1-gpu-dev** | Ubuntu Focal | r2.8 | 7.4.0 | GPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6| | **mdl4eo/otbtf:3.1-gpu-opt** | Ubuntu Focal | r2.8 | 7.4.0 | GPU | no | 5.2,6.1,7.0,7.5,8.6| -| **mdl4eo/otbtf:3.1-gpu-opt-dev** | Ubuntu Focal | r2.8 | 7.4.0 | GPU (dev) | yes | 5.2,6.1,7.0,7.5,8.6| \ No newline at end of file +| **mdl4eo/otbtf:3.1-gpu-opt-dev** | Ubuntu Focal | r2.8 | 7.4.0 | GPU (dev) | yes | 5.2,6.1,7.0,7.5,8.6| +| **mdl4eo/otbtf:3.3.0-cpu** | Ubuntu Focal | r2.8 | 8.0.1 | CPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6| +| **mdl4eo/otbtf:3.3.0-cpu-dev** | Ubuntu Focal | r2.8 | 8.0.1 | CPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6| +| **mdl4eo/otbtf:3.3.0-gpu** | Ubuntu Focal | r2.8 | 8.0.1 | GPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6| +| **mdl4eo/otbtf:3.3.0-gpu-dev** | Ubuntu Focal | r2.8 | 8.0.1 | GPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6| +| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:3.3.0-gpu-opt** | Ubuntu Focal | r2.8 | 8.0.1 | GPU with opt. | no | 5.2,6.1,7.0,7.5,8.6| +| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:3.3.0-gpu-opt-dev** | Ubuntu Focal | r2.8 | 8.0.1 | GPU with opt. (dev) | yes | 5.2,6.1,7.0,7.5,8.6| + -- GitLab From 316135c6f5e97dfd8beefe3e2841fc549b0ba1e5 Mon Sep 17 00:00:00 2001 From: Remi Cresson <remi.cresson@inrae.fr> Date: Thu, 22 Sep 2022 11:22:58 +0200 Subject: [PATCH 2/4] DOC: update version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c2a13a9c..fe4e305a 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ For now you have two options: either use the existing **docker image**, or build Use the latest CPU or GPU-enabled image from dockerhub: ``` -docker run mdl4eo/otbtf:3.3.0-cpu otbcli_PatchesExtraction -help +docker run mdl4eo/otbtf:3.3.2-cpu otbcli_PatchesExtraction -help ``` Read more in the [docker use documentation](doc/DOCKERUSE.md). -- GitLab From b78ec22cbca854387448c3e74140c5b9ee17aeed Mon Sep 17 00:00:00 2001 From: Remi Cresson <remi.cresson@inrae.fr> Date: Thu, 22 Sep 2022 11:23:13 +0200 Subject: [PATCH 3/4] COMP: 3.3.0 --> 3.3.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9725b146..9a7f6eb0 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setuptools.setup( name="otbtf", - version="3.3.0", + version="3.3.2", author="Remi Cresson", author_email="remi.cresson@inrae.fr", description="OTBTF: Orfeo ToolBox meets TensorFlow", -- GitLab From 80a84efaf3851947fc47774968bfc813b93d5955 Mon Sep 17 00:00:00 2001 From: Remi Cresson <remi.cresson@inrae.fr> Date: Thu, 22 Sep 2022 11:23:25 +0200 Subject: [PATCH 4/4] DOC: update docker images list --- tools/docker/README.md | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/tools/docker/README.md b/tools/docker/README.md index dc718e68..3dcf38f8 100644 --- a/tools/docker/README.md +++ b/tools/docker/README.md @@ -1,8 +1,8 @@ # Build with Docker -Docker build has to be called from the root of the repository (i.e. `docker build .` or `bash tools/docker/multibuild.sh`). +Docker build has to be called from the root of the repository (i.e. `docker build .` or `bash tools/docker/multibuild.sh`). You can build a custom image using `--build-arg` and several config files : - Ubuntu : `BASE_IMG` should accept any version, for additional packages see [build-deps-cli.txt](build-deps-cli.txt) and [build-deps-gui.txt](build-deps-gui.txt). -- TensorFlow : `TF` arg for the git branch or tag + [build-env-tf.sh](build-env-tf.sh) and BZL_* arguments for the build configuration. `ZIP_TF_BIN` allows you to save compiled binaries if you want to install it elsewhere. +- TensorFlow : `TF` arg for the git branch or tag + [build-env-tf.sh](build-env-tf.sh) and BZL_* arguments for the build configuration. `ZIP_TF_BIN` allows you to save compiled binaries if you want to install it elsewhere. - OrfeoToolBox : `OTB` arg for the git branch or tag + [build-flags-otb.txt](build-flags-otb.txt) to edit cmake flags. Set `KEEP_SRC_OTB` in order to preserve OTB git directory. ### Base images @@ -20,8 +20,8 @@ BASE_IMG # mandatory CPU_RATIO=1 GUI=false NUMPY_SPEC="==1.19.*" -TF=v2.5.0 -OTB=7.3.0 +TF=v2.8.0 +OTB=8.1.0 BZL_TARGETS="//tensorflow:libtensorflow_cc.so //tensorflow/tools/pip_package:build_pip_package" BZL_CONFIGS="--config=nogcp --config=noaws --config=nohdfs --config=opt" BZL_OPTIONS="--verbose_failures --remote_cache=http://localhost:9090" @@ -32,13 +32,14 @@ SUDO=true # NumPy version requirement : # TF < 2.4 : "numpy<1.19.0,>=1.16.0" # TF >= 2.4 : "numpy==1.19.*" +# TF >= 2.8 : "numpy==1.22.*" ``` ### Bazel remote cache daemon -If you just need to rebuild with different GUI or KEEP_SRC arguments, or may be a different branch of OTB, bazel cache will help you to rebuild everything except TF, even if the docker cache was purged (after `docker [system|builder] prune`). -In order to recycle the cache, bazel config and TF git tag should be exactly the same, any change in [build-env-tf.sh](build-env-tf.sh) and `--build-arg` (if related to bazel env, cuda, mkl, xla...) may result in a fresh new build. +If you just need to rebuild with different GUI or KEEP_SRC arguments, or may be a different branch of OTB, bazel cache will help you to rebuild everything except TF, even if the docker cache was purged (after `docker [system|builder] prune`). +In order to recycle the cache, bazel config and TF git tag should be exactly the same, any change in [build-env-tf.sh](build-env-tf.sh) and `--build-arg` (if related to bazel env, cuda, mkl, xla...) may result in a fresh new build. -Start a cache daemon - here with max 20GB but 10GB should be enough to save 2 TF builds (GPU and CPU): +Start a cache daemon - here with max 20GB but 10GB should be enough to save 2 TF builds (GPU and CPU): ```bash mkdir -p $HOME/.cache/bazel-remote docker run --detach -u 1000:1000 -v $HOME/.cache/bazel-remote:/data -p 9090:8080 buchgr/bazel-remote-cache --max_size=20 @@ -73,6 +74,9 @@ docker build --network='host' -t otbtf:oldstable-gpu --build-arg BASE_IMG=nvidia ``` ### Build for another machine and save TF compiled files + +Example with TF 2.5 + ```bash # Use same ubuntu and CUDA version than your target machine, beware of CC optimization and CPU compatibility # (set env variable CC_OPT_FLAGS and avoid "-march=native" if your Docker's CPU is optimized with AVX2/AVX512 but your target CPU isn't) @@ -104,14 +108,14 @@ cmake $OTB_GIT \ ``` ### Debug build -If you fail to build, you can log into the last layer and check CMake logs. Run `docker images`, find the latest layer ID and run a tmp container (`docker run -it d60496d9612e bash`). -You may also need to split some multi-command layers in the Dockerfile. -If you see OOM errors during SuperBuild you should decrease CPU_RATIO (e.g. 0.75). +If you fail to build, you can log into the last layer and check CMake logs. Run `docker images`, find the latest layer ID and run a tmp container (`docker run -it d60496d9612e bash`). +You may also need to split some multi-command layers in the Dockerfile. +If you see OOM errors during SuperBuild you should decrease CPU_RATIO (e.g. 0.75). ## Container examples ```bash # Pull GPU image and create a new container with your home directory as volume (requires apt package nvidia-docker2 and CUDA>=11.0) -docker create --gpus=all --volume $HOME:/home/otbuser/volume -it --name otbtf-gpu mdl4eo/otbtf:3.3.0-gpu +docker create --gpus=all --volume $HOME:/home/otbuser/volume -it --name otbtf-gpu mdl4eo/otbtf:3.3.2-gpu # Run interactive docker start -i otbtf-gpu @@ -123,7 +127,7 @@ docker exec otbtf-gpu python -c 'import tensorflow as tf; print(tf.test.is_gpu_a ### Rebuild OTB with more modules ```bash -docker create --gpus=all -it --name otbtf-gpu-dev mdl4eo/otbtf:3.3.0-gpu-dev +docker create --gpus=all -it --name otbtf-gpu-dev mdl4eo/otbtf:3.3.2-gpu-dev docker start -i otbtf-gpu-dev ``` ```bash @@ -146,10 +150,10 @@ $ mapla ``` ## Common errors -Build : -`Error response from daemon: manifest for nvidia/cuda:11.0-cudnn8-devel-ubuntu20.04 not found: manifest unknown: manifest unknown` +Build : +`Error response from daemon: manifest for nvidia/cuda:11.0-cudnn8-devel-ubuntu20.04 not found: manifest unknown: manifest unknown` => Image is missing from dockerhub -Run : -`failed call to cuInit: UNKNOWN ERROR (303) / no NVIDIA GPU device is present: /dev/nvidia0 does not exist` +Run : +`failed call to cuInit: UNKNOWN ERROR (303) / no NVIDIA GPU device is present: /dev/nvidia0 does not exist` => Nvidia driver is missing or disabled, make sure to add ` --gpus=all` to your docker run or create command -- GitLab