SlideShare ist ein Scribd-Unternehmen logo
1 von 53
Downloaden Sie, um offline zu lesen
icecream / icecc:
分散式編譯系統簡介
Date : Mar 31th, 2016
Kito Cheng
kito.cheng@gmail.com
2
自我介紹
安第斯山脈
Compiler Team
專業打雜工
3
這份簡報包含 ...
• icecc 安裝與環境的架設
• 如何使用 icecc 進行 cross-compilation
• 使用心得跟一些實驗數據
• icecc 運作原理與內部設計
• 與 distcc 的比較
4
icecc 是什麼?
• 分散式的編譯系統
– 有效利用多台機器加速編譯速度
5
icecc 是什麼?
• 分散式的編譯系統
– 有效利用多台機器加速編譯速度
• 不是一個編譯器
– 由 distcc fork 而成
•目前兩邊差異已經相當大
– 需要 GCC 或 LLVM
•官方僅支援這兩種編譯器
6
distcc 錯惹嗎 ?
7
distcc 錯惹嗎 ?
• 最單純的情況下只要設定 DISTCC_HOSTS
• 若要 cross-compilation 整個就是悲劇 ...
• 如果 server 群的環境不太一樣的話也很容易發生
悲劇
• 最後會介紹 distcc 的部份運作機制與 icecc 比較
8
安裝
• Debian/Ubuntu
– $ sudo apt-get install icecream
• Fedora
– $ sudo dnf install icecream
• CentOS
– $ sudo yum install icecream
9
Server side
• icecc 中 server 分兩種
– icecc-scheduler
•網路環境中只需要一個即可
•負責分配工作
– iceccd
•每台 Server 都需要執行 iceccd
•負責處理工作
10
Server side / scheduler
• Ubuntu/CentOS
– service icecc-scheduler start
• Fedora
– systemctl start icecc-
scheduler.service
11
Server side / iceccd
• Ubuntu/CentOS
– service iceccd start
• Fedora
– systemctl start iceccd
12
Zero config
• 正常情況下設定完全不用修改即可運作
• iceccd 打起來就會主動搜索有無 icecc-
scheduler 並且自動加入
13
icecc 設定
• 其實也是有可以設定的東西啦 ... 不過通常都不用改
就會動啦 ~
• ICECREAM_NETNAME
– 這台機器的名稱 , 預設值是 hostname
• ICECREAM_SCHEDULER_HOST
– 指定要使用哪個 Scheduler server, 不設定的話 iceccd
會自己去找區網上的其中一個
• ICECREAM_ALLOW_REMOTE
– 是否允許其他機器利用本機端來編譯 , 預設值通常是 yes
• ICECREAM_MAX_JOBS
– 這台機器最多負載的編譯工作數目 , 預設值會根據該機器
上的處理器數量來決定
14
基礎用法
• 就像使用 distcc 或 ccache 一樣
• icecc <compiler> ...
• icecc gcc foo.c -c -O
15
便利的用法
• 用個 wrapper
– ln -s /usr/bin/icecc gcc
– ln -s /usr/bin/icecc g++
– ln -s /usr/bin/icecc cc
– ln -s /usr/bin/icecc clang
– ln -s /usr/bin/icecc clang++
16
系統附贈的 icecc wrapper
• Fedora
– /usr/libexec/icecc/bin/gcc
– /usr/libexec/icecc/bin/g++
• Ubuntu
– /usr/lib/icecc/bin/gcc
– /usr/lib/icecc/bin/g++
17
實驗環境
• 硬體環境
– CPU : E3-1230 v3 @ 3.30GHz (8 logic core) * 4
– RAM : 32GB
– Network : 1 Gigabit Ethernet
• 軟體環境
– OS : Fedora 22 / Gentoo
• 系統內建 GCC 版本 : 5.3 / 5.2 / 4.9.2
– ICECC version : 1.0.90
– GCC : 4.9.3
• ICECREAM 組態
– ICECREAM_MAX_JOBS=12
18
實驗對象
• LLVM Version: r26441
• 編譯 LLVM Debug build
– Configure as :
• -DCMAKE_BUILD_TYPE=Debug
-DLLVM_OPTIMIZED_TABLEGEN=ON
• 編譯 LLVM Release build
– Configure as :
• -DCMAKE_BUILD_TYPE=Release
• 平行與分散 :
– time make -j48
– time make -j12
19
實驗數據
LLVM
Build Type
icecc gcc Speed up Total file
size
for build
folder
Release
Build
2m57.275s 10m34.657s 3.6x 919M
Debug
Build
5m10.249s 12m2.120s 2.3x 12G
20
實驗數據分析
• Release build 加速與極限值 4 倍相差不遠
– Link 階段無法平行化
• Release build 比 Debug build 還慢?
– 輸出結果要透過網路傳輸
– 900M vs 12G
21
實驗環境 2
• 硬體環境
– CPU :
• E3-1230 v3 @ 3.30GHz (8 logic core) * 5
• E3-1230 v2 @ 3.30GHz (8 logic core) * 1
– RAM : 32GB
– Network : 1 Gigabit Ethernet + 100 Megabit Ethernet
• 軟體環境
– OS : Fedora 22 / Gentoo / CentOS 6
• 系統內建 GCC 版本 : 5.3 / 5.2 / 4.9.2 / 4.4.7
– ICECC version : 1.0.90
– GCC : 5.3 (Fedora 22 內建 )
• ICECREAM 組態
– ICECREAM_MAX_JOBS=12
22
實驗數據 2
LLVM
Build Type
icecc gcc Speed up Total file
size
for build
folder
Release
Build
1m55.630s 10m34.657s 5.5x 919M
23
試過用 icecc 建置的 Project
• GCC/Binutils/Glibc/GDB
– Cross-compilation and Native
• Linux Kernel
– Cross-compilation
24ICECC 運作原理
25
運作原理
• 呼叫 gcc/clang 進行 pre-process
• 將工作丟到 iceccd
• iceccd 向 icecc-scheduler 找一台閒置
的機器
• 丟 pre-process 過後的檔案到遠端進行編
譯
• 接收遠端的編譯結果
26
icecc 的假設
• 在任意一台機器上同樣的 input 配上同
樣的 options 會輸出同樣的 output
– Input: source code
– Ouput: object code
27
任意一台機器 ?
• icecc 支援的平台 :
– Linux
– FreeBSD
– DragonFlyBSD
– OS X
• 支援不同架構
– 例如 x86_64/x86/arm/ppc/s390
Note: 只試過 x86_64 + x86 Linux 上 , 沒試過混搭 OS/Arch 的環境
28
不同架構間的相容性
• 相容列表 :
– i*86/x86_64
– ppc/ppc64
– s390/s390x
• 例如 i686 的 executable 可以直接在
x86_64 上跑
29
假設一定會成立嗎 ?
• 有些 Option 在不同機器上會有不同效果
– -mtune=native
– -march=native
– -mcpu=native
• 遇到這些 Option 就會強制 local build
30
還有其它限制嗎?
• 目前 icecc 無法處理多個 Output file
– -save-temps
– -fprofile-arcs
– -fbranch-probabilities
– -fprofile-use
– -fprofile-generate
– ...
• 遇到這類 Option 也會強制 local build
31
gcc 版本不一樣怎麼辦?
• icecc 在設計上就有考慮到這個問題
• 接著會介紹遠端接收到工作如何處理
32
icecc 運作原理 / 收到遠端工作
• 接收工作
• 確認該工作使用的編譯環境是否本地端有
沒有
– 沒有的話就跟工作來源的機器要
• 準備編譯環境
• 進行編譯
• 傳回編譯結果
33
icecc 編譯環境
• iceccd 啟動時會自動建立
– 預設找系統的 gcc/g++
• 透過 ICECC_VERSION 環境變數設定
– 使用 icecc-create-env
– 若使用系統的 gcc/g++ 可不指定
34
使用 icecc-create-env
建置編譯環境
$ icecc-create-env --gcc /usr/bin/gcc /usr/bin/g++
$ icecc-create-env --clang /usr/bin/clang
$ icecc-create-env --gcc <path-to-gcc> <path-to-g++>
$ icecc-create-env --clang <path-to-clang>
$ icecc --build-native
例如
35
使用 icecc-create-env
建置編譯環境$ icecc-create-env --gcc /usr/bin/gcc /usr/bin/g++
adding file /bin/true
adding file /lib64/libc.so.6
adding file /lib64/ld-linux-x86-64.so.2
adding file /usr/bin/gcc
adding file /lib64/libm.so.6
adding file /usr/bin/g++
adding file /usr/bin/cc1=/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/cc1
adding file /lib64/libdl.so.2
adding file /lib64/libmpc.so.3
adding file /lib64/libmpfr.so.4
adding file /lib64/libgmp.so.10
adding file /lib64/libz.so.1
adding file /usr/bin/cc1plus=/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/cc1plus
adding file /usr/bin/as
adding file /lib64/libopcodes-2.25-15.fc23.so
adding file /lib64/libbfd-2.25-15.fc23.so
adding file /usr/libexec/gcc/x86_64-redhat-linux/5.3.1/liblto_plugin.so
adding file /etc/ld.so.conf=/tmp/icecc_ld_so_confTVPvU7
cp: omitting directory ‘/lib’
cp: omitting directory ‘/lib64’
creating 873f2d89faf900aa39d8a5673521d0df.tar.gz
36
編譯環境的內容物
$ tar -tvf 873f2d89faf900aa39d8a5673521d0df.tar.gz
-rwxr-xr-x 1000/1000 28432 2016-03-22 21:53 bin/true
-rw-r--r-- 1000/1000 794 2016-03-22 21:53 etc/ld.so.cache
-rw------- 1000/1000 33 2016-03-22 21:53 etc/ld.so.conf
-rwxr-xr-x 1000/1000 142472 2016-03-22 21:53 lib64/ld-linux-x86-64.so.2
-rwxr-xr-x 1000/1000 1205936 2016-03-22 21:53 lib64/libbfd-2.25-15.fc23.so
-rwxr-xr-x 1000/1000 1833648 2016-03-22 21:53 lib64/libc.so.6
-rwxr-xr-x 1000/1000 15152 2016-03-22 21:53 lib64/libdl.so.2
-rwxr-xr-x 1000/1000 494096 2016-03-22 21:53 lib64/libgmp.so.10
-rwxr-xr-x 1000/1000 101208 2016-03-22 21:53 lib64/libmpc.so.3
-rwxr-xr-x 1000/1000 396680 2016-03-22 21:53 lib64/libmpfr.so.4
-rwxr-xr-x 1000/1000 1060920 2016-03-22 21:53 lib64/libm.so.6
-rwxr-xr-x 1000/1000 1600312 2016-03-22 21:53 lib64/libopcodes-2.25-15.fc23.so
-rwxr-xr-x 1000/1000 89472 2016-03-22 21:53 lib64/libz.so.1
-rwxr-xr-x 1000/1000 392984 2016-03-22 21:53 usr/bin/as
-rwxr-xr-x 1000/1000 21152336 2016-03-22 21:53 usr/bin/cc1
-rwxr-xr-x 1000/1000 22749840 2016-03-22 21:53 usr/bin/cc1plus
-rwxr-xr-x 1000/1000 919856 2016-03-22 21:53 usr/bin/g++
-rwxr-xr-x 1000/1000 915744 2016-03-22 21:53 usr/bin/gcc
-rwxr-xr-x 1000/1000 68344 2016-03-22 21:53 usr/libexec/gcc/x86_64-redhat-
linux/5.3.1/liblto_plugin.so
37
編譯環境解析
• 編譯器的執行檔
– gcc/g++/cc1/cc1plus
• 組譯器的執行檔
– as
• 所有相關的 Shared library
– libc.so, libm.so ...
• Dynamic Linker
– ld.so, /etc/ld.so.conf
• /bin/true
– 用來快速確保該機器是否可執行此編譯環境
38
Cross Compilation
• 使用 icecc-create-env 來建立編譯環境
– 例如要使用 aarch64 gcc
$ icecc-create-env --gcc 
bin/aarch64-linux-gnu-gcc 
bin/aarch64-linux-gnu-g++
…
creating 5a1f48aacc455db5ff0d0104a827651c.tar.gz
39
Cross Compilation
$ export ICECC_VERSION=5a1f48aacc455db5ff0d0104a827651c.tar.gz
$ export ICECC_CC=<path-to-aarch64-linux-gnu-gcc>
$ export ICECC_CXX=<path-to-aarch64-linux-gnu-g++>
$ icecc aarch64-linux-gnu-gcc hello.c -c -O
40
Cross Compilation
with wrapper
#! /usr/bin/env bash
export ICECC_VERSION=5a1f48aacc455db5ff0d0104a827651c.tar.gz
export ICECC_CC=<path-to-aarch64-linux-gnu-gcc>
export ICECC_CXX=<path-to-aarch64-linux-gnu-g++>
icecc aarch64-linux-gnu-gcc "$@"
41
icecc-scheduler
• 中控式
• 避免分配工作到 loading 重的 server
• 優先分配工作到比較快的 server
42
icecc-scheduler
• 中控式
• 避免分配工作到 loading 重的 server
• 優先分配工作到比較快的 server
• 有時候會看到都不在自己機器上 compile
的情況 ...XD
43
icemon
• icecc 的監控軟體
44DISTCC 運作原理
45
distcc 運作原理 / 收到遠端工作
• 接收工作
• 進行編譯
• 傳回編譯結果
46
distcc 設定
• 設定 DISTCC_HOSTS 或著是
/etc/distcc/hosts
– 每個 client 都要設定
47
distcc 常見問題
• 當遠端機器上面的 gcc 與本地端版本不
符的時候 ...
– 不同機器編譯出來的 Output 則可能會
不一樣
•編譯結果變得無法預期並且每次可能不同
Using different versions of gcc can cause confusing build problems
because the header files and binary interfaces have changed over time, and
some distributors have included incompatible patches without changing the
version number. distcc does not protect against using incompatible versions.
Compiler errors about link problems or declarations in system header files
are usually due to mismatched or incorrectly installed compilers.
摘錄自 distcc man page
48
Cross Compilation for distcc
• ㄎㄎㄎ
49
Cross Compilation for distcc
• ㄎㄎㄎ
The recommended convention for the gcc name is TARGET-gcc-VERSION such
as i686-linux-gcc-3.2. GCC 3.3 will install itself under this name, in
addition to TARGET-gcc and, if it's native, gcc-VERSION and gcc.
The compiler must be installed under the same name on the client and on
every volunteer machine.
摘錄自 distcc man page
50
Cross Compilation for distcc
• ㄎㄎㄎ
• 簡單說就是要使用者自己在每台機器上裝
好 Cross Compiler 啦~
The recommended convention for the gcc name is TARGET-gcc-VERSION such
as i686-linux-gcc-3.2. GCC 3.3 will install itself under this name, in
addition to TARGET-gcc and, if it's native, gcc-VERSION and gcc.
The compiler must be installed under the same name on the client and on
every volunteer machine.
摘錄自 distcc man page
51
Merge back to distcc?
• distcc maintainer 跑到 icecc 那邊問
要不要 Merge 回來阿~?
https://github.com/icecc/icecream/issues/138
52
Merge back to distcc?
• distcc maintainer 跑到 icecc 那邊問
要不要 Merge 回來阿~?
• icecc 表示 : 之前的 pull request 都
放半年以上沒人鳥現在還有臉說要 merge?
https://github.com/icecc/icecream/issues/138
53
Merge back to distcc?
• distcc maintainer 跑到 icecc 那邊問
要不要 Merge 回來阿~?
• icecc 表示 : 之前的 pull request 都
放半年以上沒人鳥現在還有臉說要 merge?
• 而且兩邊架構已經差太多啦~~~
https://github.com/icecc/icecream/issues/138

