Skip to content

Commit

Permalink
Merge branch 'trt-latest'
Browse files Browse the repository at this point in the history
  • Loading branch information
WolframRhodium committed Apr 25, 2024
1 parent 39ce4d1 commit 5fea4b3
Show file tree
Hide file tree
Showing 25 changed files with 1,115 additions and 516 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/linux-ov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Build (Linux-OV)
on:
push:
paths:
- 'common/**'
- 'vsov/**'
- '.github/workflows/linux-ov.yml'
workflow_dispatch:
Expand All @@ -18,7 +17,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -27,17 +26,17 @@ jobs:

- name: Cache protobuf
id: cache-protobuf
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vsov/protobuf/install
key: ${{ runner.os }}-vsov-protobuf-v1

- name: Checkout protobuf
uses: actions/checkout@v3
uses: actions/checkout@v4
if: steps.cache-protobuf.outputs.cache-hit != 'true'
with:
repository: protocolbuffers/protobuf
# follows protobuf in https://github.com/openvinotoolkit/openvino/tree/2023.2.0/thirdparty/protobuf
# follows protobuf in https://github.com/openvinotoolkit/openvino/tree/2024.0.0/thirdparty/protobuf
# if you change this, remember to bump the version of the cache key.
ref: fe271ab76f2ad2b2b28c10443865d2af21e27e0e
fetch-depth: 1
Expand All @@ -60,19 +59,19 @@ jobs:

- name: Cache onnx
id: cache-onnx
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vsov/onnx/install
key: ${{ runner.os }}-vsov-onnx-v1

- name: Checkout onnx
if: steps.cache-onnx.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: onnx/onnx
# follows onnx in https://github.com/openvinotoolkit/openvino/tree/2023.2.0/thirdparty/onnx
# follows onnx in https://github.com/openvinotoolkit/openvino/tree/2024.0.0/thirdparty/onnx
# if you change this, remember to bump the version of the cache key.
ref: 1014f41f17ecc778d63e760a994579d96ba471ff
ref: b86cc54efce19530fb953e4b21f57e6b3888534c
fetch-depth: 1
path: vsov/onnx

Expand Down Expand Up @@ -104,7 +103,7 @@ jobs:
- name: Setup OpenVINO
run: |
curl -L -o ov.tgz https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.2/linux/l_openvino_toolkit_ubuntu22_2023.2.0.13089.cfd42bd2cb0_x86_64.tgz
curl -L -o ov.tgz https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.0/linux/l_openvino_toolkit_ubuntu22_2024.0.0.14509.34caeefd078_x86_64.tgz
tar -xf ov.tgz
mv l_openvino_* openvino -v
Expand All @@ -113,7 +112,6 @@ jobs:
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_CXX_FLAGS="-Wall -ffast-math -march=x86-64-v3"
-D VAPOURSYNTH_INCLUDE_DIRECTORY="`pwd`/vapoursynth/include"
-D InferenceEngine_DIR=openvino/runtime/cmake
-D OpenVINO_DIR=openvino/runtime/cmake
-D ENABLE_VISUALIZATION=ON
-D WIN32_SHARED_OPENVINO=ON
Expand All @@ -135,7 +133,7 @@ jobs:
run: git describe --tags --long

- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: VSOV-Linux-x64
path: vsov/artifact
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/linux-trt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -30,20 +30,16 @@ jobs:
unzip -q vs.zip
mv vapoursynth*/ vapoursynth
- name: Setup CUDA
- name: Setup CUDA and TensorRT
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get install -y cuda-nvcc-12-1 cuda-cudart-dev-12-1 libcublas-dev-12-1 libcudnn8=8.9.0.131-1+cuda12.1 libcudnn8-dev=8.9.0.131-1+cuda12.1
sudo apt-get install -y cuda-nvcc-12-4 cuda-cudart-dev-12-4 libnvinfer-dev=10.0.1.6-1+cuda12.4 libnvinfer-headers-dev=10.0.1.6-1+cuda12.4
echo "PATH=/usr/local/cuda/bin${PATH:+:${PATH}}" >> $GITHUB_ENV
echo "CUDA_PATH=/usr/local/cuda" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/usr/local/cuda/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
- name: Setup tensorrt
run: |
sudo apt-get install -y libnvinfer-dev=8.6.1.6-1+cuda12.0 libnvinfer-headers-dev=8.6.1.6-1+cuda12.0
- name: Configure
run: cmake -S . -B build -G Ninja -LA
-D CMAKE_BUILD_TYPE=Release
Expand All @@ -66,8 +62,9 @@ jobs:
run: git describe --tags --long

- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: VSTRT-Linux-x64
path: vstrt/artifact
overwrite: true

83 changes: 18 additions & 65 deletions .github/workflows/windows-cuda-dependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,63 +28,41 @@ jobs:
shell: bash

steps:
# Note: unfortunately, cuDNN download requires registration and according to its license
# agreements, we can only redistribute it along with an application that uses it, so we
# have to use a private repository to hold a copy of the library.
- name: Download cuDNN inference library
run: |
# https://stackoverflow.com/questions/20396329/how-to-download-github-release-from-private-repo-using-command-line/35688093#35688093
tag=cudnn-8.6.0-bin
name=cudnn.7z
AUTH="Authorization: token ${{ secrets.REPO_TOKEN }}"
response=$(curl -sH "$AUTH" https://api.github.com/repos/AmusementClub/cuda/releases/tags/$tag)
eval $(echo "$response" | grep -C3 "name.:.\+$NAME" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
[ "$id" ] || { echo "Error: Failed to get asset id, response: $response" | awk 'length($0)<100' >&2; exit 1; }
ASSET="https://api.github.com/repos/AmusementClub/cuda/releases/assets/$id"
curl -LJO -H "$AUTH" -H 'Accept: application/octet-stream' "$ASSET"
run: curl -LJ https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/windows-x86_64/cudnn-windows-x86_64-8.9.7.29_cuda12-archive.zip -o cudnn.zip

- name: Extract cuDNN library
run: 7z x cudnn.7z
run: unzip cudnn.zip

- name: Move cuDNN library
run: mv cudnn/bin vsmlrt-cuda -v
run: |
mkdir -p vsmlrt-cuda
mv cudnn-windows-*/bin/*.dll vsmlrt-cuda/ -v
rm vsmlrt-cuda/cudnn_*_train*.dll -v
# Same licensing issue with the tensorrt libraries.
- name: Download TensorRT library
run: |
# https://stackoverflow.com/questions/20396329/how-to-download-github-release-from-private-repo-using-command-line/35688093#35688093
tag=tensorrt-8.5.1-bin
name=TensorRT.7z
AUTH="Authorization: token ${{ secrets.REPO_TOKEN }}"
response=$(curl -sH "$AUTH" https://api.github.com/repos/AmusementClub/cuda/releases/tags/$tag)
eval $(echo "$response" | grep -C3 "name.:.\+$NAME" | grep -w id | tr : = | tr -cd '[[:alnum:]]=')
[ "$id" ] || { echo "Error: Failed to get asset id, response: $response" | awk 'length($0)<100' >&2; exit 1; }
ASSET="https://api.github.com/repos/AmusementClub/cuda/releases/assets/$id"
curl -LJO -H "$AUTH" -H 'Accept: application/octet-stream' "$ASSET"
mv "$name" trt.7z
curl -L -o trt.zip https://developer.download.nvidia.com/compute/machine-learning/tensorrt/10.0.1/zip/TensorRT-10.0.1.6.Windows10.win10.cuda-12.4.zip
- name: Extract TensorRT library
run: 7z x trt.7z
run: |
unzip trt.zip
mv TensorRT-*/ TensorRT/
- name: Move TensorRT library
run: mv TensorRT/*.dll vsmlrt-cuda -v
run: mv TensorRT/lib/*.dll vsmlrt-cuda -v

- name: Download CUDA Libraries
shell: cmd
run: |
curl -s -o cuda_installer.exe -L https://developer.download.nvidia.com/compute/cuda/11.8.0/network_installers/cuda_11.8.0_windows_network.exe
cuda_installer.exe -s cudart_11.8 cublas_11.8 cufft_11.8 cupti_11.8 nvrtc_11.8
curl -s -o cuda_installer.exe -L https://developer.download.nvidia.com/compute/cuda/12.4.1/network_installers/cuda_12.4.1_windows_network.exe
cuda_installer.exe -s cudart_12.4 cublas_12.4 cufft_12.4 cupti_12.4 nvrtc_12.4
- name: Move CUDA Libraries
shell: cmd
run: |
move "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\extras\CUPTI\lib64\cupti*.dll" vsmlrt-cuda
move "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\*.dll" vsmlrt-cuda
move "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\extras\CUPTI\lib64\cupti*.dll" vsmlrt-cuda
move "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\*.dll" vsmlrt-cuda
del vsmlrt-cuda\cudart32*.dll
- name: Setup VC commands
Expand All @@ -99,7 +77,7 @@ jobs:
while true; do
changed=false
for dll in *.[dD][lL][lL]; do
for dep in $(dumpbin -dependents "$dll" | grep -o -i '\(vc\|msvc\)[a-z0-9_-]*\.dll'); do
for dep in $(dumpbin -dependents "$dll" | grep -o -i '\<\(vc\|msvc\)[a-z0-9_-]*\.dll'); do
echo "finding $dep for $dll"
if ! test -f ./"$dep"; then
changed=true
Expand All @@ -113,42 +91,17 @@ jobs:
$changed || break
done
- name: Cache zlib
id: cache-zlib
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/zlib-release
key: ${{ runner.os }}-zlib-1.2.12

- name: Setup msbuild
if: steps.cache-zlib.outputs.cache-hit != 'true'
uses: microsoft/setup-msbuild@v1

- name: Compile zlib
if: steps.cache-zlib.outputs.cache-hit != 'true'
shell: cmd
run: |
curl -s -o zlib.tar.gz -LJO https://github.com/madler/zlib/archive/refs/tags/v1.2.12.tar.gz
tar -xf zlib.tar.gz
cd zlib-1.2.12\contrib\vstudio\vc14
python -c "f=open('zlibvc.vcxproj','r+b');s=f.read();s=s.replace(b'MultiThreadedDLL',b'MultiThreaded');start=s.index(b'<ClCompile Include=\"..\\..\\masmx64\\inffas8664.c\">');end_str=b'</ClCompile>\n';end=s.index(end_str,start);s=s[:start]+s[end+len(end_str):];f.seek(0);f.write(s);f.truncate();f.close()"
msbuild zlibvc.sln -target:zlibvc /p:Configuration=ReleaseWithoutAsm /p:Platform=x64 /p:PlatformToolset=v143 -maxCpuCount
mkdir %GITHUB_WORKSPACE%\zlib-release
move x64\ZlibDllReleaseWithoutAsm\zlibwapi.dll %GITHUB_WORKSPACE%\zlib-release
- name: Copy zlib
run: cp -v zlib-release/zlibwapi.dll vsmlrt-cuda

- name: Compress
run: |
7z a -t7z -mx=3 vsmlrt-cuda.7z vsmlrt-cuda
- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: vsmlrt-cuda
path: vsmlrt-cuda.7z
retention-days: 1
compression-level: 0

- name: Rename release asset
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/windows-ncnn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -48,13 +48,13 @@ jobs:

- name: Cache protobuf
id: cache-protobuf
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vsncnn/protobuf/install
key: ${{ runner.os }}-vsncnn-protobuf-v3.16.0

- name: Checkout protobuf
uses: actions/checkout@v3
uses: actions/checkout@v4
if: steps.cache-protobuf.outputs.cache-hit != 'true'
with:
repository: protocolbuffers/protobuf
Expand All @@ -81,14 +81,14 @@ jobs:

- name: Cache onnx
id: cache-onnx
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vsncnn/onnx/install
key: ${{ runner.os }}-vsncnn-onnx-v1.12.0-protobuf-v3.16.0

- name: Checkout onnx
if: steps.cache-onnx.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: onnx/onnx
ref: v1.12.0
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
copy install\bin\vsncnn.dll artifact\
- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: VSNCNN-GPU-Windows-x64
path: vsncnn/artifact
Expand Down
Loading

0 comments on commit 5fea4b3

Please sign in to comment.