Skip to content

Commit

Permalink
Change scale_cuda to scale_npp (#2851)
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko authored Sep 21, 2023
1 parent ef3def3 commit ecc2839
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 152 deletions.
151 changes: 34 additions & 117 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ concurrency:

jobs:
linux-build:
name: Build binaries for ${{ matrix.platform.name }}-${{ matrix.arch }}
name: Build binaries for ${{ matrix.platform.name }}-${{ matrix.hardware.type }}-${{ matrix.arch }}
runs-on: ${{ matrix.platform.runner }}
container:
image: ${{ matrix.hardware.container }}
env:
DEBIAN_FRONTEND: noninteractive
strategy:
fail-fast: false
matrix:
Expand All @@ -27,6 +31,11 @@ jobs:
runner: ubuntu-20.04
- name: windows
runner: ubuntu-20.04
hardware:
- type: cpu
container: ubuntu:20.04
- type: gpu
container: livepeerci/cuda:11.7.1-cudnn8-devel-ubuntu20.04
exclude:
- platform:
name: windows
Expand All @@ -35,10 +44,10 @@ jobs:
steps:
- name: Setup ubuntu container
run: |
sudo apt update
sudo apt install -yqq build-essential make software-properties-common
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update && sudo apt install -yqq git zip unzip zlib1g-dev zlib1g
apt update
apt install -yqq build-essential make software-properties-common
add-apt-repository -y ppa:git-core/ppa
apt update && apt install -yqq git zip unzip zlib1g-dev zlib1g yasm
- name: Check out code
uses: actions/[email protected]
Expand All @@ -48,10 +57,6 @@ jobs:
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Cleanup hosted runner
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android
- name: Set up go
id: go
uses: actions/setup-go@v4
Expand All @@ -65,30 +70,39 @@ jobs:
uses: actions/cache@v3
with:
path: /home/runner/compiled
key: ${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.arch }}-ffmpeg-${{ hashFiles('**/install_ffmpeg.sh') }}
key: ${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.hardware.type }}-${{ matrix.arch }}-ffmpeg-${{ hashFiles('**/install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.arch }}-ffmpeg-
${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.hardware.type }}-${{ matrix.arch }}-ffmpeg-
- name: Set build environment
run: |
echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
echo "GOOS=${{ matrix.platform.name }}" >> $GITHUB_ENV
echo "GO_BUILD_DIR=lp-builds/" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/github/home/compiled/lib/pkgconfig" >> $GITHUB_ENV
- name: Set GPU build environment
if: matrix.hardware.type == 'gpu'
run: |
echo "CPATH=/usr/local/cuda_${{ matrix.arch }}/include" >> $GITHUB_ENV
echo "LIBRARY_PATH=/usr/local/cuda_${{ matrix.arch }}/lib64" >> $GITHUB_ENV
echo "CGO_LDFLAGS=-L/usr/local/cuda_${{ matrix.arch }}/lib64" >> $GITHUB_ENV
echo "RELEASE_TAG=gpu" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt update \
&& sudo apt install -yqq software-properties-common curl apt-transport-https lsb-release \
&& curl -fsSl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
&& sudo add-apt-repository "deb https://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-12 main" \
&& sudo apt update \
&& sudo apt -yqq install \
apt update \
&& apt install -yqq software-properties-common curl apt-transport-https lsb-release \
&& curl -fsSl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& add-apt-repository "deb https://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-12 main" \
&& apt update \
&& apt -yqq install \
clang-12 clang-tools-12 lld-12 build-essential pkg-config autoconf git python \
gcc-multilib gcc-mingw-w64 libgcc-9-dev-arm64-cross mingw-w64-tools gcc-mingw-w64-x86-64
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 30 \
&& sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 30 \
&& sudo update-alternatives --install /usr/bin/ld ld /usr/bin/lld-12 30
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 30 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 30 \
&& update-alternatives --install /usr/bin/ld ld /usr/bin/lld-12 30
- name: Install go modules
if: steps.go.outputs.cache-hit != 'true'
Expand All @@ -101,7 +115,6 @@ jobs:
- name: Build binaries
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
PKG_CONFIG_PATH: "/home/runner/compiled/lib/pkgconfig"
run: |
git config --global --add safe.directory '*'
./ci_env.sh make
Expand Down Expand Up @@ -224,101 +237,6 @@ jobs:
- name: Notify new build upload
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev

linux-tensorflow:
name: Build binaries for linux using tensorflow
runs-on: ubuntu-20.04

steps:
- name: Setup ubuntu container
run: |
sudo apt update
sudo apt install -yqq build-essential make software-properties-common
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update && sudo apt install -yqq git zip unzip zlib1g-dev zlib1g coreutils binutils libc++-dev libc++abi-dev libtool p7zip-full mediainfo xz-utils
- name: Check out code
uses: actions/[email protected]
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Cleanup hosted runner
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android
- name: Set up go
id: go
uses: actions/setup-go@v4
with:
go-version: 1.20.4
cache: true
cache-dependency-path: go.sum

- name: Cache ffmpeg
id: cache-ffmpeg
uses: actions/cache@v3
with:
path: /home/runner/compiled
key: ${{ runner.os }}-ffmpeg-tf-${{ hashFiles('**/install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-ffmpeg-tf-
- name: Install dependencies
env:
LIBTENSORFLOW_VERSION: "2.12.1"
run: |
sudo apt update \
&& sudo apt install -yqq software-properties-common curl apt-transport-https lsb-release \
&& curl -fsSl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - \
&& sudo add-apt-repository "deb https://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-12 main" \
&& sudo apt update \
&& sudo apt -yqq install clang-12 clang-tools-12 lld-12 build-essential pkg-config autoconf git python
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 30 \
&& sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 30 \
&& sudo update-alternatives --install /usr/bin/ld ld /usr/bin/lld-12 30
sudo curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& sudo tar -C /usr/local -xzf libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& sudo ldconfig
- name: Install go modules
# if: steps.go.outputs.cache-hit != 'true'
run: go mod download

- name: Install ffmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: ./install_ffmpeg.sh

- name: Build binaries
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
PKG_CONFIG_PATH: "/home/runner/compiled/lib/pkgconfig"
run: |
git config --global --add safe.directory '*'
./ci_env.sh make cgo_cflags="-lz" all
rm -rf ~/build && mkdir ~/build && mv livepeer* ~/build/
- name: Upload build
run: cp ~/build/* . && ./upload_build.sh
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
DISCORD_URL: ${{ secrets.DISCORD_URL }}
RELEASE_TAG: "tensorflow"

- name: Upload artifacts for cutting release
uses: actions/upload-artifact@master
with:
name: release-artifacts
path: releases/

- name: Notify new build upload
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev

upload:
name: Upload artifacts to google bucket
permissions:
Expand All @@ -328,7 +246,6 @@ jobs:
needs:
- macos-build
- linux-build
- linux-tensorflow
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ endif
.PHONY: livepeer livepeer_bench livepeer_cli livepeer_router docker

livepeer:
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags)" go build -o $(GO_BUILD_DIR) -tags "$(BUILD_TAGS)" -ldflags="$(ldflags)" cmd/livepeer/*.go
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags) ${CGO_LDFLAGS}" go build -o $(GO_BUILD_DIR) -tags "$(BUILD_TAGS)" -ldflags="$(ldflags)" cmd/livepeer/*.go

livepeer_cli:
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags)" go build -o $(GO_BUILD_DIR) -tags "$(BUILD_TAGS)" -ldflags="$(ldflags)" cmd/livepeer_cli/*.go
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags) ${CGO_LDFLAGS}" go build -o $(GO_BUILD_DIR) -tags "$(BUILD_TAGS)" -ldflags="$(ldflags)" cmd/livepeer_cli/*.go

livepeer_bench:
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags)" go build -o $(GO_BUILD_DIR) -ldflags="$(ldflags)" cmd/livepeer_bench/*.go
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags) ${CGO_LDFLAGS}" go build -o $(GO_BUILD_DIR) -ldflags="$(ldflags)" cmd/livepeer_bench/*.go

livepeer_router:
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags)" go build -o $(GO_BUILD_DIR) -ldflags="$(ldflags)" cmd/livepeer_router/*.go
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags) ${CGO_LDFLAGS}" go build -o $(GO_BUILD_DIR) -ldflags="$(ldflags)" cmd/livepeer_router/*.go

docker:
docker build --build-arg='BUILD_TAGS=mainnet,experimental' -f docker/Dockerfile .
docker buildx build --build-arg='BUILD_TAGS=mainnet,experimental' -f docker/Dockerfile .
11 changes: 6 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
FROM --platform=$BUILDPLATFORM ubuntu:20.04 as build
FROM --platform=$BUILDPLATFORM livepeerci/cuda:11.7.1-cudnn8-devel-ubuntu20.04 as build

ARG TARGETARCH
ARG BUILDARCH

ENV GOARCH="$TARGETARCH" \
PATH="/usr/local/go/bin:/go/bin:${PATH}" \
PKG_CONFIG_PATH="/root/compiled/lib/pkgconfig" \
CPATH="/usr/local/cuda/include" \
LIBRARY_PATH="/usr/local/cuda/lib64" \
DEBIAN_FRONTEND="noninteractive"
CPATH="/usr/local/cuda_${TARGETARCH}/include" \
LIBRARY_PATH="/usr/local/cuda_${TARGETARCH}/lib64" \
DEBIAN_FRONTEND="noninteractive" \
CGO_LDFLAGS="-L/usr/local/cuda_${TARGETARCH}/lib64"

RUN apt update \
&& apt install -yqq software-properties-common curl apt-transport-https lsb-release \
&& apt install -yqq software-properties-common curl apt-transport-https lsb-release yasm \
&& curl -fsSL https://dl.google.com/go/go1.20.4.linux-${BUILDARCH}.tar.gz | tar -C /usr/local -xz \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& add-apt-repository "deb [arch=${BUILDARCH}] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
Expand Down
18 changes: 18 additions & 0 deletions docker/Dockerfile.cuda-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# livepeer/cuda-base:11.7.1-cudnn8-devel-ubuntu20.04
#
# Base CUDA Develop image which contains CUDA SDK libs for the following architectures: linux amd64, linux arm64, windows amd64
#
# To build this image you need the following steps:
# 1. Download NVIDIA CUDA SDK for ARM64, extract, and copy into cuda/arm64/usr/local/cuda/
# 2. Download NVIDIA CUDA SDK for Windows AMD64, extract, and copy npp libs into npp_win/

FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04

COPY npp_win/lib/x64/* /usr/local/cuda/lib64/
COPY npp_win/include/* /usr/local/cuda/include/

RUN mkdir -p /usr/local/cuda_arm64/lib64/
COPY cuda/arm64/usr/local/cuda/lib64/libnp* /usr/local/cuda_arm64/lib64/
COPY cuda/arm64/usr/local/cuda/include /usr/local/cuda_arm64/include

RUN ln -s /usr/local/cuda /usr/local/cuda_amd64
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/jaypipes/pcidb v1.0.0
github.com/livepeer/go-tools v0.0.0-20220805063103-76df6beb6506
github.com/livepeer/livepeer-data v0.7.2-0.20230601112542-e54477bc9479
github.com/livepeer/lpms v0.0.0-20230914095059-f59041708b97
github.com/livepeer/lpms v0.0.0-20230918073815-4fe16b9b9026
github.com/livepeer/m3u8 v0.11.1
github.com/mattn/go-sqlite3 v1.14.16
github.com/olekukonko/tablewriter v0.0.5
Expand Down
12 changes: 4 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -513,16 +513,12 @@ github.com/livepeer/livepeer-data v0.7.2-0.20230601112542-e54477bc9479 h1:oZlEaa
github.com/livepeer/livepeer-data v0.7.2-0.20230601112542-e54477bc9479/go.mod h1:Jpf4jHK+fbWioBHRDRM1WadNT1qmY27g2YicTdO0Rtc=
github.com/livepeer/lpms v0.0.0-20230125115958-32cd1538cc04 h1:pl7pF/TOAU9+lBbaehu4+2wn1mn6iB5AhPtysMLzjSI=
github.com/livepeer/lpms v0.0.0-20230125115958-32cd1538cc04/go.mod h1:Hr/JhxxPDipOVd4ZrGYWrdJfpVF8/SEI0nNr2ctAlkM=
github.com/livepeer/lpms v0.0.0-20230829103633-3948710a15cb h1:Cl0zInI5J+ZSNmx0e2jfgXvYHtynW3TDkU3oT8TIm0Q=
github.com/livepeer/lpms v0.0.0-20230829103633-3948710a15cb/go.mod h1:Hr/JhxxPDipOVd4ZrGYWrdJfpVF8/SEI0nNr2ctAlkM=
github.com/livepeer/lpms v0.0.0-20230829131239-e9afe5decc7b h1:mSNDvKVVqU1sfkvADf7Ph3PCklE3yIYlvydE9O9vX6k=
github.com/livepeer/lpms v0.0.0-20230829131239-e9afe5decc7b/go.mod h1:Hr/JhxxPDipOVd4ZrGYWrdJfpVF8/SEI0nNr2ctAlkM=
github.com/livepeer/lpms v0.0.0-20230830120957-e8052f0da24e h1:2dTDAyjbHe5GNzik6O5UnecMPdv85nClo/TJCRQRdjw=
github.com/livepeer/lpms v0.0.0-20230830120957-e8052f0da24e/go.mod h1:Hr/JhxxPDipOVd4ZrGYWrdJfpVF8/SEI0nNr2ctAlkM=
github.com/livepeer/lpms v0.0.0-20230908073450-33906e16825a h1:jwcXUPAGkF8hycp9A5/0KGqIZ468dZDGDigy4llDYCk=
github.com/livepeer/lpms v0.0.0-20230908073450-33906e16825a/go.mod h1:Hr/JhxxPDipOVd4ZrGYWrdJfpVF8/SEI0nNr2ctAlkM=
github.com/livepeer/lpms v0.0.0-20230914095059-f59041708b97 h1:RDM5vkKbNHarkI6+OjqHFIbpg30pU7PcEUO5I1k03g8=
github.com/livepeer/lpms v0.0.0-20230914095059-f59041708b97/go.mod h1:Hr/JhxxPDipOVd4ZrGYWrdJfpVF8/SEI0nNr2ctAlkM=
github.com/livepeer/lpms v0.0.0-20230831075050-b4d36c999826 h1:kXhxR6PQEEpwbwooFtNkT9Iv41C6O11PhDlvAb7+biE=
github.com/livepeer/lpms v0.0.0-20230831075050-b4d36c999826/go.mod h1:Hr/JhxxPDipOVd4ZrGYWrdJfpVF8/SEI0nNr2ctAlkM=
github.com/livepeer/lpms v0.0.0-20230918073815-4fe16b9b9026 h1:xeP83m9ReB2drvOdqc6s2OL4L1U/6mZULA5eS+OHmtc=
github.com/livepeer/lpms v0.0.0-20230918073815-4fe16b9b9026/go.mod h1:Hr/JhxxPDipOVd4ZrGYWrdJfpVF8/SEI0nNr2ctAlkM=
github.com/livepeer/m3u8 v0.11.1 h1:VkUJzfNTyjy9mqsgp5JPvouwna8wGZMvd/gAfT5FinU=
github.com/livepeer/m3u8 v0.11.1/go.mod h1:IUqAtwWPAG2CblfQa4SVzTQoDcEMPyfNOaBSxqHMS04=
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
Expand Down
32 changes: 16 additions & 16 deletions install_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ EXTRA_LDFLAGS=""
EXTRA_X264_FLAGS=""
EXTRA_FFMPEG_FLAGS=""


if [[ "$ARCH" == "arm64" && "$UNAME" == "Darwin" ]]; then
# Detect Apple Silicon
IS_ARM64=1
Expand All @@ -19,8 +20,8 @@ fi
if [[ "$ARCH" == "x86_64" && "$UNAME" == "Linux" && "${GOARCH:-}" == "arm64" ]]; then
echo "cross-compiling linux-arm64"
export CC="clang --sysroot=/usr/aarch64-linux-gnu"
EXTRA_CFLAGS="--target=aarch64-linux-gnu $EXTRA_CFLAGS"
EXTRA_LDFLAGS="--target=aarch64-linux-gnu $EXTRA_LDFLAGS"
EXTRA_CFLAGS="--target=aarch64-linux-gnu -I/usr/local/cuda_arm64/include $EXTRA_CFLAGS"
EXTRA_LDFLAGS="--target=aarch64-linux-gnu -L/usr/local/cuda_arm64/lib64 $EXTRA_LDFLAGS"
EXTRA_FFMPEG_FLAGS="$EXTRA_FFMPEG_FLAGS --arch=aarch64 --enable-cross-compile --cc=clang --sysroot=/usr/aarch64-linux-gnu"
HOST_OS="--host=aarch64-linux-gnu"
IS_ARM64=1
Expand Down Expand Up @@ -141,19 +142,18 @@ DEV_FFMPEG_FLAGS="--disable-programs"

if [[ "$UNAME" == "Darwin" ]]; then
EXTRA_FFMPEG_LDFLAGS="$EXTRA_FFMPEG_LDFLAGS -framework CoreFoundation -framework Security"
else
# If we have clang, we can compile with CUDA support!
if which clang >/dev/null; then
echo "clang detected, building with GPU and Tensorflow support"
EXTRA_FFMPEG_FLAGS="$EXTRA_FFMPEG_FLAGS --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvenc --enable-decoder=h264_cuvid,hevc_cuvid,vp8_cuvid,vp9_cuvid --enable-filter=scale_cuda,signature_cuda,hwupload_cuda --enable-encoder=h264_nvenc,hevc_nvenc"
if [[ ! -e "${ROOT}/compiled/lib/libtensorflow_framework.so" ]]; then
LIBTENSORFLOW_VERSION=2.12.1 &&
curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz &&
tar -C ${ROOT}/compiled/ -xzf libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz &&
rm libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz
fi
EXTRA_FFMPEG_FLAGS="$EXTRA_FFMPEG_FLAGS --enable-libtensorflow"
elif [[ -e "/usr/local/cuda/lib64" ]]; then
echo "CUDA SDK detected, building with GPU support"
EXTRA_FFMPEG_FLAGS="$EXTRA_FFMPEG_FLAGS --enable-nonfree --enable-cuda-nvcc --enable-libnpp --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvenc --enable-decoder=h264_cuvid,hevc_cuvid,vp8_cuvid,vp9_cuvid --enable-filter=scale_npp,signature_cuda,hwupload_cuda --enable-encoder=h264_nvenc,hevc_nvenc"
if [[ ! -e "${ROOT}/compiled/lib/libtensorflow_framework.so" ]]; then
LIBTENSORFLOW_VERSION=2.12.1 &&
curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz &&
tar -C ${ROOT}/compiled/ -xzf libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz &&
rm libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz
fi
EXTRA_FFMPEG_FLAGS="$EXTRA_FFMPEG_FLAGS --enable-libtensorflow"
else
echo "No CUDA SDK detected, building without GPU support"
fi

if [[ $BUILD_TAGS == *"debug-video"* ]]; then
Expand Down Expand Up @@ -181,8 +181,8 @@ if [[ ! -e "$ROOT/ffmpeg/libavcodec/libavcodec.a" ]]; then
--enable-filter=aresample,asetnsamples,fps,scale,hwdownload,select,livepeer_dnn,signature \
--enable-encoder=aac,opus,libx264 \
--enable-decoder=aac,opus,h264 \
--extra-cflags="-I${ROOT}/compiled/include ${EXTRA_CFLAGS}" \
--extra-ldflags="-L${ROOT}/compiled/lib ${EXTRA_FFMPEG_LDFLAGS}" \
--extra-cflags="${EXTRA_CFLAGS} -I${ROOT}/compiled/include -I/usr/local/cuda/include" \
--extra-ldflags="${EXTRA_FFMPEG_LDFLAGS} -L${ROOT}/compiled/lib -L/usr/local/cuda/lib64" \
--prefix="$ROOT/compiled" \
$EXTRA_FFMPEG_FLAGS \
$DEV_FFMPEG_FLAGS
Expand Down

0 comments on commit ecc2839

Please sign in to comment.