-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: CUDA feature extraction for Windows #1154
Comments
I can tell you from NV side we did not test under windows and did not really targeted it. Have you considered using WSL with CUDA support ? https://docs.nvidia.com/cuda/wsl-user-guide/index.html |
I should've mentioned that I've also tried WSL2 with the correct WSL2 Ubuntu CUDA toolkit installation. These are the steps I've followed until I encounter an error: git clone https://github.com/Netflix/vmaf
cd vmaf/libvmaf
# instructions from the libvmaf README
python3 -m pip install virtualenv
python3 -m virtualenv .venv
source .venv/bin/activate
pip install meson
sudo apt install nasm ninja-build doxygen xxd
# Install the CUDA toolkit, including NVCC
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt install cuda nvidia-cuda-toolkit nvcc
# Edited the libvmaf/meson_options.txt file to have "enable_cuda" set to "true"
# Go through with build instructions as per libvmaf README
meson build --buildtype release
ninja -vC build After that last step, I get an error saying: FAILED: src/libcuda_common_vmaf_lib.a.p/cuda_integer_adm_adm_cm.cu.o
nvcc -Isrc/libcuda_common_vmaf_lib.a.p -Xcompiler=-Wall,-Winvalid-pch,-Wextra -O3 -Xcompiler=-fPIC -Isrc -I/usr/local/cuda/include -I/usr/local/cuda/include -I../src/cuda -I../src/feature -I../src/cuda -I../src/feature/common -I../src -Isrc -I../src/feature/common -I../src/feature -I../src -Isrc -I../include -Iinclude -I../src -Isrc -lineinfo -I../src -Isrc -Isrc/libcuda_common_vmaf_lib.a.p -o src/libcuda_common_vmaf_lib.a.p/cuda_integer_adm_adm_cm.cu.o -c ../src/cuda/integer_adm/adm_cm.cu
../src/cuda/integer_adm/adm_cm.cu(52): warning #68-D: integer conversion resulted in a change of sign
../src/cuda/integer_adm/adm_cm.cu(196): warning #186-D: pointless comparison of unsigned integer with zero
../src/cuda/integer_adm/adm_cm.cu(52): warning #68-D: integer conversion resulted in a change of sign
../src/cuda/integer_adm/adm_cm.cu(196): warning #186-D: pointless comparison of unsigned integer with zero
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
435 | function(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:435:145: note: ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
530 | operator=(_Functor&& __f) Trying to find any other error messages but this is the only one I could find |
For me compilation with WSL worked apart from a library issue that was solved by creating a symlink as explained here - haven't had that before with WSL not sure what is going on there. |
So I added I then uninstalled The build worked! But afterwards when I went to run ninja: Entering directory `build'
[1/16] /usr/bin/meson --internal vcstagger ../include/vcs_version.h.in include/vcs_version.h 2.3.1 /mnt/d/Documents/Code_Projects/vmaf/libvmaf/include @VCS_TAG@ '(.*)' /usr/bin/git --git-dir /mnt/d/Documents/Code_Projects/vmaf/libvmaf/../.git describe --tags --long --match '?.*.*' --always
[1/2] /usr/bin/meson test --no-rebuild --print-errorlogs
1/16 test_vmaf_cuda_gpumask FAIL 0.10s exit status 2
>>> MALLOC_PERTURB_=231 /mnt/d/Documents/Code_Projects/vmaf/libvmaf/tools/test/test_vmaf_cuda_gpumask.sh
stderr:
/bin/sh: 0: Illegal option -
... # skipping over passed tests
Summary of Failures:
1/16 test_vmaf_cuda_gpumask FAIL 0.10s exit status 2 That just seems to be an issue with the test file #!/bin/sh -x
set -e
# no gpumask: use cuda
./tools/vmaf \
--reference /dev/zero \
--distorted /dev/zero \
--width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \
--frame_cnt 2 \
--gpumask 0
# gpumask: use cpu
./tools/vmaf \
--reference /dev/zero \
--distorted /dev/zero \
--width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \
--frame_cnt 2 \
--gpumask -1
# no gpumask: use cuda for vmaf features, cpu for psnr
./tools/vmaf \
--reference /dev/zero \
--distorted /dev/zero \
--width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \
--frame_cnt 2 \
--gpumask 0 \
--feature psnr \
--output /dev/stdout
# gpumask: use cpu for vmaf features and psnr
./tools/vmaf \
--reference /dev/zero \
--distorted /dev/zero \
--width 1920 --height 1080 --pixel_format 420 --bitdepth 8 \
--frame_cnt 2 \
--gpumask -1 \
--feature psnr
Although I'm not sure if the error is from Regardless of the test script, the actual commands used for testing do work properly, and they do work with some test video files I have (getting >200fps on some y4m files) but now I'm not sure how to make this build for Windows, as the built |
steps I've tried so far
Run-time dependency CUDA (modules: cudart) found: YES 12.0 (C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0)
libvmaf/src/meson.build:166: WARNING: add_languages is missing native:, assuming languages are wanted for both host and build.
Compiler for language cuda for the build machine not found.
libvmaf/src/meson.build:166:4: ERROR: Compiler nvcc can not compile programs.
...
Sanity testing Cuda compiler: nvcc
Is cross compiler: False.
Sanity check compiler command line: nvcc -w -cudart static C:/Users/cddeg/vmaf/bui/meson-private/sanitycheckcuda.cu -o C:/Users/cddeg/vmaf/bui/meson-private/sanitycheckcuda.exe
Sanity check compile stdout:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\vcruntime.h(197): error: invalid redeclaration of type name "size_t"
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\vcruntime_new.h(48): error: first parameter of allocation function must be of type "size_t"
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include\vcruntime_new.h(53): error: first parameter of allocation function must be of type "size_t"
... and give up after finding out that cuda sdk's nvcc doesn't understand gcc/g++ on Windows at all. I already tried seeing if I could get meson to use clang as the cuda compiler (since ffmpeg was able to), but couldn't find out how. |
I've been thinking about this, it may make sense to eventually migrate to using nv-codec-headers. This gives us runtime dynamic linking, and should also simplify multi-platform building. This is what is used by FFmpeg. |
I second the notion of migrating to the nv-codec-headers. And speaking of FFmpeg, I'm reminded of this other project called media-autobuild_suite that allows Windows users to cross compile FFmpeg in a MINGW64 MYSYS2 environment, and the interesting part is that they are able to do so with CUDA support. I'll investigate into their build scripts and see if it's possible to translate what they do to get CUDA working into VMAF directly. |
That would be great, thank you. |
So it seems that the media-autobuild_suite project gets CUDA and NVCC working like so:
|
It's been quite a while since I provided an update. The issue comes down to getting CUDA to register correctly (at least on Ubuntu-WSL). These are the steps I've been following:
Next I do some hacky edits to the
Essentially I'm telling the script to:
Then just run the modified cross compiler script: The script typically fails with VMAF due to
This works, but trying the compiler script again or just using the regular command of This was with CUDA 11.8 so it could be that this version is either too new or too old to work with VMAF, I'll try with other CUDA versions and report back. |
have you ever solved the issues and finish built vmaf-cuda windows version? |
@HunterAP23 Any luck? I just started this journey and any help would be appreciated. I am about to just dual boot Ubuntu because I have been banging my head against this off and on now for a few weeks. |
你好!邮件已收到,我会尽快回复你--许思焱
|
Referencing #1152 which added the ability to use Nvidia CUDA acceleration for calculating VMAF and related scores, the existing pipeline does not seem possible to be able to compile a version of libvmaf with CUDA enabled for Windows.
Based on the Windows build pipeline used here, it uses MING64 with MYSYS2, which does not have a way to install the necessary CUDA dependencies (MYSYS2 uses the
pacman
package manager tool, which Nvidia does not have official instructions on installing CUDA for, and the MYSYS2 package repositories do not include CUDA).Would it also be possible to include builds with CUDA enabled in the existing pipelines? I don't believe there should be any issues in terms of licensing, but someone more knowledgeable than me on that topic can confirm if this is correct.
The text was updated successfully, but these errors were encountered: