Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otbtf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Orfeo ToolBox
otbtf
Commits
ba45a5ad
Commit
ba45a5ad
authored
4 years ago
by
Vincent Delbar
Browse files
Options
Downloads
Patches
Plain Diff
FIX: Docker - let bazel deal with optimizations
parent
40713c0a
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile
+4
-2
4 additions, 2 deletions
Dockerfile
tools/docker/README.md
+6
-6
6 additions, 6 deletions
tools/docker/README.md
tools/docker/build-env-tf.sh
+4
-3
4 additions, 3 deletions
tools/docker/build-env-tf.sh
tools/docker/multibuild.sh
+3
-3
3 additions, 3 deletions
tools/docker/multibuild.sh
with
17 additions
and
14 deletions
Dockerfile
+
4
−
2
View file @
ba45a5ad
...
...
@@ -50,8 +50,10 @@ RUN wget https://github.com/bazelbuild/bazel/releases/download/$BAZEL/bazel-$BAZ
### TF
ARG
TF=r2.4
ARG
BZL_TARGETS="//tensorflow:libtensorflow_cc.so //tensorflow:libtensorflow_framework.so //tensorflow/tools/pip_package:build_pip_package"
ARG
BZL_CONFIG="--config=opt --config=nogcp --config=noaws --config=nohdfs"
ARG
BZL_OPTIONS="--compilation_mode opt --verbose_failures --remote_cache=http://localhost:9090"
# --config=opt with bazel's default optimizations
ARG
BZL_CONFIG="--config=nogcp --config=noaws --config=nohdfs --config=opt"
# --compilation_mode opt is already enabled by default (see tf repo .bazelrc and configure.py)
ARG
BZL_OPTIONS="--verbose_failures --remote_cache=http://localhost:9090"
RUN
mkdir
/src/tf
WORKDIR
/src/tf
...
...
This diff is collapsed.
Click to expand it.
tools/docker/README.md
+
6
−
6
View file @
ba45a5ad
...
...
@@ -13,8 +13,8 @@ BAZEL=3.1.0
TF=r2.4
OTB=release-7.2
BZL_TARGETS="//tensorflow:libtensorflow_cc.so //tensorflow:libtensorflow_framework.so //tensorflow/tools/pip_package:build_pip_package"
BZL_CONFIG="
--config=opt
--config=nogcp --config=noaws --config=nohdfs"
BZL_OPTIONS="
--compilation_mode opt
--verbose_failures --remote_cache=http://localhost:9090"
BZL_CONFIG="--config=nogcp --config=noaws --config=nohdfs
--config=opt
"
BZL_OPTIONS="--verbose_failures --remote_cache=http://localhost:9090"
KEEP_SRC_TF=false
KEEP_SRC_OTB=false
SUDO=true
...
...
@@ -41,20 +41,20 @@ Then ust add ` --network='host'` to the docker build command, or connect bazel t
# Build for CPU using default Dockerfiles args (without AWS, HDFS and GCP support)
docker build
--network
=
'host'
-t
otbtf:cpu
--build-arg
BASE_IMG
=
ubuntu:18.04
.
# Clear bazel config var
# Clear bazel config var
(deactivate optimizations and unset noaws/nogcp/nohdfs)
docker build
--network
=
'host'
-t
otbtf:cpu
--build-arg
BASE_IMG
=
ubuntu:18.04
--build-arg
BZL_CONFIG
=
.
# Build with latest CUDA
docker build
--network
=
'host'
-t
otbtf:gpu-dev
--build-arg
BASE_IMG
=
nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04
--build-arg
KEEP_SRC_OTB
=
true
.
# Enable MKL
BZ
L_CONFIG
=
"
--config=opt
--config=nogcp --config=noaws --config=nohdfs --config=mkl --copt='-mfpmath=both'"
docker build
--network
=
'host'
-t
otbtf:cpu-mkl
--build-arg
BZL_CONFIG
=
$
BZ
L_CONFIG
--build-arg
BASE_IMG
=
nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04
.
MK
L_CONFIG
=
"--config=nogcp --config=noaws --config=nohdfs --config=mkl
--config=opt
--copt='-mfpmath=both'"
docker build
--network
=
'host'
-t
otbtf:cpu-mkl
--build-arg
BZL_CONFIG
=
$
MK
L_CONFIG
--build-arg
BASE_IMG
=
nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04
.
# Manage versions
docker build
--network
=
'host'
-t
otbtf:oldstable-gpu
--build-arg
BASE_IMG
=
nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
\
--build-arg
TF
=
r2.1
--build-arg
BAZEL
=
0.29.1
--build-arg
OTB
=
release-7.2
\
--build-arg
BAZEL_OPTIONS
=
"--noincompatible_do_not_split_linking_cmdline
-c opt
--verbose_failures"
.
--build-arg
BAZEL_OPTIONS
=
"--noincompatible_do_not_split_linking_cmdline --verbose_failures"
.
# You could edit the Dockerfile to clone an old branch of the repo instead of cp new files from the build context
```
...
...
This diff is collapsed.
Click to expand it.
tools/docker/build-env-tf.sh
+
4
−
3
View file @
ba45a5ad
# TF - bazel build env variables
# Optimization is controlled with bazel -c opt
export
CC_OPT_FLAGS
=
"-march=native -Wno-sign-compare"
export
GCC_HOST_COMPILER_PATH
=
$(
which gcc
)
# Optimization is controlled with bazel --config=opt, it will set AVX and SSE flags on linux if possible (without the march=native flag)
# It is disabled in TF2.4 config, you may pass it with --copt='-march=native', see BZL_CONFIG arg or just uncomment this line
#export CC_OPT_FLAGS="-march=native -Wno-sign-compare"
export
PYTHON_BIN_PATH
=
$(
which python
)
export
PYTHON_LIB_PATH
=
"
$(
$PYTHON_BIN_PATH
-c
'import site; print(site.getsitepackages()[0])'
)
"
export
TF_ENABLE_XLA
=
1
...
...
@@ -21,7 +22,7 @@ export TF_SET_ANDROID_WORKSPACE=0
#export TF_NEED_AWS=0
#export TF_NEED_GCP=0
#export TF_NEED_HDFS=0
# For MKL support BZL_CONFIG+=" --config=mkl --copt='-mfpmath=both'"
# For MKL support BZL_CONFIG+=" --config=mkl
--config=opt
--copt='-mfpmath=both'"
#export TF_DOWNLOAD_MKL=1
#export TF_NEED_MKL=0
...
...
This diff is collapsed.
Click to expand it.
tools/docker/multibuild.sh
+
3
−
3
View file @
ba45a5ad
...
...
@@ -17,10 +17,10 @@ docker run -d -u 1000:1000 -v $HOME/.cache/bazel-remote:/data -p 9090:8080 buch
#docker build --network='host' -t mdl4eo/otbtf$RELEASE:cpu --build-arg BASE_IMG=$IMG .
#docker build --network='host' -t mdl4eo/otbtf$RELEASE:cpu-dev --build-arg BASE_IMG=$IMG --build-arg KEEP_SRC_OTB=true .
# Enable MKL with bazel config flag
CONF
=
"
--config=opt
--config=nogcp --config=noaws --config=nohdfs --config=mkl --copt='-mfpmath=both'"
docker build
--network
=
'host'
-t
mdl4eo/otbtf
$RELEASE
:cpu
--build-arg
BASE_IMG
=
$IMG
--build-arg
BZL_CONFIG
=
"
$CONF
"
.
MKL_
CONF
=
"--config=nogcp --config=noaws --config=nohdfs --config=mkl
--config=opt
--copt='-mfpmath=both'"
docker build
--network
=
'host'
-t
mdl4eo/otbtf
$RELEASE
:cpu
--build-arg
BASE_IMG
=
$IMG
--build-arg
BZL_CONFIG
=
"
$
MKL_
CONF
"
.
# Keep OTB src and build files in order to rebuild with other modules
docker build
--network
=
'host'
-t
mdl4eo/otbtf
$RELEASE
:cpu-dev
--build-arg
BASE_IMG
=
$IMG
--build-arg
BZL_CONFIG
=
"
$CONF
"
--build-arg
KEEP_SRC_OTB
=
true
.
docker build
--network
=
'host'
-t
mdl4eo/otbtf
$RELEASE
:cpu-dev
--build-arg
BASE_IMG
=
$IMG
--build-arg
BZL_CONFIG
=
"
$
MKL_
CONF
"
--build-arg
KEEP_SRC_OTB
=
true
.
# GPU support is enabled if CUDA is found in /usr/local
docker build
--network
=
'host'
-t
mdl4eo/otbtf
$RELEASE
:gpu
--build-arg
BASE_IMG
=
$GPU_IMG
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment