Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Battle of bazel build - OPTiM TECH NIGHT
Search
optim
October 24, 2019
Technology
0
610
Battle of bazel build - OPTiM TECH NIGHT
optim
October 24, 2019
Tweet
Share
More Decks by optim
See All by optim
Vue.jsを用いて数万の農地データ情報を数秒で表示させるまでのカイゼンの軌跡
optim
0
19
Metabaseを使ったコスト可視化とコスト最適化への道 / sre-cost-visualization
optim
0
450
新卒がアプリをEKSにデプロイした話 / sre-newcomer-deploy-app-to-eks
optim
1
250
Rustのイテレーター完全制覇 / domination-of-the-rust-iterators
optim
3
2.8k
JaSSTnano20210615
optim
0
1.3k
大規模IoTシステムにおけるキャパシティプランニングの実践 / capacity-planning-iot
optim
0
520
QA for Green Engineer
optim
0
660
ProductionReadyと開発プロセス改善
optim
0
150
Terraform活用事例 / Terraform Use Cases
optim
1
240
Other Decks in Technology
See All in Technology
推しは推せるときに推せ! プロダクトにフィードバックしていこう
nakasho
0
320
家族アルバム みてねにおけるGrafana活用術 / Grafana Meetup Japan Vol.1 LT
isaoshimizu
1
780
DMM.com アルファ室採用案内資料
hsugita
1
160
AOAI をきっかけに 社内の Azure 管理を見直した話
recruitengineers
PRO
1
300
IaCジェネレーターとBedrockで詳細設計書を生成してみた
tsukasa_ishimaru
2
280
エンジニア候補者向け資料2024.04.24.pdf
macloud
0
3.3k
Building Dashboards as a Hobby
egmc
0
240
SIEMを用いて、セキュリティログ分析の可視化と分析を実現し、PDCAサイクルを回してみた
coconala_engineer
0
340
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
220
プロンプトエンジニアリングでがんばらない-Agentic Workflow へ-近藤憲児
kenjikondobai
3
920
開発生産性大幅アップ!Postman VS Code拡張機能
nagix
2
390
プロトタイピングによる不確実性の低減 / Reducing Uncertainty through Prototyping
ohbarye
5
390
Featured
See All Featured
Designing for Performance
lara
601
67k
[RailsConf 2023] Rails as a piece of cake
palkan
23
4k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Into the Great Unknown - MozCon
thekraken
10
1k
Stop Working from a Prison Cell
hatefulcrawdad
266
19k
Docker and Python
trallard
34
2.7k
Adopting Sorbet at Scale
ufuk
68
8.6k
Practical Orchestrator
shlominoach
182
9.7k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
104
6.6k
Product Roadmaps are Hard
iamctodd
44
9.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
20
1.9k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
2
1.3k
Transcript
Copyright © OPTiM Corp. All Right Reserved. 1 2019/10/24 OPTiM
TECH NIGHT Battle of bazel build (Googleビルドツールではまらないための対策)
Copyright © OPTiM Corp. All Right Reserved. 2 徳⽥ (
@dakuton) OPTiM Corporation / R&D Team 2009年⼊社 定量・⾳声データ解析 + エッジ推論 ⾃⼰紹介 https://speakerdeck.com/dakuton
Copyright © OPTiM Corp. All Right Reserved. 3 Getting Startedで
Install Bazel and use bazel build って書いてあるけど… まとめ # Using Bazel's APT repository $ sudo apt-get install bazel Failed # for macOS $ brew install bazel Failed
Copyright © OPTiM Corp. All Right Reserved. 4 Googleが中⼼となって開発しているOSS等で⽤いられているビルドツール Bazelとは︖
並列実⾏ 差分ビルド(テスト) Platform: Java, C++, Go, Android, iOS, etc HostOS: Ubuntu, CentOS, macOS , Windows ビルド⼀意性を担保 CI等でビルド再現が容易 Fast Multiple Languages Reproducible Extensible Starlark(Python likeな⾔語)による ビルドスクリプト拡張 https://bazel.build/faq.html
Copyright © OPTiM Corp. All Right Reserved. 5 利⽤例: モバイル機械学習
Copyright © OPTiM Corp. All Right Reserved. 6 利⽤例: モバイル機械学習
Copyright © OPTiM Corp. All Right Reserved. 7 Googleが中⼼となって開発しているOSS等で⽤いられているビルドツール MediapipeでのBazel活⽤
並列実⾏ 差分ビルド(テスト) Platform: Java, C++, Go, Android, iOS, etc HostOS: Ubuntu, CentOS, macOS, Windows ビルド⼀意性を担保 CI等でビルド再現が容易 Fast Multiple Languages Extensible Starlark(Python likeな⾔語)による ビルドスクリプト拡張 Reproducible のクロスプラットフォームビルドを で実現
Copyright © OPTiM Corp. All Right Reserved. 8 Build from
sourceで Install Bazel and use bazel build に従うとBazelの破壊的変更で互換性がないバージョンがインストールされる Bazel利⽤による問題点1 # for macOS $ brew install bazel Success $ bazel build -c opt --config=android_arm64 mediapipe/examples/andr oid/src/java/com/google/mediapipe/apps/handtrackinggpu Failed 10/24時点で1.1.0がインストールされる
Copyright © OPTiM Corp. All Right Reserved. 9 Bazel必要バージョン確認⽅法 •
⽐較的規模の⼤きいプロジェクトであればCI向けのビルドスクリプト or Dockerfileが ⽤意されているので利⽤しているバージョンを確認しインストール • https://github.com/tensorflow/tensorflow/blob/r2.0/tensorflow/tools/ci_build/ install/install_bazel.sh 破壊的変更のチェック⽅法 • --incompatible_xxxxxxx や --experimental_xxxxxxx と指定されているものが対象 • --all_incompatible_changes で影響をチェック Bazel利⽤による問題点1(対策)
Copyright © OPTiM Corp. All Right Reserved. 10 Java系プロジェクトで起こっていた問題(現在は修正済み) bazel
build対象プロジェクトとBazel本体で要求されるJDKが異なる Bazel利⽤による問題点2 <<<<<<< HEAD apt-get update && apt-get install -y openjdk-11-jdk ======= apt-get update && apt-get install -y openjdk-8-jdk >>>>>>> Project import generated by Copybara. https://github.com/google/mediapipe/commit/af676420555f60c71c481f597d5ed3aa3b4f6789 Android SDKはOpenJDK 11⾮対応
Copyright © OPTiM Corp. All Right Reserved. 11 Bazel利⽤による問題点2(+対策) $
sudo apt-get -qqy install gnupg2 $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 $ sudo apt-add-repository "deb http://repos.azul.com/azure-only/zulu/apt stable main" $ sudo apt-get -q update $ sudo apt-get -y install zulu-8-azure-jdk $ bazel info java-runtime OpenJDK Runtime Environment (build 1.8.0_212-b04) by Azul Systems, Inc. https://mirror.bazel.build/openjdk/index.html 参考: 最適なOpenJDKディストリビューションの選び⽅ https://www.oracle.co.jp/campaign/code/2019/pdfs/oct2019_b-3-3.pdf LTSサポート終了したOpenJDKを回避する場合 Bazel JDKバンドル版が利⽤しているZulu OpenJDKを⽤いる
Copyright © OPTiM Corp. All Right Reserved. 12 余談 OracleのSSL証明書が期限失効して構築失敗してた(4/27)
Copyright © OPTiM Corp. All Right Reserved. 13 ローカル実⾏環境のリソースを⼤量に使ってビルドする ・デフォルト値だとCPUの半分+RAMの2/3を占有
Bazel利⽤による問題点3(+対策) $ bazel build //foo ¥ --local_cpu_resources=2 ¥ --local_ram_resources=2048 ⼤規模プロジェクトでは CPU+RAMリソース利⽤量を指定するのが無難
Copyright © OPTiM Corp. All Right Reserved. 14 • Install
Bazel どおりだと bazel build は失敗する • バージョンは確認してビルドしましょう まとめ
Copyright © OPTiM Corp. All Right Reserved. 15