Tensorflow custom op build - jinwooklim/my-exp GitHub Wiki
Tensorflow custom op build
์ฐธ์กฐ :
http://litaotju.github.io/c++/2019/02/24/Why-we-need-D_GLIBCXX_USE_CXX11_ABI=0/
https://nuggy875.tistory.com/63
https://medium.com/@patrickorcl/compile-with-nvcc-3566fbdfdbf
1. "-D_GLIBCXX_USE_CXX11_ABI=0" flag.
The official TensorFlow packages are built with GCC 4 and use the older ABI. For GCC 5 and later, make your build compatible with the older ABI using: โcxxopt=โ-D_GLIBCXX_USE_CXX11_ABI=0โ. ABI compatibility ensures that custom ops built against the official TensorFlow package continue to work with the GCC 5 built package
ABI (Application Binary Interface) ๋ OS, library์ machine code level interface ์ด๋ค.
ABI๋ program component ๊ฐ์ interface ๋ก์, A program component ์์ B program component ๋ก binary format information์ด ์ ๋ฌ๋๋ ๊ฒ or system call์ response ํ๋ ๊ฒ์ ๊ฒฐ์ ํ๋ค.
( ABI ๋ API ์ ์ ์ฌํ์ง๋ง, API๋ source code level์ด๊ณ ABI๋ program component ๊ฐ์ interface ์ด๋ค. )
์ฆ, tensorflow custom op ๋ฅผ build ํ๋๋ฐ "-D_GLIBCXX_USE_CXX11_ABI=0" flag๋ฅผ ์ฌ์ฉํ๋ ์ด์ ๋, GCC version 5 ์ด์์ code์ ํธํ์ฑ์ ์ํด์ ์ฌ์ฉํ๋ ๊ฒ์ด๋ค.
2. Error: no kernel image is available for execution on the device
์ด์ ๊ฐ์ Error๋ GPU architecture๋ฅผ ์ ์ํ๋ ์ฝ๋๊ฐ ๋ฌ๋ผ์ ๊ทธ๋ ๋ค. ๋ฐ๋ผ์, make.sh ์์ ์๋์ ํด๋นํ๋ ๊ฐ๋ค์ GPU arch ์ ๋ง์ถ์ด์ ๋ณ๊ฒฝํด์ฃผ๋ฉด ๋๋ค.
In Example.
RTX2080 : compute_75, sm_75
GTX1080 : compute_61, sm_61
Titan Xp : compute_61, sm_61