Weitere ähnliche Inhalte

Was ist angesagt?

eBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KerneleBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KernelThomas Graf
 
An Introduction to RISC-V bootflow
An Introduction to RISC-V bootflowAn Introduction to RISC-V bootflow
An Introduction to RISC-V bootflowAtish Patra
 
BPF Hardware Offload Deep Dive
BPF Hardware Offload Deep DiveBPF Hardware Offload Deep Dive
BPF Hardware Offload Deep DiveNetronome
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File SystemAdrian Huang
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringScyllaDB
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBshimosawa
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelDivye Kapoor
 
Vivado hls勉強会2(レジスタの挿入とpipelineディレクティブ)
Vivado hls勉強会2(レジスタの挿入とpipelineディレクティブ)Vivado hls勉強会2(レジスタの挿入とpipelineディレクティブ)
Vivado hls勉強会2(レジスタの挿入とpipelineディレクティブ)marsee101
 
用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver艾鍗科技
 
Integrated Register Allocation introduction
Integrated Register Allocation introductionIntegrated Register Allocation introduction
Integrated Register Allocation introductionShiva Chen
 
Tegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxTegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxMr. Vengineer
 
C/C++プログラマのための開発ツール
C/C++プログラマのための開発ツールC/C++プログラマのための開発ツール
C/C++プログラマのための開発ツールMITSUNARI Shigeo
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtAnne Nicolas
 
UEFI時代のブートローダ
UEFI時代のブートローダUEFI時代のブートローダ
UEFI時代のブートローダTakuya ASADA
 
Project ACRN: SR-IOV implementation
Project ACRN: SR-IOV implementationProject ACRN: SR-IOV implementation
Project ACRN: SR-IOV implementationGeoffroy Van Cutsem
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDPDaniel T. Lee
 

Was ist angesagt? (20)

eBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KerneleBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux Kernel
 
An Introduction to RISC-V bootflow
An Introduction to RISC-V bootflowAn Introduction to RISC-V bootflow
An Introduction to RISC-V bootflow
 
BPF Hardware Offload Deep Dive
BPF Hardware Offload Deep DiveBPF Hardware Offload Deep Dive
BPF Hardware Offload Deep Dive
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File System
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
ゼロからはじめるKVM超入門
ゼロからはじめるKVM超入門ゼロからはじめるKVM超入門
ゼロからはじめるKVM超入門
 
Vivado hls勉強会2(レジスタの挿入とpipelineディレクティブ)
Vivado hls勉強会2(レジスタの挿入とpipelineディレクティブ)Vivado hls勉強会2(レジスタの挿入とpipelineディレクティブ)
Vivado hls勉強会2(レジスタの挿入とpipelineディレクティブ)
 
