Skip to content
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

Multi-gpu support? #26

Open
Bouby308 opened this issue Jun 8, 2022 · 0 comments
Open

Multi-gpu support? #26

Bouby308 opened this issue Jun 8, 2022 · 0 comments

Comments

@Bouby308
Copy link

Bouby308 commented Jun 8, 2022

I tried to utilize 4 gpus for inference with the following code but it didn't work. Only one of the gpu was doing the job at a time and the others were idling. Are there any suggested ways for multi-gpu inference?

import vapoursynth as vs
import os
from vsbasicvsrpp import BasicVSRPP
core = vs.core

folder = r'C:\Users\test\Desktop\vs-58'
file = r'test.m4v'

src = os.path.join(folder, file)

src = core.ffms2.Source(src)

src = core.fmtc.resample (clip=src, css="444")
src = core.fmtc.matrix (clip=src, mat="709", col_fam=vs.RGB)
src = core.fmtc.bitdepth (clip=src, bits=32)

interval = 180
n = 4

add = (interval*n) - len(src) % (interval*n)
if add>0:
	src = src + core.std.BlankClip(src, length=add)

c1 = core.std.SelectEvery(clip=src, cycle=interval*n,  offsets=[i for i in range(interval*0, interval)])
c1 = BasicVSRPP(c1, model=5, interval=interval, device_index=0, fp16=True)

c2 = core.std.SelectEvery(clip=src, cycle=interval*n,  offsets=[i for i in range(interval*1, interval*2)])
c2 = BasicVSRPP(c2, model=5, interval=interval, device_index=1, fp16=True)

c3 = core.std.SelectEvery(clip=src, cycle=interval*n,  offsets=[i for i in range(interval*2, interval*3)])
c3 = BasicVSRPP(c3, model=5, interval=interval, device_index=2, fp16=True)

c4 = core.std.SelectEvery(clip=src, cycle=interval*n,  offsets=[i for i in range(interval*3, interval*4)])
c4 = BasicVSRPP(c4, model=5, interval=interval, device_index=3, fp16=True)


c = core.std.Interleave(clips=[c1, c2, c3, c4])

a = [i for i in range(interval*n) if i % n ==0] + [i for i in range(interval*n) if i % n ==1] + [i for i in range(interval*n) if i % n ==2] + [i for i in range(interval*n) if i % n ==3]

c = core.std.SelectEvery(clip=c, cycle=interval*n, offsets=a)

c = core.fmtc.matrix (clip=c, mat="709", col_fam=vs.YUV)
c = core.fmtc.resample (clip=c, css="420")
c = core.fmtc.bitdepth(clip =c, bits=16)   

if add>0:
	c = c[:-add]

c.set_output()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant