Log in

View Full Version : Parallelization of GPUs


Cary Knoop
22nd September 2018, 17:48
What is the best practice to 'rotate' GPUs for filters that use the GPU?

I changed some py scrips adding a GPU parameter on invocation, but how to segment frames to distribute the work?

SelectEvery() is a way to segment them but the downside is that this won't work for filters that use neighboring frames.

Selecting frames based on the modulus of the frame number would avoid that. Using something similar to FrameEval would accomplish this if input parameters to filters could be passed on.

Alternatively, VS could perhaps expose a GPU_ID by thread.

What are the possible solutions?

Cary Knoop
4th October 2018, 16:18
If Vapoursynth would expose a (pesudo) thread processing variable one could assign GPUs based on some modulo function.

i.e.

clip = myGPUfunc(clip, ........., device_id= core.current_thread % max_gpu)

amichaelt
4th October 2018, 17:10
Why would it need to be added to Vapoursynth? Can't you just use something like the Python multiprocessing library (https://docs.python.org/3/library/multiprocessing.html) to do what you want? Unlike Avisynth, you're not hamstrung by only what Vapoursynth core exposes. You have a full programming language at your disposal.