用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver
 
Virtual Machine Constructions for Dummies
Virtual Machine Constructions for DummiesVirtual Machine Constructions for Dummies
Virtual Machine Constructions for Dummies
 
Integrated Register Allocation introduction
Integrated Register Allocation introductionIntegrated Register Allocation introduction
Integrated Register Allocation introduction
 
Tegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxTegra 186のu-boot & Linux
Tegra 186のu-boot & Linux
 
C/C++プログラマのための開発ツール
C/C++プログラマのための開発ツールC/C++プログラマのための開発ツール
C/C++プログラマのための開発ツール
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
 
UEFI時代のブートローダ
UEFI時代のブートローダUEFI時代のブートローダ
UEFI時代のブートローダ
 
Project ACRN: SR-IOV implementation
Project ACRN: SR-IOV implementationProject ACRN: SR-IOV implementation
Project ACRN: SR-IOV implementation
 
Faster packet processing in Linux: XDP
Faster packet processing in Linux: XDPFaster packet processing in Linux: XDP
Faster packet processing in Linux: XDP
 
Linux Namespace
Linux NamespaceLinux Namespace
Linux Namespace
 

Ähnlich wie icecream / icecc:分散式編譯系統簡介

Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版redhat9
 
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境dbabc
 
使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡cachowu
 
Oracle10g Rac Configuration For Linux X86
Oracle10g Rac Configuration For Linux X86Oracle10g Rac Configuration For Linux X86
Oracle10g Rac Configuration For Linux X86dbabc
 
尚观Linux研究室 linux驱动程序全解析
尚观Linux研究室   linux驱动程序全解析尚观Linux研究室   linux驱动程序全解析
尚观Linux研究室 linux驱动程序全解析hangejnu
 
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用容器與 Gitlab CI 應用
容器與 Gitlab CI 應用Philip Zheng
 
twMVC#42 Windows容器導入由0到1
twMVC#42 Windows容器導入由0到1twMVC#42 Windows容器導入由0到1
twMVC#42 Windows容器導入由0到1twMVC
 
你的 JS 該減肥了!5個提升網頁載入速度的技巧 - Modern Web 2020
你的 JS 該減肥了!5個提升網頁載入速度的技巧 - Modern Web 2020你的 JS 該減肥了!5個提升網頁載入速度的技巧 - Modern Web 2020
你的 JS 該減肥了!5個提升網頁載入速度的技巧 - Modern Web 2020Shubo Chao
 
Kvmopt osforce
Kvmopt osforceKvmopt osforce
Kvmopt osforcemeecheng
 
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用twMVC
 
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUGYingSiang Geng
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on praticeKenny (netman)
 
Install Oracle11g For Aix 5 L
Install Oracle11g For Aix 5 LInstall Oracle11g For Aix 5 L
Install Oracle11g For Aix 5 Lheima911
 
Deskpool vdi solution introduction
Deskpool vdi solution introductionDeskpool vdi solution introduction
Deskpool vdi solution introductionDongLiwu
 
Docker 最佳实践
Docker 最佳实践Docker 最佳实践
Docker 最佳实践YuLing Liu
 
前端也能變全端
前端也能變全端前端也能變全端
前端也能變全端ericpi Bi
 
SQL Server 資料庫版本控管
SQL Server 資料庫版本控管SQL Server 資料庫版本控管
SQL Server 資料庫版本控管Will Huang
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩Wen-Tien Chang
 

Ähnlich wie icecream / icecc:分散式編譯系統簡介 (20)

Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版Bypat博客出品-利用cent os快速构建自己的发行版
Bypat博客出品-利用cent os快速构建自己的发行版
 
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
 
使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡使用Nginx轻松实现开源负载均衡
使用Nginx轻松实现开源负载均衡
 
Oracle10g Rac Configuration For Linux X86
Oracle10g Rac Configuration For Linux X86Oracle10g Rac Configuration For Linux X86
Oracle10g Rac Configuration For Linux X86
 
尚观Linux研究室 linux驱动程序全解析
尚观Linux研究室   linux驱动程序全解析尚观Linux研究室   linux驱动程序全解析
尚观Linux研究室 linux驱动程序全解析
 
Build Your Own Android Toolchain from scratch
Build Your Own Android Toolchain from scratchBuild Your Own Android Toolchain from scratch
Build Your Own Android Toolchain from scratch
 
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用容器與 Gitlab CI 應用
容器與 Gitlab CI 應用
 
LinkIt 7697 IoT tutorial
LinkIt 7697 IoT tutorialLinkIt 7697 IoT tutorial
LinkIt 7697 IoT tutorial
 
twMVC#42 Windows容器導入由0到1
twMVC#42 Windows容器導入由0到1twMVC#42 Windows容器導入由0到1
twMVC#42 Windows容器導入由0到1
 
你的 JS 該減肥了!5個提升網頁載入速度的技巧 - Modern Web 2020
你的 JS 該減肥了!5個提升網頁載入速度的技巧 - Modern Web 2020你的 JS 該減肥了!5個提升網頁載入速度的技巧 - Modern Web 2020
你的 JS 該減肥了!5個提升網頁載入速度的技巧 - Modern Web 2020
 
Kvmopt osforce
Kvmopt osforceKvmopt osforce
Kvmopt osforce
 
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
 
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
 
Install Oracle11g For Aix 5 L
Install Oracle11g For Aix 5 LInstall Oracle11g For Aix 5 L
Install Oracle11g For Aix 5 L
 
Deskpool vdi solution introduction
Deskpool vdi solution introductionDeskpool vdi solution introduction
Deskpool vdi solution introduction
 
Docker 最佳实践
Docker 最佳实践Docker 最佳实践
Docker 最佳实践
 
前端也能變全端
前端也能變全端前端也能變全端
前端也能變全端
 
