[圖解tensorflow源碼] 入門準備工作附常用的矩陣計算工具[轉]
[圖解tensorflow源碼] 入門準備工作
附常用的矩陣計算工具[轉]
Link: https://www.cnblogs.com/yao62995/p/5773142.html
?tensorflow使用了自動化構建工具bazel、腳本語言調用c或cpp的包裹工具swig、使用EIGEN作為矩陣處理工具、Nvidia-cuBLAS GPU加速計算庫、結構化數據存儲格式protobuf
Swig ? ??? | 1. Simplified Wrapper and Interface Generator (SWIG) ,基本思想就是向腳本語言接口公開 C/C++ 代碼。SWIG 允許您向廣泛的腳本語言公開 C/C++ 代碼,包括 Ruby、Perl、Tcl 和 Python。 ? ? 參考: 1.?使用SWIG實現Python調用C/C++代碼 | ?? | ||
Bazel | 1. bazel假定每個目錄為[package]單元,目錄裏面包含了源文件和一個描述文件BUILD,描述文件中指定了如何將源文件轉換成構建的輸出。
3. bazel命令: ? ? ?>?bazel build -c opt?//tensorflow/tools/pip_package:build_pip_package 4. 調試模式: ? ? ?> ?bazel build -c dbg 參考: 1.?安裝bazel ? ?>?yum?install?java-1.8.0-openjdk ? ?>?yum?install?java-1.8.0-openjdk-devel ? ?>?https://github.com/google/bazel/ 下載最新版本bazel_xxx.sh安裝 2.?使用bazel構建系統 ? ? 3.?bazel 命令手冊 ?? | ? ? ?? | ||
EIGEN | 1. Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.?http://eigen.tuxfamily.org/
2. 常用的矩陣計算工具有blas,?cublas(caffe)、atlas、openblas(mxnet)、eigen,還有lapack、mkl(intel)、Armadillo(matlab)
? ?
3. Eigen庫包含 Eigen模塊和unsupported模塊,其中Eigen模塊為official module,unsupported模塊為開源貢獻者開發的,沒有official support。 1.?矩陣運算庫blas, cblas, openblas, atlas, lapack, mkl https://eigen.tuxfamily.org/dox/ ? ? C++矩陣運算庫推薦 | ? | ||
protobuf | ? ? 1. Protocol Buffers 是一種輕便高效的結構化數據存儲格式,可以用於結構化數據串行化,或者說序列化。它很適合做數據存儲或 RPC 數據交換格式。可用於通訊協議、數據存儲等領域的語言無關、平臺無關、可擴展的序列化結構數據格式。 2. 使用 ? ? ? >?Writer: SerializeToOstream(), ??Reader: ParseFromIstream() ? ? ? > required:一個格式良好的消息一定要含有1個這種字段; ? ? ? > optional:消息格式中該字段可以有0個或1個值(不超過1個)。 ? ? ? > repeated:在一個格式良好的消息中,這種字段可以重復任意多次(包括0次)。相當於java中的List。 3.?
? ?
4. grpc需要理解4個方面(service,stub,channel,observer)
?Protobuf 語法指南 gRPC 入門及源碼分析 | ?? | ||
Stream Executor? | > google stream executor team: work on parallel programming models for CPUs, GPUs and other platforms. https://github.com/henline/streamexecutordoc https://github.com/henline/streamexecutordoc/blob/master/se_and_openmp.rst | ? ? ?? | ||
TF C++ | 1. TF源碼安裝:?following the instructions here 2. example: ?tensorflow/cc/tutorials/example_trainer.cc 3. 自定義的op Kernel:?tutorial for adding a new op in C++. 4. TF c++ 調試:?debugging Tensorflow‘s C++ code behind the SWIG interface ? ? ? ? ?>?The simplest interface between Python and C++ is the pure-C API in?tensor_c_api.h ?? | ? |
?
[圖解tensorflow源碼] 入門準備工作附常用的矩陣計算工具[轉]