靈犀科技網(wǎng)站開發(fā)精準(zhǔn)營銷系統(tǒng)價值
目錄
- 2024/1/19日更新
- 確定已安裝G++
- 編譯測試程序獲取宏值
- 安裝對應(yīng)的Transformer LLM推理模型庫和Transformer推理加速庫
- 小結(jié)
2024/1/19日更新
具體使用cxx11abi0 還是cxx11abi1 可通過python命令查詢
import torch
torch.compiled_with_cxx11_abi()
若返回True 則使用 cxx11abi1,否則相反。
確定已安裝G++
命令行輸入
g++ -v
示例輸出
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-linux-gnu/10.3.1/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,fortran,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --without-cloog --enable-gnu-indirect-function --build=aarch64-linux-gnu --with-stage1-ldflags=' -Wl,-z,relro,-z,now' --with-boot-ldflags=' -Wl,-z,relro,-z,now' --disable-bootstrap --with-multilib-list=lp64 --enable-bolt
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.3.1 (GCC)
總結(jié)網(wǎng)絡(luò)上的搜索結(jié)果,如果GCC版本大于5.1,那么_GLIBCXX_USE_CXX11_ABI參數(shù)都是1
如果要編譯低版本的軟件,_GLIBCXX_USE_CXX11_ABI參數(shù)需要設(shè)置為0
編譯測試程序獲取宏值
新建一個文件
vim test.cpp
將下面的代碼復(fù)制進去,wq保存
#include <iostream>
using namespace std;int main() {#ifdef _GLIBCXX_USE_CXX11_ABIcout << _GLIBCXX_USE_CXX11_ABI << endl; #elsecout << "not defined" << endl;#endif
}
使用g++進行編譯
g++ -o test test.cpp
運行可執(zhí)行文件
./test
這將會打印輸出_GLIBCXX_USE_CXX11_ABI參數(shù)的值
安裝對應(yīng)的Transformer LLM推理模型庫和Transformer推理加速庫
示例版本:
Ascend-cann-llm_7.0.0_linux-aarch64_torch2.0.1-abi0.tar.gz
Ascend-cann-atb_7.0.0_linux-aarch64_abi0.run
小結(jié)
按照官方的方式得到_GLIBCXX_USE_CXX11_ABI參數(shù)的值是0
按照編譯測試程序獲取宏值的方式得到的參數(shù)值是1
不敢還是按照官方的來吧,選擇0