SQL Server 資料庫版本控管
SQL Server 資料庫版本控管SQL Server 資料庫版本控管
SQL Server 資料庫版本控管
 
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
A brief introduction to Vagrant – 原來 VirtualBox 可以這樣玩
 

Kürzlich hochgeladen

函數畫圖_習題7.pptx 函數畫圖_習題7.pptx 函數畫圖_習題7.pptx
函數畫圖_習題7.pptx 函數畫圖_習題7.pptx 函數畫圖_習題7.pptx函數畫圖_習題7.pptx 函數畫圖_習題7.pptx 函數畫圖_習題7.pptx
函數畫圖_習題7.pptx 函數畫圖_習題7.pptx 函數畫圖_習題7.pptxNCU MCL
 
20211119 - demystified artificial intelligence with NLP
20211119 - demystified artificial intelligence with NLP20211119 - demystified artificial intelligence with NLP
20211119 - demystified artificial intelligence with NLPJamie (Taka) Wang
 
SymPy 在微積分上的應用_5.pptx SymPy 在微積分上的應用_5.pptx
SymPy 在微積分上的應用_5.pptx SymPy 在微積分上的應用_5.pptxSymPy 在微積分上的應用_5.pptx SymPy 在微積分上的應用_5.pptx
SymPy 在微積分上的應用_5.pptx SymPy 在微積分上的應用_5.pptxNCU MCL
 
函數畫圖_習題5.pptx 函數畫圖_習題5.pptx 函數畫圖_習題5.pptx
函數畫圖_習題5.pptx 函數畫圖_習題5.pptx 函數畫圖_習題5.pptx函數畫圖_習題5.pptx 函數畫圖_習題5.pptx 函數畫圖_習題5.pptx
函數畫圖_習題5.pptx 函數畫圖_習題5.pptx 函數畫圖_習題5.pptxNCU MCL
 
函數畫圖_習題6.pptx 函數畫圖_習題6.pptx 函數畫圖_習題6.pptx
函數畫圖_習題6.pptx 函數畫圖_習題6.pptx 函數畫圖_習題6.pptx函數畫圖_習題6.pptx 函數畫圖_習題6.pptx 函數畫圖_習題6.pptx
函數畫圖_習題6.pptx 函數畫圖_習題6.pptx 函數畫圖_習題6.pptxNCU MCL
 
SymPy 在微積分上的應用_4.pptx SymPy 在微積分上的應用_4.pptx
SymPy 在微積分上的應用_4.pptx SymPy 在微積分上的應用_4.pptxSymPy 在微積分上的應用_4.pptx SymPy 在微積分上的應用_4.pptx
SymPy 在微積分上的應用_4.pptx SymPy 在微積分上的應用_4.pptxNCU MCL
 
买假和真英国驾驶执照买了假的英国驾照,那跟真的有什么区别吗?买假和真正的澳大利亚驾驶执照【微信qoqoqdqd】
买假和真英国驾驶执照买了假的英国驾照,那跟真的有什么区别吗?买假和真正的澳大利亚驾驶执照【微信qoqoqdqd】买假和真英国驾驶执照买了假的英国驾照,那跟真的有什么区别吗?买假和真正的澳大利亚驾驶执照【微信qoqoqdqd】
买假和真英国驾驶执照买了假的英国驾照,那跟真的有什么区别吗?买假和真正的澳大利亚驾驶执照【微信qoqoqdqd】黑客 接单【TG/微信qoqoqdqd】
 
函數微分_習題4.pptx 函數微分_習題4.pptx 函數微分_習題4.pptx
函數微分_習題4.pptx 函數微分_習題4.pptx 函數微分_習題4.pptx函數微分_習題4.pptx 函數微分_習題4.pptx 函數微分_習題4.pptx
函數微分_習題4.pptx 函數微分_習題4.pptx 函數微分_習題4.pptxNCU MCL
 
20161220 - domain-driven design
20161220 - domain-driven design20161220 - domain-driven design
20161220 - domain-driven designJamie (Taka) Wang
 
20170104 - transaction_pattern
20170104 - transaction_pattern20170104 - transaction_pattern
20170104 - transaction_patternJamie (Taka) Wang
 

Kürzlich hochgeladen (15)

函數畫圖_習題7.pptx 函數畫圖_習題7.pptx 函數畫圖_習題7.pptx
函數畫圖_習題7.pptx 函數畫圖_習題7.pptx 函數畫圖_習題7.pptx函數畫圖_習題7.pptx 函數畫圖_習題7.pptx 函數畫圖_習題7.pptx
函數畫圖_習題7.pptx 函數畫圖_習題7.pptx 函數畫圖_習題7.pptx
 
20151111 - IoT Sync Up
20151111 - IoT Sync Up20151111 - IoT Sync Up
20151111 - IoT Sync Up
 
20211119 - demystified artificial intelligence with NLP
20211119 - demystified artificial intelligence with NLP20211119 - demystified artificial intelligence with NLP
20211119 - demystified artificial intelligence with NLP
 
SymPy 在微積分上的應用_5.pptx SymPy 在微積分上的應用_5.pptx
SymPy 在微積分上的應用_5.pptx SymPy 在微積分上的應用_5.pptxSymPy 在微積分上的應用_5.pptx SymPy 在微積分上的應用_5.pptx
SymPy 在微積分上的應用_5.pptx SymPy 在微積分上的應用_5.pptx
 
20161027 - edge part2
20161027 - edge part220161027 - edge part2
20161027 - edge part2
 
函數畫圖_習題5.pptx 函數畫圖_習題5.pptx 函數畫圖_習題5.pptx
函數畫圖_習題5.pptx 函數畫圖_習題5.pptx 函數畫圖_習題5.pptx函數畫圖_習題5.pptx 函數畫圖_習題5.pptx 函數畫圖_習題5.pptx
函數畫圖_習題5.pptx 函數畫圖_習題5.pptx 函數畫圖_習題5.pptx
 
Entities in DCPS (DDS)
Entities in DCPS (DDS)Entities in DCPS (DDS)
Entities in DCPS (DDS)
 
