From bbad58afdcdef2a8d0eed25b7cfa9b28d8bec792 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Thu, 15 Aug 2024 11:01:51 -0700 Subject: [PATCH 01/29] Add CI for linux cuda --- .github/workflows/test_linux_cuda.yaml | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/test_linux_cuda.yaml diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml new file mode 100644 index 000000000..543495784 --- /dev/null +++ b/.github/workflows/test_linux_cuda.yaml @@ -0,0 +1,40 @@ + +name: Unit-tests on Linux GPU + +on: + pull_request: + push: + branches: + - nightly + - main + - release/* + workflow_dispatch: + +jobs: + tests: + strategy: + matrix: + python_version: ["3.8", "3.9", "3.10"] + cuda_arch_version: ["11.8"] + fail-fast: false + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main + with: + runner: linux.g5.4xlarge.nvidia.gpu + repository: pytorch/torchcodec + gpu-arch-type: cuda + gpu-arch-version: ${{ matrix.cuda_arch_version }} + timeout: 120 + + script: | + nvidia-smi + ls -l + pwd + conda create --yes --name test + conda activate test + conda install --yes pip + pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 + conda install --yes ffmpeg + CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug + pip install pytest + pytest test + conda deactivate From 67d686298e00926a09beb6c5e9bb777745e74562 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Thu, 15 Aug 2024 13:37:30 -0700 Subject: [PATCH 02/29] . --- .github/workflows/test_linux_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 543495784..21b5416b0 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -31,7 +31,7 @@ jobs: pwd conda create --yes --name test conda activate test - conda install --yes pip + conda install --yes pip cmake pkg-config pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 conda install --yes ffmpeg CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug From d8f2d2ff3d1712ea104a436036c6a6e3d4b7d115 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Thu, 15 Aug 2024 14:15:02 -0700 Subject: [PATCH 03/29] . --- .github/workflows/test_linux_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 21b5416b0..aedbeb475 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -15,7 +15,7 @@ jobs: strategy: matrix: python_version: ["3.8", "3.9", "3.10"] - cuda_arch_version: ["11.8"] + cuda_arch_version: ["12.4"] fail-fast: false uses: pytorch/test-infra/.github/workflows/linux_job.yml@main with: From b436b9eda2c67cad95bf3683b872ecd1111afc47 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 09:07:46 -0700 Subject: [PATCH 04/29] . --- .github/workflows/test_linux_cuda.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index aedbeb475..957d4f246 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -34,6 +34,7 @@ jobs: conda install --yes pip cmake pkg-config pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 conda install --yes ffmpeg + conda install --yes nvidia::npp CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest pytest test From 8ed79390c8f9e20adba0cd2d8ff1cffd85db2aa1 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 09:56:33 -0700 Subject: [PATCH 05/29] . --- .github/workflows/test_linux_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 957d4f246..d6672813b 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -34,7 +34,7 @@ jobs: conda install --yes pip cmake pkg-config pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 conda install --yes ffmpeg - conda install --yes nvidia::npp + conda install --yes nvidia::libnpp CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest pytest test From 8abceb13eecb07f03d3c89e62a1c3303a336516f Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 10:15:35 -0700 Subject: [PATCH 06/29] . --- src/torchcodec/decoders/_core/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/torchcodec/decoders/_core/CMakeLists.txt b/src/torchcodec/decoders/_core/CMakeLists.txt index d8554bdaa..dbf170974 100644 --- a/src/torchcodec/decoders/_core/CMakeLists.txt +++ b/src/torchcodec/decoders/_core/CMakeLists.txt @@ -58,7 +58,9 @@ function(make_torchcodec_library library_name ffmpeg_target) set(NEEDED_LIBRARIES ${ffmpeg_target} ${TORCH_LIBRARIES} ${Python3_LIBRARIES}) if(ENABLE_CUDA) - list(APPEND NEEDED_LIBRARIES ${CUDA_CUDA_LIBRARY}) + find_library(NPPIF_LIBRARY nppif PATHS ${CUDA_PATH}/lib64) + + list(APPEND NEEDED_LIBRARIES ${CUDA_CUDA_LIBRARY} ${NPPIF_LIBRARY}) endif() if(ENABLE_NVTX) list(APPEND NEEDED_LIBRARIES nvtx3-cpp) From a3a8048ef4977bcf2a4dc783db97c507b5c19708 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 12:24:39 -0700 Subject: [PATCH 07/29] . --- src/torchcodec/decoders/_core/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/torchcodec/decoders/_core/CMakeLists.txt b/src/torchcodec/decoders/_core/CMakeLists.txt index dbf170974..ed8e8ef36 100644 --- a/src/torchcodec/decoders/_core/CMakeLists.txt +++ b/src/torchcodec/decoders/_core/CMakeLists.txt @@ -58,9 +58,7 @@ function(make_torchcodec_library library_name ffmpeg_target) set(NEEDED_LIBRARIES ${ffmpeg_target} ${TORCH_LIBRARIES} ${Python3_LIBRARIES}) if(ENABLE_CUDA) - find_library(NPPIF_LIBRARY nppif PATHS ${CUDA_PATH}/lib64) - - list(APPEND NEEDED_LIBRARIES ${CUDA_CUDA_LIBRARY} ${NPPIF_LIBRARY}) + list(APPEND NEEDED_LIBRARIES ${CUDA_CUDA_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_nppicc_LIBRARY} ) endif() if(ENABLE_NVTX) list(APPEND NEEDED_LIBRARIES nvtx3-cpp) From 5b629558e91fb57d3cf2aae1f50e55f68a407e0c Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 12:35:05 -0700 Subject: [PATCH 08/29] . --- .github/workflows/test_linux_cuda.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index d6672813b..aca764fa7 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -37,5 +37,7 @@ jobs: conda install --yes nvidia::libnpp CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest + ffmpeg -version + ffprobe -version pytest test conda deactivate From 532f43ec239c410d8f4e942f0f173ff2d2e83166 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 12:52:12 -0700 Subject: [PATCH 09/29] . --- .github/workflows/test_linux_cuda.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index aca764fa7..b21e2d4b9 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -33,8 +33,26 @@ jobs: conda activate test conda install --yes pip cmake pkg-config pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 - conda install --yes ffmpeg conda install --yes nvidia::libnpp + + # Build and install FFMPEG from source with CUDA enabled. + # The one on conda doesn't have CUDA enabled. + # Sub-step: install nvidia headers. Reference this link for details: + # https://docs.nvidia.com/video-technologies/video-codec-sdk/12.1/ffmpeg-with-nvidia-gpu/index.html + git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git + pushd nv-codec-headers + git checkout n11.0.10.1 + make PREFIX=$CONDA_PREFIX -j install + popd + + # Now build FFMPEG from source with CUDA enabled. + git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ + pushd ffmpeg + ./configure --prefix=$CONDA_PREFIX --enable-nonfree --enable-cuda-nvcc --enable-libnpp --disable-static --enable-shared --optflags=-fno-omit-frame-pointer --disable-stripping + make -j install + popd + + CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest ffmpeg -version From 753ee6efabb83805d75f395e69204aa7f561f970 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 13:03:33 -0700 Subject: [PATCH 10/29] . --- .github/workflows/test_linux_cuda.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index b21e2d4b9..ccb062449 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -31,7 +31,7 @@ jobs: pwd conda create --yes --name test conda activate test - conda install --yes pip cmake pkg-config + conda install --yes pip cmake pkg-config nasm pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 conda install --yes nvidia::libnpp @@ -52,7 +52,6 @@ jobs: make -j install popd - CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest ffmpeg -version From 2cf388f845d1d89944de8de2b68e122f248348c4 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 13:17:55 -0700 Subject: [PATCH 11/29] . --- .github/workflows/test_linux_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index ccb062449..583ca3e92 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -48,7 +48,7 @@ jobs: # Now build FFMPEG from source with CUDA enabled. git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ pushd ffmpeg - ./configure --prefix=$CONDA_PREFIX --enable-nonfree --enable-cuda-nvcc --enable-libnpp --disable-static --enable-shared --optflags=-fno-omit-frame-pointer --disable-stripping + ./configure --prefix=$CONDA_PREFIX --enable-nonfree --enable-cuda-nvcc --disable-static --enable-shared --optflags=-fno-omit-frame-pointer --disable-stripping make -j install popd From 9dff4e633fb6016cd29866fdcf0c78c75b282e84 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 13:48:17 -0700 Subject: [PATCH 12/29] . --- .github/workflows/test_linux_cuda.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 583ca3e92..aa2b9e795 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -54,6 +54,8 @@ jobs: CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest + ldd $(which ffmpeg) + ldd $(which ffprobe) ffmpeg -version ffprobe -version pytest test From 4ad8a6f65150ef17743be2d887fb609847a09865 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 13:52:46 -0700 Subject: [PATCH 13/29] . --- .github/workflows/test_linux_cuda.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index aa2b9e795..01d67c237 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -56,6 +56,7 @@ jobs: pip install pytest ldd $(which ffmpeg) ldd $(which ffprobe) + ffmpeg -version ffprobe -version pytest test From e6e07373491e5ca2e32e1695ef089bde5ce84b62 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Mon, 19 Aug 2024 15:49:33 -0700 Subject: [PATCH 14/29] . --- .github/workflows/test_linux_cuda.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 01d67c237..f3cecfd6d 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -56,6 +56,9 @@ jobs: pip install pytest ldd $(which ffmpeg) ldd $(which ffprobe) + find $CONDA_PREFIX -name libavutil.so.59 + find $CONDA_PREFIX -name libavutil.so\* + find $CONDA_PREFIX -name \*libavutil.so\* ffmpeg -version ffprobe -version From ab78c490027fdf29eb4398aa81726e67599ffc4e Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 05:10:44 -0700 Subject: [PATCH 15/29] . --- .github/workflows/test_linux_cuda.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index f3cecfd6d..f98555f76 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -34,6 +34,7 @@ jobs: conda install --yes pip cmake pkg-config nasm pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 conda install --yes nvidia::libnpp + conda install --yes conda-forge::compilers # Build and install FFMPEG from source with CUDA enabled. # The one on conda doesn't have CUDA enabled. From 1396b97e2bb28bf33bb724c4644704aeac45474e Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 05:26:09 -0700 Subject: [PATCH 16/29] . --- .github/workflows/test_linux_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index f98555f76..27bd375cb 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -32,9 +32,9 @@ jobs: conda create --yes --name test conda activate test conda install --yes pip cmake pkg-config nasm + conda install --yes conda-forge::compilers pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 conda install --yes nvidia::libnpp - conda install --yes conda-forge::compilers # Build and install FFMPEG from source with CUDA enabled. # The one on conda doesn't have CUDA enabled. From a5547f9e3f9a5c2760ff46bcbb24cb1c03117a70 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 05:40:58 -0700 Subject: [PATCH 17/29] . --- .github/workflows/test_linux_cuda.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 27bd375cb..9c0c98122 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -32,7 +32,10 @@ jobs: conda create --yes --name test conda activate test conda install --yes pip cmake pkg-config nasm - conda install --yes conda-forge::compilers + + # This fails because conda reactivate fails inside this env + # conda install --yes conda-forge::compilers + pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 conda install --yes nvidia::libnpp @@ -53,7 +56,7 @@ jobs: make -j install popd - CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug + CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,-rpath,$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest ldd $(which ffmpeg) ldd $(which ffprobe) From 60c11b8018f2705beadb44a9316c301d094be7d6 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 05:55:32 -0700 Subject: [PATCH 18/29] . --- .github/workflows/test_linux_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 9c0c98122..25be4c7ba 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -56,7 +56,7 @@ jobs: make -j install popd - CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,-rpath,$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug + CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,--allow-shlib-undefined -Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest ldd $(which ffmpeg) ldd $(which ffprobe) From 353568ae9c15d36d54cca4ea9a06015550c3ef4c Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 06:52:33 -0700 Subject: [PATCH 19/29] . --- .github/workflows/test_linux_cuda.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 25be4c7ba..b5af0b4e4 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -64,7 +64,7 @@ jobs: find $CONDA_PREFIX -name libavutil.so\* find $CONDA_PREFIX -name \*libavutil.so\* - ffmpeg -version - ffprobe -version + # ffmpeg -version + # ffprobe -version pytest test conda deactivate From 7047622ef7b2dae70ce667cfd91d0562638e2cb5 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 07:45:09 -0700 Subject: [PATCH 20/29] . --- .github/workflows/test_linux_cuda.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index b5af0b4e4..b9b1ebbac 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -52,7 +52,8 @@ jobs: # Now build FFMPEG from source with CUDA enabled. git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ pushd ffmpeg - ./configure --prefix=$CONDA_PREFIX --enable-nonfree --enable-cuda-nvcc --disable-static --enable-shared --optflags=-fno-omit-frame-pointer --disable-stripping + git checkout origin/release/6.1 + ./configure --prefix=$CONDA_PREFIX --enable-nonfree --enable-cuda-nvcc --disable-static --enable-shared --optflags=-fno-omit-frame-pointer --disable-stripping --enable-cuvid make -j install popd From 71e78921613d9ad55fb8c8f48f236c24e70ce23d Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 08:15:02 -0700 Subject: [PATCH 21/29] . --- .github/workflows/test_linux_cuda.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index b9b1ebbac..4df52ed85 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -43,7 +43,8 @@ jobs: # The one on conda doesn't have CUDA enabled. # Sub-step: install nvidia headers. Reference this link for details: # https://docs.nvidia.com/video-technologies/video-codec-sdk/12.1/ffmpeg-with-nvidia-gpu/index.html - git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git + git clone https://github.com/FFmpeg/nv-codec-headers.git + pushd nv-codec-headers git checkout n11.0.10.1 make PREFIX=$CONDA_PREFIX -j install @@ -53,6 +54,8 @@ jobs: git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ pushd ffmpeg git checkout origin/release/6.1 + which pkg-config + pkg-config --list-all ./configure --prefix=$CONDA_PREFIX --enable-nonfree --enable-cuda-nvcc --disable-static --enable-shared --optflags=-fno-omit-frame-pointer --disable-stripping --enable-cuvid make -j install popd From 58b30f4cf8f1c467bbf3742ba0a4cd62c04504d7 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 08:18:14 -0700 Subject: [PATCH 22/29] . --- .github/workflows/test_linux_cuda.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 4df52ed85..4e439b654 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -43,10 +43,9 @@ jobs: # The one on conda doesn't have CUDA enabled. # Sub-step: install nvidia headers. Reference this link for details: # https://docs.nvidia.com/video-technologies/video-codec-sdk/12.1/ffmpeg-with-nvidia-gpu/index.html - git clone https://github.com/FFmpeg/nv-codec-headers.git + git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git pushd nv-codec-headers - git checkout n11.0.10.1 make PREFIX=$CONDA_PREFIX -j install popd From e4feaa6a1af7453d66409539196de9d8d5886fd8 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 08:26:44 -0700 Subject: [PATCH 23/29] . --- .github/workflows/test_linux_cuda.yaml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 4e439b654..07377d20f 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -61,13 +61,8 @@ jobs: CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,--allow-shlib-undefined -Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug pip install pytest - ldd $(which ffmpeg) - ldd $(which ffprobe) - find $CONDA_PREFIX -name libavutil.so.59 - find $CONDA_PREFIX -name libavutil.so\* - find $CONDA_PREFIX -name \*libavutil.so\* - # ffmpeg -version - # ffprobe -version - pytest test + # We skip certain tests because they are not relevant to GPU decoding and they always fail with + # a custom FFMPEG build. + pytest -k "not (test_get_metadata or get_ffmpeg_version)" conda deactivate From eddb128165561204a440b8423cdf181e94504ea7 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 09:07:38 -0700 Subject: [PATCH 24/29] . --- .github/workflows/test_linux_cuda.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 07377d20f..6c5632543 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -14,7 +14,8 @@ jobs: tests: strategy: matrix: - python_version: ["3.8", "3.9", "3.10"] + python_version: ["3.9", "3.10"] + # TODO: Add more cuda versions. cuda_arch_version: ["12.4"] fail-fast: false uses: pytorch/test-infra/.github/workflows/linux_job.yml@main @@ -33,9 +34,6 @@ jobs: conda activate test conda install --yes pip cmake pkg-config nasm - # This fails because conda reactivate fails inside this env - # conda install --yes conda-forge::compilers - pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 conda install --yes nvidia::libnpp @@ -65,4 +63,5 @@ jobs: # We skip certain tests because they are not relevant to GPU decoding and they always fail with # a custom FFMPEG build. pytest -k "not (test_get_metadata or get_ffmpeg_version)" + python benchmarks/decoders/gpu_benchmark.py conda deactivate From 567baac36510bbf24bc8384eb66f3696785cb7eb Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 09:10:06 -0700 Subject: [PATCH 25/29] . --- .github/workflows/test_linux_cuda.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 6c5632543..2419ff901 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -32,10 +32,10 @@ jobs: pwd conda create --yes --name test conda activate test - conda install --yes pip cmake pkg-config nasm + conda install --quiet --yes pip cmake pkg-config nasm - pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124 - conda install --yes nvidia::libnpp + pip install --quiet --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cu124 + conda install --quiet --yes nvidia::libnpp # Build and install FFMPEG from source with CUDA enabled. # The one on conda doesn't have CUDA enabled. @@ -54,7 +54,7 @@ jobs: which pkg-config pkg-config --list-all ./configure --prefix=$CONDA_PREFIX --enable-nonfree --enable-cuda-nvcc --disable-static --enable-shared --optflags=-fno-omit-frame-pointer --disable-stripping --enable-cuvid - make -j install + make --quiet -j install popd CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,--allow-shlib-undefined -Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug From 61717a68edf6bb166b6c9cf12cff8bf8b70e8b4c Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 09:13:53 -0700 Subject: [PATCH 26/29] . --- .github/workflows/test_linux_cuda.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 2419ff901..4585d0cef 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -57,8 +57,7 @@ jobs: make --quiet -j install popd - CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,--allow-shlib-undefined -Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e . --no-build-isolation -vv --debug - pip install pytest + CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,--allow-shlib-undefined -Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e ".[dev]"" --no-build-isolation -vv --debug # We skip certain tests because they are not relevant to GPU decoding and they always fail with # a custom FFMPEG build. From a1882e028345fe1e373f94388a33327b3a601a4a Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 09:27:16 -0700 Subject: [PATCH 27/29] . --- .github/workflows/test_linux_cuda.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 4585d0cef..32aae5bf0 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -41,23 +41,23 @@ jobs: # The one on conda doesn't have CUDA enabled. # Sub-step: install nvidia headers. Reference this link for details: # https://docs.nvidia.com/video-technologies/video-codec-sdk/12.1/ffmpeg-with-nvidia-gpu/index.html - git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git + git clone --quiet https://git.videolan.org/git/ffmpeg/nv-codec-headers.git pushd nv-codec-headers - make PREFIX=$CONDA_PREFIX -j install + make --silent PREFIX=$CONDA_PREFIX -j install popd # Now build FFMPEG from source with CUDA enabled. - git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ + git clone --quiet https://git.ffmpeg.org/ffmpeg.git ffmpeg/ pushd ffmpeg git checkout origin/release/6.1 which pkg-config pkg-config --list-all ./configure --prefix=$CONDA_PREFIX --enable-nonfree --enable-cuda-nvcc --disable-static --enable-shared --optflags=-fno-omit-frame-pointer --disable-stripping --enable-cuvid - make --quiet -j install + make --silent -j install popd - CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,--allow-shlib-undefined -Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e ".[dev]"" --no-build-isolation -vv --debug + CMAKE_BUILD_PARALLEL_LEVEL=8 CXXFLAGS="" LDFLAGS="-Wl,--allow-shlib-undefined -Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib" CMAKE_BUILD_TYPE=Release ENABLE_CUDA=1 ENABLE_NVTX=1 pip install -e ".[dev]" --no-build-isolation -vv --debug # We skip certain tests because they are not relevant to GPU decoding and they always fail with # a custom FFMPEG build. From 9416931d06f9805b86f7f0bdcc07f1a34f0f1f04 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 09:29:02 -0700 Subject: [PATCH 28/29] . --- .github/workflows/test_linux_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 32aae5bf0..988b0aba5 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -14,7 +14,7 @@ jobs: tests: strategy: matrix: - python_version: ["3.9", "3.10"] + python_version: ["3.9"] # TODO: Add more cuda versions. cuda_arch_version: ["12.4"] fail-fast: false From 7e02734f01384ceb274824a593e3c9d753a122b5 Mon Sep 17 00:00:00 2001 From: Ahmad Sharif Date: Tue, 20 Aug 2024 09:36:10 -0700 Subject: [PATCH 29/29] . --- .github/workflows/test_linux_cuda.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_linux_cuda.yaml b/.github/workflows/test_linux_cuda.yaml index 988b0aba5..527448bec 100644 --- a/.github/workflows/test_linux_cuda.yaml +++ b/.github/workflows/test_linux_cuda.yaml @@ -28,8 +28,6 @@ jobs: script: | nvidia-smi - ls -l - pwd conda create --yes --name test conda activate test conda install --quiet --yes pip cmake pkg-config nasm