-
Notifications
You must be signed in to change notification settings - Fork 748
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
CUDA feature extraction #1080
CUDA feature extraction #1080
Conversation
Co-authored-by: Roman Arzumanyan <rarzumanyan@nvidia.com> Co-authored-by: Sven Middelberg <smiddelberg@nvidia.com> Co-authored-by: Cem Moluluo <cmoluluo@nvidia.com> Co-authored-by: Maximilian Mueller <maximilianm@nvidia.com> Co-authored-by: Kyle Swanson <kswanson@netflix.com> Co-authored-by: Markus Tavenrath <matavenrath@nvidia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a lot of code, congrats
@kylophone @gedoensmax @1480c1:
How to repro: git clone https://github.com/Netflix/vmaf.git
git checkout cuda_feature_extraction
python3 -m pip install virtualenv
python3 -m virtualenv .venv
source .venv/bin/activate
pip install meson
sudo apt install nasm ninja-build doxygen xxd
cd libvmaf
mkdir -p build
export PATH=/usr/local/cuda/bin:$PATH
meson -Denable_cuda=true build --buildtype release --prefix $(pwd)/build
ninja -vC build
# FAILS HERE #
ninja -vC build install Error message: Installing src/libvmaf.so.1.1.3 to /home/roman/Git/vmaf/libvmaf/build/lib/x86_64-linux-gnu
Installing src/libvmaf.a to /home/roman/Git/vmaf/libvmaf/build/lib/x86_64-linux-gnu
Installing tools/vmaf to /home/roman/Git/vmaf/libvmaf/build/bin
Installing /home/roman/Git/vmaf/libvmaf/include/libvmaf/libvmaf.h to /home/roman/Git/vmaf/libvmaf/build/include/libvmaf/
Installing /home/roman/Git/vmaf/libvmaf/include/libvmaf/compute_vmaf.h to /home/roman/Git/vmaf/libvmaf/build/include/libvmaf/
Installing /home/roman/Git/vmaf/libvmaf/include/libvmaf/feature.h to /home/roman/Git/vmaf/libvmaf/build/include/libvmaf/
Installing /home/roman/Git/vmaf/libvmaf/include/libvmaf/model.h to /home/roman/Git/vmaf/libvmaf/build/include/libvmaf/
Installing /home/roman/Git/vmaf/libvmaf/include/libvmaf/picture.h to /home/roman/Git/vmaf/libvmaf/build/include/libvmaf/
Installing /home/roman/Git/vmaf/libvmaf/build/include/libvmaf/version.h to /home/roman/Git/vmaf/libvmaf/build/include/libvmaf
Traceback (most recent call last):
File "/home/roman/Git/vmaf/libvmaf/.venv/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 153, in run
return options.run_func(options)
File "/home/roman/Git/vmaf/libvmaf/.venv/lib/python3.8/site-packages/mesonbuild/minstall.py", line 766, in run
installer.do_install(datafilename)
File "/home/roman/Git/vmaf/libvmaf/.venv/lib/python3.8/site-packages/mesonbuild/minstall.py", line 546, in do_install
self.install_headers(d, dm, destdir, fullprefix)
File "/home/roman/Git/vmaf/libvmaf/.venv/lib/python3.8/site-packages/mesonbuild/minstall.py", line 639, in install_headers
if self.do_copyfile(fullfilename, outfilename, makedirs=(dm, outdir)):
File "/home/roman/Git/vmaf/libvmaf/.venv/lib/python3.8/site-packages/mesonbuild/minstall.py", line 424, in do_copyfile
self.copy2(from_file, to_file)
File "/home/roman/Git/vmaf/libvmaf/.venv/lib/python3.8/site-packages/mesonbuild/minstall.py", line 324, in copy2
shutil.copy2(*args, **kwargs)
File "/usr/lib/python3.8/shutil.py", line 435, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.8/shutil.py", line 264, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/roman/Git/vmaf/libvmaf/build/include/libvmaf/version.h'
ERROR: Unhandled python exception
No such file or directory - (2, 'No such file or directory')
this is probably not a Meson bug.
FAILED: meson-internal__install
/home/roman/Git/vmaf/libvmaf/.venv/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed. However there's a |
So it looks like it is building just fine, but you are not able to install. Your install prefix is the same as your build directory, which to me seems like it would be a problem. If you want a local install, try |
Thanks a lot, that indeed solved the issue. Now I'm facing another: The point is that |
Some of these issues are fixed by PR #1086. I did not look into the issue with meson install target. |
Ope, I didn't see this PR in time, so I addressed header name and installation with 8ab1119 fyi @rarzumanyan, you should be unblocked now |
@kylophone It's defined in meson file and passed as additional symbol to compiler: Lines 164 to 167 in 8ab1119
But it's not put into any of header files, hence when including libvmaf headers in 3rd party application compiler evaluates it as 0: In file included from /path/to/my/project/calc_vmaf.c:128:
/home/roman/Git/vmaf/libvmaf/install/include/libvmaf/vmaf_cuda.h:24:5: warning: "HAVE_CUDA" is not defined, evaluates to 0 [-Wundef]
24 | #if HAVE_CUDA
| ^~~~~~~~~ Could you please make this macro definition available to 3rd-party applications? I see 2 approaches to this:
BTW there's a hard-coded macro redefinition in these files:
vmaf/libvmaf/test/test_ring_buffer.c Line 19 in 8ab1119
|
I think I will just remove the |
IMO that may echo in licensing implications to 3rd party applications compiled against libvmaf headers. In meson we only add source files so one would have to be very careful not to include CUDA by accident via headers. Since CUDA SDK is proprietary I think it's better to keep it surrounded by macro guard. I lean towards keeping the |
I believe we avoid that problem at build time already. Setting |
@kylophone what else will be needed to merge this into master ? We would love to finish this up. |
I'll send you a mail. |
Hello. after "ninja -vC build" error has occurred.
This is my full log.
Can I get help? |
@bluedot-io To me this looks a lot like a bug in nvcc. Could you try upgrading to a more recent version? Another option is to just comment the |
@gedoensmax |
I can recommend 11.6. Just use
|
@gedoensmax ======== CPU Run
<2K>
========= GPU Run
<2K>
I tested it on aws g4dn.2xlarge. |
@bluedot-io It is likely that speedup will be even more impressive when using ffmpeg in the hopefully close future. The way the vmaf tool is implemented we noticed that file I/O can not keep up with a fast GPU. E.g. on my RTX6000 a profiling looks like this: |
@gedoensmax File I/O is pipelined in ffmpeg, so faster fps results are expected. I expect vmaf on GPU to come soon in ffmpeg!! |
@gedoensmax @kylophone is there any update on your ffmpeg vmaf work ? |
It's been 15 days since their last commit - give them time to work on it. People may have a lot more going on in their lives, especially with the holidays, that would take their attention away. Just subscribe to this PR and you'll see when an update comes up. |
@HunterAP23 hey im not rushing them dont get me wrong :) |
Replaced by #1152. |
Initial import for CUDA feature extraction on GPU. There have been three new feature extractors implemented:
Speed-up will depend on hardware, but in general the results show huge improvement.
# 1920x1080, Tesla T4 VMAF version 9474f69c 500 frames ⠀⢐ 324.41 FPS
libcuda
is required to build, usemeson -Denable_cuda=true
to enable.