20200323 - AI Intro
20200323 - AI Intro20200323 - AI Intro
20200323 - AI Intro
 
函數畫圖_習題6.pptx 函數畫圖_習題6.pptx 函數畫圖_習題6.pptx
函數畫圖_習題6.pptx 函數畫圖_習題6.pptx 函數畫圖_習題6.pptx函數畫圖_習題6.pptx 函數畫圖_習題6.pptx 函數畫圖_習題6.pptx
函數畫圖_習題6.pptx 函數畫圖_習題6.pptx 函數畫圖_習題6.pptx
 
SymPy 在微積分上的應用_4.pptx SymPy 在微積分上的應用_4.pptx
SymPy 在微積分上的應用_4.pptx SymPy 在微積分上的應用_4.pptxSymPy 在微積分上的應用_4.pptx SymPy 在微積分上的應用_4.pptx
SymPy 在微積分上的應用_4.pptx SymPy 在微積分上的應用_4.pptx
 
买假和真英国驾驶执照买了假的英国驾照,那跟真的有什么区别吗?买假和真正的澳大利亚驾驶执照【微信qoqoqdqd】
买假和真英国驾驶执照买了假的英国驾照,那跟真的有什么区别吗?买假和真正的澳大利亚驾驶执照【微信qoqoqdqd】买假和真英国驾驶执照买了假的英国驾照,那跟真的有什么区别吗?买假和真正的澳大利亚驾驶执照【微信qoqoqdqd】
买假和真英国驾驶执照买了假的英国驾照,那跟真的有什么区别吗?买假和真正的澳大利亚驾驶执照【微信qoqoqdqd】
 
函數微分_習題4.pptx 函數微分_習題4.pptx 函數微分_習題4.pptx
函數微分_習題4.pptx 函數微分_習題4.pptx 函數微分_習題4.pptx函數微分_習題4.pptx 函數微分_習題4.pptx 函數微分_習題4.pptx
函數微分_習題4.pptx 函數微分_習題4.pptx 函數微分_習題4.pptx
 
20200226 - AI Overview
20200226 - AI Overview20200226 - AI Overview
20200226 - AI Overview
 
20161220 - domain-driven design
20161220 - domain-driven design20161220 - domain-driven design
20161220 - domain-driven design
 
20170104 - transaction_pattern
20170104 - transaction_pattern20170104 - transaction_pattern
20170104 - transaction_pattern
 

