forked from intel/intel-extension-for-pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1bcb28c
commit d75a4d1
Showing
16 changed files
with
369 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Diagnostics: | ||
Suppress: [attribute_wrong_number_arguments, builtin_definition] | ||
CompileFlags: | ||
Add: -fgnuc-version=12.2.0 | ||
InlayHints: | ||
Designators: Yes | ||
Enabled: Yes | ||
ParameterNames: Yes | ||
DeducedTypes: Yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ | ||
{ | ||
"name": "ipex", | ||
"environmentSetupScript": "/home/wangzhe/zhe/intel-extension-for-pytorch/env_init.sh", | ||
"compilers": { | ||
"C": "/home/wangzhe/.local/envs/zhe_ipex/bin/gcc", | ||
"CXX": "/home/wangzhe/.local/envs/zhe_ipex/bin/g++" | ||
}, | ||
"isTrusted": true | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Current File", | ||
"type": "python", | ||
"request": "launch", | ||
"args": [ | ||
"bdist_wheel" | ||
], | ||
"program": "${file}", | ||
"console": "integratedTerminal", | ||
"justMyCode": false, | ||
"preLaunchTask": "sourceScript" | ||
}, | ||
{ | ||
"name": "(gdb) Attach", | ||
"type": "cppdbg", | ||
"request": "attach", | ||
"program": "/home/wangzhe/.local/envs/zhe_ipex/bin/python", | ||
"processId": "${command:pickProcess}", | ||
"MIMode": "gdb", | ||
"miDebuggerPath": "/home/wangzhe/.local/envs/zhe_ipex/bin/gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"cmake.configureArgs": [ | ||
"-DBUILD_MODULE_TYPE=CPU", | ||
"-DBUILD_WITH_XPU=OFF", | ||
"-DCMAKE_BUILD_TYPE=Debug", | ||
"-DCMAKE_INSTALL_LIBDIR=lib", | ||
"-DCMAKE_INSTALL_PREFIX=/home/wangzhe/zhe/intel-extension-for-pytorch/build/Debug/packages/intel_extension_for_pytorch", | ||
"-DCMAKE_PREFIX_PATH=/home/wangzhe/.local/envs/zhe_ipex/lib/python3.9/site-packages/torch/share/cmake", | ||
"-DCMAKE_PROJECT_VERSION=2.2.0", | ||
"-DIPEX_PROJ_NAME=intel_extension_for_pytorch", | ||
"-DLIBIPEX_GITREV=969e67bf8", | ||
"-DLIBIPEX_VERSION=2.2.0+git969e67b", | ||
"-DPYTHON_EXECUTABLE=/home/wangzhe/.local/envs/zhe_ipex/bin/python", | ||
"-DPYTHON_INCLUDE_DIR=/home/wangzhe/.local/envs/zhe_ipex/include/python3.9", | ||
"-DPYTHON_PLATFORM_INFO=Linux-5.16.0-rc1-intel-next-00543-g5867b0a2a125-x86_64-with-glibc2.28", | ||
], | ||
"cmake.buildDirectory": "${workspaceFolder}/build", | ||
"clangd.arguments": [ | ||
"--log=verbose", | ||
"--header-insertion=iwyu", | ||
"--query-driver=/home/wangzhe/.local/envs/zhe_ipex/bin/g++*", | ||
// 在后台自动分析文件(基于complie_commands) | ||
"--background-index", | ||
// 同时开启的任务数量 | ||
"-j=12", | ||
// clang-tidy功能 | ||
"--clang-tidy", | ||
"--clang-tidy-checks=performance-*,bugprone-*", | ||
// 全局补全(会自动补充头文件) | ||
"--all-scopes-completion", | ||
// 更详细的补全内容 | ||
"--completion-style=detailed", | ||
// 补充头文件的形式 | ||
"--header-insertion=iwyu", | ||
// pch优化的位置 | ||
"--pch-storage=disk", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "sourceScript", | ||
"type": "shell", | ||
"command": "source env_init.sh" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
set -x | ||
set -e | ||
|
||
VER_LLVM="llvmorg-13.0.0" | ||
VER_PYTORCH="" | ||
VER_TORCHVISION="" | ||
VER_TORCHAUDIO="" | ||
VER_IPEX="v2.0.100+cpu" | ||
|
||
# Check existance of required Linux commands | ||
for CMD in gcc g++ python git nproc; do | ||
command -v ${CMD} || ( | ||
echo "Error: Command \"${CMD}\" not found." | ||
exit 4 | ||
) | ||
done | ||
echo "You are using GCC: $(gcc --version | grep gcc)" | ||
|
||
MAX_JOBS_VAR=$(nproc) | ||
if [ ! -z "${MAX_JOBS}" ]; then | ||
MAX_JOBS_VAR=${MAX_JOBS} | ||
fi | ||
|
||
# Save current directory path | ||
BASEFOLDER=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
cd ${BASEFOLDER} | ||
|
||
ABI=$(python -c "import torch; print(int(torch._C._GLIBCXX_USE_CXX11_ABI))") | ||
|
||
# Compile individual component | ||
# LLVM | ||
cd llvm-project | ||
|
||
LLVM_ROOT="$(pwd)/release" | ||
# ln -s ${LLVM_ROOT}/bin/llvm-config ${LLVM_ROOT}/bin/llvm-config-13 | ||
export PATH=${LLVM_ROOT}/bin:$PATH | ||
export LD_LIBRARY_PATH=${LLVM_ROOT}/lib:$LD_LIBRARY_PATH | ||
# Intel® Extension for PyTorch* | ||
cd ../intel-extension-for-pytorch | ||
python -m pip install -r requirements.txt | ||
export USE_LLVM=${LLVM_ROOT} | ||
export LLVM_DIR=${USE_LLVM}/lib/cmake/llvm | ||
export DNNL_GRAPH_BUILD_COMPILER_BACKEND=1 | ||
# python setup.py clean | ||
python setup.py bdist_wheel 2>&1 | tee build.log | ||
unset DNNL_GRAPH_BUILD_COMPILER_BACKEND | ||
unset LLVM_DIR | ||
unset USE_LLVM | ||
python -m pip install --force-reinstall dist/*.whl | ||
|
||
# Sanity Test | ||
cd .. | ||
python -c "import torch; import torchvision; import torchaudio; import intel_extension_for_pytorch as ipex; print(f'torch_cxx11_abi: {torch._C._GLIBCXX_USE_CXX11_ABI}'); print(f'torch_version: {torch.__version__}'); print(f'torchvision_version: {torchvision.__version__}'); print(f'torchaudio_version: {torchaudio.__version__}'); print(f'ipex_version: {ipex.__version__}');" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
set -x | ||
set -e | ||
|
||
VER_LLVM="llvmorg-13.0.0" | ||
VER_PYTORCH="" | ||
VER_TORCHVISION="" | ||
VER_TORCHAUDIO="" | ||
VER_IPEX="v2.0.100+cpu" | ||
|
||
# Check existance of required Linux commands | ||
for CMD in gcc g++ python git nproc; do | ||
command -v ${CMD} || (echo "Error: Command \"${CMD}\" not found." ; exit 4) | ||
done | ||
echo "You are using GCC: $(gcc --version | grep gcc)" | ||
|
||
MAX_JOBS_VAR=$(nproc) | ||
if [ ! -z "${MAX_JOBS}" ]; then | ||
MAX_JOBS_VAR=${MAX_JOBS} | ||
fi | ||
|
||
# Save current directory path | ||
BASEFOLDER=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
cd ${BASEFOLDER} | ||
# Checkout individual components | ||
if [ ! -d llvm-project ]; then | ||
git clone https://github.com/llvm/llvm-project.git | ||
fi | ||
if [ ! -d intel-extension-for-pytorch ]; then | ||
git clone https://github.com/intel/intel-extension-for-pytorch.git | ||
fi | ||
|
||
# Checkout required branch/commit and update submodules | ||
cd llvm-project | ||
if [ ! -z ${VER_LLVM} ]; then | ||
git checkout ${VER_LLVM} | ||
fi | ||
git submodule sync | ||
git submodule update --init --recursive | ||
cd ../intel-extension-for-pytorch | ||
if [ ! -z ${VER_IPEX} ]; then | ||
git checkout ${VER_IPEX} | ||
fi | ||
git submodule sync | ||
git submodule update --init --recursive | ||
|
||
# Install dependencies | ||
python -m pip install cmake | ||
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu | ||
ABI=$(python -c "import torch; print(int(torch._C._GLIBCXX_USE_CXX11_ABI))") | ||
|
||
# Compile individual component | ||
# LLVM | ||
cd ../llvm-project | ||
if [ -d build ]; then | ||
rm -rf build | ||
fi | ||
mkdir build | ||
cd build | ||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=${ABI}" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF ../llvm/ | ||
cmake --build . -j ${MAX_JOBS_VAR} | ||
LLVM_ROOT="$(pwd)/../release" | ||
if [ -d ${LLVM_ROOT} ]; then | ||
rm -rf ${LLVM_ROOT} | ||
fi | ||
cmake -DCMAKE_INSTALL_PREFIX=${LLVM_ROOT}/../release/ -P cmake_install.cmake | ||
#xargs rm -rf < install_manifest.txt | ||
ln -s ${LLVM_ROOT}/bin/llvm-config ${LLVM_ROOT}/bin/llvm-config-13 | ||
export PATH=${LLVM_ROOT}/bin:$PATH | ||
export LD_LIBRARY_PATH=${LLVM_ROOT}/lib:$LD_LIBRARY_PATH | ||
cd .. | ||
# Intel® Extension for PyTorch* | ||
cd ../intel-extension-for-pytorch | ||
python -m pip install -r requirements.txt | ||
export USE_LLVM=${LLVM_ROOT} | ||
export LLVM_DIR=${USE_LLVM}/lib/cmake/llvm | ||
export DNNL_GRAPH_BUILD_COMPILER_BACKEND=1 | ||
python setup.py clean | ||
python setup.py bdist_wheel 2>&1 | tee build.log | ||
unset DNNL_GRAPH_BUILD_COMPILER_BACKEND | ||
unset LLVM_DIR | ||
unset USE_LLVM | ||
python -m pip install --force-reinstall dist/*.whl | ||
|
||
# Sanity Test | ||
cd .. | ||
python -c "import torch; import torchvision; import torchaudio; import intel_extension_for_pytorch as ipex; print(f'torch_cxx11_abi: {torch._C._GLIBCXX_USE_CXX11_ABI}'); print(f'torch_version: {torch.__version__}'); print(f'torchvision_version: {torchvision.__version__}'); print(f'torchaudio_version: {torchaudio.__version__}'); print(f'ipex_version: {ipex.__version__}');" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ | ||
{ | ||
"name": "ipex", | ||
"environmentSetupScript": "/home/wangzhe/zhe/intel-extension-for-pytorch/env_init.sh", | ||
"compilers": { | ||
"C": "/home/wangzhe/.local/envs/zhe_ipex/bin/gcc", | ||
"CXX": "/home/wangzhe/.local/envs/zhe_ipex/bin/g++" | ||
}, | ||
"isTrusted": true | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Current File", | ||
"type": "python", | ||
"request": "launch", | ||
"args": [ | ||
"bdist_wheel" | ||
], | ||
"program": "${file}", | ||
"console": "integratedTerminal", | ||
"justMyCode": false, | ||
"preLaunchTask": "sourceScript" | ||
}, | ||
{ | ||
"name": "(gdb) Attach", | ||
"type": "cppdbg", | ||
"request": "attach", | ||
"program": "/home/wangzhe/.local/envs/zhe_ipex/bin/python", | ||
"processId": "${command:pickProcess}", | ||
"MIMode": "gdb", | ||
"miDebuggerPath": "/home/wangzhe/.local/envs/zhe_ipex/bin/gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"cmake.configureArgs": [ | ||
"-DBUILD_MODULE_TYPE=CPU", | ||
"-DBUILD_WITH_XPU=OFF", | ||
"-DCMAKE_BUILD_TYPE=Debug", | ||
"-DCMAKE_INSTALL_LIBDIR=lib", | ||
"-DCMAKE_INSTALL_PREFIX=/home/wangzhe/zhe/intel-extension-for-pytorch/build/Debug/packages/intel_extension_for_pytorch", | ||
"-DCMAKE_PREFIX_PATH=/home/wangzhe/.local/envs/zhe_ipex/lib/python3.9/site-packages/torch/share/cmake", | ||
"-DCMAKE_PROJECT_VERSION=2.0.100", | ||
"-DIPEX_INSTALL_LIBDIR=/home/wangzhe/zhe/intel-extension-for-pytorch/build/Debug/packages/intel_extension_for_pytorch/lib", | ||
"-DIPEX_PROJ_NAME=intel_extension_for_pytorch", | ||
"-DLIBIPEX_GITREV=6aa94f277", | ||
"-DLIBIPEX_VERSION=2.0.100+git6aa94f2", | ||
"-DPYTHON_EXECUTABLE=/home/wangzhe/.local/envs/zhe_ipex/bin/python", | ||
"-DPYTHON_INCLUDE_DIR=/home/wangzhe/.local/envs/zhe_ipex/include/python3.9", | ||
"-DPYTHON_PLATFORM_INFO=Linux-5.16.0-rc1-intel-next-00543-g5867b0a2a125-x86_64-with-glibc2.28" | ||
], | ||
"cmake.buildDirectory": "${workspaceFolder}/build", | ||
"clangd.arguments": [ | ||
"--log=verbose", | ||
"--header-insertion=iwyu", | ||
"--query-driver=/home/wangzhe/.local/envs/zhe_ipex/bin/g++*", | ||
// 在后台自动分析文件(基于complie_commands) | ||
"--background-index", | ||
// 同时开启的任务数量 | ||
"-j=12", | ||
// clang-tidy功能 | ||
"--clang-tidy", | ||
"--clang-tidy-checks=performance-*,bugprone-*", | ||
// 全局补全(会自动补充头文件) | ||
"--all-scopes-completion", | ||
// 更详细的补全内容 | ||
"--completion-style=detailed", | ||
// 补充头文件的形式 | ||
"--header-insertion=iwyu", | ||
// pch优化的位置 | ||
"--pch-storage=disk", | ||
], | ||
} |
Oops, something went wrong.