icecream / icecc:分散式編譯系統簡介

  • 1. icecream / icecc: 分散式編譯系統簡介 Date : Mar 31th, 2016 Kito Cheng kito.cheng@gmail.com
  • 3. 3 這份簡報包含 ... • icecc 安裝與環境的架設 • 如何使用 icecc 進行 cross-compilation • 使用心得跟一些實驗數據 • icecc 運作原理與內部設計 • 與 distcc 的比較
  • 4. 4 icecc 是什麼? • 分散式的編譯系統 – 有效利用多台機器加速編譯速度
  • 5. 5 icecc 是什麼? • 分散式的編譯系統 – 有效利用多台機器加速編譯速度 • 不是一個編譯器 – 由 distcc fork 而成 •目前兩邊差異已經相當大 – 需要 GCC 或 LLVM •官方僅支援這兩種編譯器
  • 7. 7 distcc 錯惹嗎 ? • 最單純的情況下只要設定 DISTCC_HOSTS • 若要 cross-compilation 整個就是悲劇 ... • 如果 server 群的環境不太一樣的話也很容易發生 悲劇 • 最後會介紹 distcc 的部份運作機制與 icecc 比較
  • 8. 8 安裝 • Debian/Ubuntu – $ sudo apt-get install icecream • Fedora – $ sudo dnf install icecream • CentOS – $ sudo yum install icecream
  • 9. 9 Server side • icecc 中 server 分兩種 – icecc-scheduler •網路環境中只需要一個即可 •負責分配工作 – iceccd •每台 Server 都需要執行 iceccd •負責處理工作
  • 10. 10 Server side / scheduler • Ubuntu/CentOS – service icecc-scheduler start • Fedora – systemctl start icecc- scheduler.service
  • 11. 11 Server side / iceccd • Ubuntu/CentOS – service iceccd start • Fedora – systemctl start iceccd
  • 12. 12 Zero config • 正常情況下設定完全不用修改即可運作 • iceccd 打起來就會主動搜索有無 icecc- scheduler 並且自動加入
  • 13. 13 icecc 設定 • 其實也是有可以設定的東西啦 ... 不過通常都不用改 就會動啦 ~ • ICECREAM_NETNAME – 這台機器的名稱 , 預設值是 hostname • ICECREAM_SCHEDULER_HOST – 指定要使用哪個 Scheduler server, 不設定的話 iceccd 會自己去找區網上的其中一個 • ICECREAM_ALLOW_REMOTE – 是否允許其他機器利用本機端來編譯 , 預設值通常是 yes • ICECREAM_MAX_JOBS – 這台機器最多負載的編譯工作數目 , 預設值會根據該機器 上的處理器數量來決定
  • 14. 14 基礎用法 • 就像使用 distcc 或 ccache 一樣 • icecc <compiler> ... • icecc gcc foo.c -c -O
  • 15. 15 便利的用法 • 用個 wrapper – ln -s /usr/bin/icecc gcc – ln -s /usr/bin/icecc g++ – ln -s /usr/bin/icecc cc – ln -s /usr/bin/icecc clang – ln -s /usr/bin/icecc clang++
  • 16. 16 系統附贈的 icecc wrapper • Fedora – /usr/libexec/icecc/bin/gcc – /usr/libexec/icecc/bin/g++ • Ubuntu – /usr/lib/icecc/bin/gcc – /usr/lib/icecc/bin/g++
  • 17. 17 實驗環境 • 硬體環境 – CPU : E3-1230 v3 @ 3.30GHz (8 logic core) * 4 – RAM : 32GB – Network : 1 Gigabit Ethernet • 軟體環境 – OS : Fedora 22 / Gentoo • 系統內建 GCC 版本 : 5.3 / 5.2 / 4.9.2 – ICECC version : 1.0.90 – GCC : 4.9.3 • ICECREAM 組態 – ICECREAM_MAX_JOBS=12
  • 18. 18 實驗對象 • LLVM Version: r26441 • 編譯 LLVM Debug build – Configure as : • -DCMAKE_BUILD_TYPE=Debug -DLLVM_OPTIMIZED_TABLEGEN=ON • 編譯 LLVM Release build – Configure as : • -DCMAKE_BUILD_TYPE=Release • 平行與分散 : – time make -j48 – time make -j12
  • 19. 19 實驗數據 LLVM Build Type icecc gcc Speed up Total file size for build folder Release Build 2m57.275s 10m34.657s 3.6x 919M Debug Build 5m10.249s 12m2.120s 2.3x 12G
  • 20. 20 實驗數據分析 • Release build 加速與極限值 4 倍相差不遠 – Link 階段無法平行化 • Release build 比 Debug build 還慢? – 輸出結果要透過網路傳輸 – 900M vs 12G
  • 21. 21 實驗環境 2 • 硬體環境 – CPU : • E3-1230 v3 @ 3.30GHz (8 logic core) * 5 • E3-1230 v2 @ 3.30GHz (8 logic core) * 1 – RAM : 32GB – Network : 1 Gigabit Ethernet + 100 Megabit Ethernet • 軟體環境 – OS : Fedora 22 / Gentoo / CentOS 6 • 系統內建 GCC 版本 : 5.3 / 5.2 / 4.9.2 / 4.4.7 – ICECC version : 1.0.90 – GCC : 5.3 (Fedora 22 內建 ) • ICECREAM 組態 – ICECREAM_MAX_JOBS=12
  • 22. 22 實驗數據 2 LLVM Build Type icecc gcc Speed up Total file size for build folder Release Build 1m55.630s 10m34.657s 5.5x 919M
  • 23. 23 試過用 icecc 建置的 Project • GCC/Binutils/Glibc/GDB – Cross-compilation and Native • Linux Kernel – Cross-compilation
  • 25. 25 運作原理 • 呼叫 gcc/clang 進行 pre-process • 將工作丟到 iceccd • iceccd 向 icecc-scheduler 找一台閒置 的機器 • 丟 pre-process 過後的檔案到遠端進行編 譯 • 接收遠端的編譯結果
  • 26. 26 icecc 的假設 • 在任意一台機器上同樣的 input 配上同 樣的 options 會輸出同樣的 output – Input: source code – Ouput: object code
  • 27. 27 任意一台機器 ? • icecc 支援的平台 : – Linux – FreeBSD – DragonFlyBSD – OS X • 支援不同架構 – 例如 x86_64/x86/arm/ppc/s390 Note: 只試過 x86_64 + x86 Linux 上 , 沒試過混搭 OS/Arch 的環境
  • 28. 28 不同架構間的相容性 • 相容列表 : – i*86/x86_64 – ppc/ppc64 – s390/s390x • 例如 i686 的 executable 可以直接在 x86_64 上跑
  • 29. 29 假設一定會成立嗎 ? • 有些 Option 在不同機器上會有不同效果 – -mtune=native – -march=native – -mcpu=native • 遇到這些 Option 就會強制 local build
  • 30. 30 還有其它限制嗎? • 目前 icecc 無法處理多個 Output file – -save-temps – -fprofile-arcs – -fbranch-probabilities – -fprofile-use – -fprofile-generate – ... • 遇到這類 Option 也會強制 local build
  • 31. 31 gcc 版本不一樣怎麼辦? • icecc 在設計上就有考慮到這個問題 • 接著會介紹遠端接收到工作如何處理
  • 32. 32 icecc 運作原理 / 收到遠端工作 • 接收工作 • 確認該工作使用的編譯環境是否本地端有 沒有 – 沒有的話就跟工作來源的機器要 • 準備編譯環境 • 進行編譯 • 傳回編譯結果
  • 33. 33 icecc 編譯環境 • iceccd 啟動時會自動建立 – 預設找系統的 gcc/g++ • 透過 ICECC_VERSION 環境變數設定 – 使用 icecc-create-env – 若使用系統的 gcc/g++ 可不指定
  • 34. 34 使用 icecc-create-env 建置編譯環境 $ icecc-create-env --gcc /usr/bin/gcc /usr/bin/g++ $ icecc-create-env --clang /usr/bin/clang $ icecc-create-env --gcc <path-to-gcc> <path-to-g++> $ icecc-create-env --clang <path-to-clang> $ icecc --build-native 例如
  • 35. 35 使用 icecc-create-env 建置編譯環境$ icecc-create-env --gcc /usr/bin/gcc /usr/bin/g++ adding file /bin/true adding file /lib64/libc.so.6 adding file /lib64/ld-linux-x86-64.so.2 adding file /usr/bin/gcc adding file /lib64/libm.so.6 adding file /usr/bin/g++ adding file /usr/bin/cc1=/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/cc1 adding file /lib64/libdl.so.2 adding file /lib64/libmpc.so.3 adding file /lib64/libmpfr.so.4 adding file /lib64/libgmp.so.10 adding file /lib64/libz.so.1 adding file /usr/bin/cc1plus=/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/cc1plus adding file /usr/bin/as adding file /lib64/libopcodes-2.25-15.fc23.so adding file /lib64/libbfd-2.25-15.fc23.so adding file /usr/libexec/gcc/x86_64-redhat-linux/5.3.1/liblto_plugin.so adding file /etc/ld.so.conf=/tmp/icecc_ld_so_confTVPvU7 cp: omitting directory ‘/lib’ cp: omitting directory ‘/lib64’ creating 873f2d89faf900aa39d8a5673521d0df.tar.gz
  • 36. 36 編譯環境的內容物 $ tar -tvf 873f2d89faf900aa39d8a5673521d0df.tar.gz -rwxr-xr-x 1000/1000 28432 2016-03-22 21:53 bin/true -rw-r--r-- 1000/1000 794 2016-03-22 21:53 etc/ld.so.cache -rw------- 1000/1000 33 2016-03-22 21:53 etc/ld.so.conf -rwxr-xr-x 1000/1000 142472 2016-03-22 21:53 lib64/ld-linux-x86-64.so.2 -rwxr-xr-x 1000/1000 1205936 2016-03-22 21:53 lib64/libbfd-2.25-15.fc23.so -rwxr-xr-x 1000/1000 1833648 2016-03-22 21:53 lib64/libc.so.6 -rwxr-xr-x 1000/1000 15152 2016-03-22 21:53 lib64/libdl.so.2 -rwxr-xr-x 1000/1000 494096 2016-03-22 21:53 lib64/libgmp.so.10 -rwxr-xr-x 1000/1000 101208 2016-03-22 21:53 lib64/libmpc.so.3 -rwxr-xr-x 1000/1000 396680 2016-03-22 21:53 lib64/libmpfr.so.4 -rwxr-xr-x 1000/1000 1060920 2016-03-22 21:53 lib64/libm.so.6 -rwxr-xr-x 1000/1000 1600312 2016-03-22 21:53 lib64/libopcodes-2.25-15.fc23.so -rwxr-xr-x 1000/1000 89472 2016-03-22 21:53 lib64/libz.so.1 -rwxr-xr-x 1000/1000 392984 2016-03-22 21:53 usr/bin/as -rwxr-xr-x 1000/1000 21152336 2016-03-22 21:53 usr/bin/cc1 -rwxr-xr-x 1000/1000 22749840 2016-03-22 21:53 usr/bin/cc1plus -rwxr-xr-x 1000/1000 919856 2016-03-22 21:53 usr/bin/g++ -rwxr-xr-x 1000/1000 915744 2016-03-22 21:53 usr/bin/gcc -rwxr-xr-x 1000/1000 68344 2016-03-22 21:53 usr/libexec/gcc/x86_64-redhat- linux/5.3.1/liblto_plugin.so
  • 37. 37 編譯環境解析 • 編譯器的執行檔 – gcc/g++/cc1/cc1plus • 組譯器的執行檔 – as • 所有相關的 Shared library – libc.so, libm.so ... • Dynamic Linker – ld.so, /etc/ld.so.conf • /bin/true – 用來快速確保該機器是否可執行此編譯環境
  • 38. 38 Cross Compilation • 使用 icecc-create-env 來建立編譯環境 – 例如要使用 aarch64 gcc $ icecc-create-env --gcc bin/aarch64-linux-gnu-gcc bin/aarch64-linux-gnu-g++ … creating 5a1f48aacc455db5ff0d0104a827651c.tar.gz
  • 39. 39 Cross Compilation $ export ICECC_VERSION=5a1f48aacc455db5ff0d0104a827651c.tar.gz $ export ICECC_CC=<path-to-aarch64-linux-gnu-gcc> $ export ICECC_CXX=<path-to-aarch64-linux-gnu-g++> $ icecc aarch64-linux-gnu-gcc hello.c -c -O
  • 40. 40 Cross Compilation with wrapper #! /usr/bin/env bash export ICECC_VERSION=5a1f48aacc455db5ff0d0104a827651c.tar.gz export ICECC_CC=<path-to-aarch64-linux-gnu-gcc> export ICECC_CXX=<path-to-aarch64-linux-gnu-g++> icecc aarch64-linux-gnu-gcc "$@"
  • 41. 41 icecc-scheduler • 中控式 • 避免分配工作到 loading 重的 server • 優先分配工作到比較快的 server
  • 42. 42 icecc-scheduler • 中控式 • 避免分配工作到 loading 重的 server • 優先分配工作到比較快的 server • 有時候會看到都不在自己機器上 compile 的情況 ...XD
  • 45. 45 distcc 運作原理 / 收到遠端工作 • 接收工作 • 進行編譯 • 傳回編譯結果
  • 46. 46 distcc 設定 • 設定 DISTCC_HOSTS 或著是 /etc/distcc/hosts – 每個 client 都要設定
  • 47. 47 distcc 常見問題 • 當遠端機器上面的 gcc 與本地端版本不 符的時候 ... – 不同機器編譯出來的 Output 則可能會 不一樣 •編譯結果變得無法預期並且每次可能不同 Using different versions of gcc can cause confusing build problems because the header files and binary interfaces have changed over time, and some distributors have included incompatible patches without changing the version number. distcc does not protect against using incompatible versions. Compiler errors about link problems or declarations in system header files are usually due to mismatched or incorrectly installed compilers. 摘錄自 distcc man page
  • 48. 48 Cross Compilation for distcc • ㄎㄎㄎ
  • 49. 49 Cross Compilation for distcc • ㄎㄎㄎ The recommended convention for the gcc name is TARGET-gcc-VERSION such as i686-linux-gcc-3.2. GCC 3.3 will install itself under this name, in addition to TARGET-gcc and, if it's native, gcc-VERSION and gcc. The compiler must be installed under the same name on the client and on every volunteer machine. 摘錄自 distcc man page
  • 50. 50 Cross Compilation for distcc • ㄎㄎㄎ • 簡單說就是要使用者自己在每台機器上裝 好 Cross Compiler 啦~ The recommended convention for the gcc name is TARGET-gcc-VERSION such as i686-linux-gcc-3.2. GCC 3.3 will install itself under this name, in addition to TARGET-gcc and, if it's native, gcc-VERSION and gcc. The compiler must be installed under the same name on the client and on every volunteer machine. 摘錄自 distcc man page
  • 51. 51 Merge back to distcc? • distcc maintainer 跑到 icecc 那邊問 要不要 Merge 回來阿~? https://github.com/icecc/icecream/issues/138
  • 52. 52 Merge back to distcc? • distcc maintainer 跑到 icecc 那邊問 要不要 Merge 回來阿~? • icecc 表示 : 之前的 pull request 都 放半年以上沒人鳥現在還有臉說要 merge? https://github.com/icecc/icecream/issues/138
  • 53. 53 Merge back to distcc? • distcc maintainer 跑到 icecc 那邊問 要不要 Merge 回來阿~? • icecc 表示 : 之前的 pull request 都 放半年以上沒人鳥現在還有臉說要 merge? • 而且兩邊架構已經差太多啦~~~ https://github.com/icecc/icecream/issues/138