QualityScaler icon indicating copy to clipboard operation
QualityScaler copied to clipboard

not using gpu

Open xxopenxx opened this issue 1 year ago • 29 comments

Hi, it's using 100% of my cpu and 0% of gpu all the time, memory is 0.0gb too

xxopenxx avatar May 15 '24 19:05 xxopenxx

What version of python ate you using? This issue can occur when using an outdated python version. I know that Python 3.11.4 works for certain. 3.10 does not work.

SandwichIsGreat avatar May 15 '24 19:05 SandwichIsGreat

i have python 3.11.4

xxopenxx avatar May 15 '24 22:05 xxopenxx

Hi @xxopenxx.

Are you on Windows 10 or Windows 11? because onnxruntime-directml (the AI engine) is only compatible with this OS.

Otherwhise it will use the CPU

Djdefrag avatar May 16 '24 09:05 Djdefrag

Hi @xxopenxx.

Are you on Windows 10 or Windows 11? because onnxruntime-directml (the AI engine) is only compatible with this OS.

Otherwhise it will use the CPU

WINDOWS 10

xxopenxx avatar May 16 '24 18:05 xxopenxx

Python 3.10.14, I never had problem with any ai open source apps, like stable diffusion, ollama etc

xxopenxx avatar May 16 '24 18:05 xxopenxx

@xxopenxx can you send your PC specs? (Task manager / performance tab)

Djdefrag avatar May 17 '24 04:05 Djdefrag

i5 12400f, rtx 4070 12gb vram, 16gb ram

xxopenxx avatar May 17 '24 13:05 xxopenxx

Have you installed Visual C Redistributable and DXRuntime?

  1. (If not already installed) install Visual-C-Runtimes:

    • https://www.techpowerup.com/download/visual-c-redistributable-runtime-package-all-in-one/
  2. (If not already installed) install Directx:

    • https://www.microsoft.com/it-it/download/details.aspx?id=35

typically should already be installed

Djdefrag avatar May 17 '24 13:05 Djdefrag

These 2 things already installed

xxopenxx avatar May 17 '24 18:05 xxopenxx

Strange, are you sure it is not using your gpu? the temperature is "normal" while upscaling?

Also, if you are on Python, you should see an error that says "onnxruntime will use CPU" in the terminal

Djdefrag avatar May 17 '24 19:05 Djdefrag

i dont have that error, there are no errors at all in terminal of quality scaler

xxopenxx avatar May 17 '24 19:05 xxopenxx

Are you selecting "High performance" GPU in the options right? and if you select Power saving?

Djdefrag avatar May 17 '24 19:05 Djdefrag

Python 3.10.14, I never had problem with any ai open source apps, like stable diffusion, ollama etc

wait.... do you have python 3.10.14 or 3.11.4? Because this looks an awfully lot like this issue https://github.com/Djdefrag/QualityScaler/issues/69

SandwichIsGreat avatar May 18 '24 00:05 SandwichIsGreat

image

xxopenxx avatar May 18 '24 15:05 xxopenxx

image

xxopenxx avatar May 18 '24 15:05 xxopenxx

Hi my friend, maibe you do not see the correct "graph". In fact, you are seeing only "Video encode" e "Video decode", but there are more options. To see if the gpu is being used, you have to switch to "3D" graph.

Also, you can use VsCode to run QualityScaler.py and you should see all logs

Djdefrag avatar May 18 '24 15:05 Djdefrag

But while im using stable diffusion and im upscaling photo for example, I have 99% gpu usage in task manager, it's same for ollama and video diffusion. Upscaling using qualityscaler takes 2h to upscale 2minutes video from 360 p to 760p, using multihreading

xxopenxx avatar May 18 '24 15:05 xxopenxx

sorry but, just a stupid question, have you installed the correct dependencies in requirements.txt?

Djdefrag avatar May 18 '24 15:05 Djdefrag

image

xxopenxx avatar May 18 '24 15:05 xxopenxx

i can share screen on discord or something like that if you want

xxopenxx avatar May 18 '24 15:05 xxopenxx

can you unistall everything and re-install? i think there is some problem somewere because the latest version of onnxruntime-directml is 1.17.3, but you have 1.17.0

  • pip freeze > requirements.txt
  • pip uninstall -r requirements.txt -y
  • pip cache purge

Djdefrag avatar May 18 '24 15:05 Djdefrag

@Djdefrag Can I run it if I don't have GPU ? If so how long would it take to process lets say a 5 min video on a 8GM RAM (I5 3rd gen) machine ?

lindathomass avatar Jun 06 '24 10:06 lindathomass

Hi my friend,

yes, it will run without GPU, but will be really slow.

Maibe you can try using the lightest AI model, RealSR_Gx4

Djdefrag avatar Jun 07 '24 07:06 Djdefrag

Hello - I have the same issue. From both steam app and version 3.6 from github. The symptom is that CPU is peak and no GPU usage (no memory allocation, CUDA is low % (e.g. 0-5% same as GPU).

I found this on stack and tried the script. https://stackoverflow.com/questions/64452013/how-do-you-run-a-onnx-model-on-a-gpu

Mine say, "CPU-DML". Is that correct?

I also check python package and it is using

onnxconverter-common==1.14.0     
onnxruntime-directml==1.18.0     

pmth avatar Jun 18 '24 23:06 pmth

ok - some update. installed onnxruntime-gpu and onnxruntime (cpu) and tried to use it. It turned out that estimates say 19hrs+ rather than 30mins with onnxruntime-directml.

Then, I look at GPU temperature, and temp is a bit higher than usual (70C). So, I guess, task manager may not report the right GPU metrics?

pmth avatar Jun 19 '24 01:06 pmth

ok - some update. installed onnxruntime-gpu and onnxruntime (cpu) and tried to use it. It turned out that estimates say 19hrs+ rather than 30mins with onnxruntime-directml.

Then, I look at GPU temperature, and temp is a bit higher than usual (70C). So, I guess, task manager may not report the right GPU metrics?

Hi my friend, yes, with Nvidia GPU Task manager does not visualize "AI processing" by default. You have to select the correct Voice from the graph menu, probably Compute 0 or High priority 3D

Djdefrag avatar Jun 19 '24 06:06 Djdefrag

image

I couldn't figure out where the bottleneck is. It doesn't use full - cpu or GPU. VRAM is very low as well.

image

(note: I added hvec_nvenc for faster hardware encoding, using it with P7 still several times faster and I couldn't tell the different between software/hardware for my use case)

pmth avatar Jun 20 '24 21:06 pmth

Hi my friend,

usually Half precision is faster, i reccomend use Full precision only for old gpus (which are not compatible with Half precision).

For Nvidia gpu's, Task Manager does not show GPU usage for AI processing by default. It should show it in one of these graphs, but I don't know which one because I don't have an Nvidia GPU :(

Immagine 2024-06-22 120428

In any case, it is also useful to look at the GPU temperature, to see if it is being used. If the temperature is high, it means it is being used properly.

Djdefrag avatar Jun 22 '24 10:06 Djdefrag

For me, it shows as Graphic_1 above which is running around 67%. I don't have High priority 3D. Yeh. I have been playing around with Half precision setting, I settled with half precision.

Do you have recommendation on interpolation? I noticed improvement selecting "None". However, I don't know if it's happening in every frame.

btw, I solved the GPU/CPU not fully used problem. I made change to allow 6 threads, now GPU goes up around 80%, I think VRAM is 1GB more and CPU is bounded :). It's reduced1.5 hours of 5 hrs processing with 4 threads. I think Real-ESRGAN can use high # of thread setting. But ESRGAN, will burn out my CPU much quicker.

Thanks for the note on watching CPU/GPU temp on the app, that's how I found out.

pmth avatar Jun 23 '24 18:06 pmth

I was having the same issue but I worked it out thanks to this thread to help me understand the requirements. I was ripping out my hair because I had just reinstalled a clean copy of Windows 11 23H2..but I copied over my AppData from my old install. Turned out the permissions werent right when I attempted to install Ubuntu with WSL2 to try running it under Linux Subsystem. After fixing my AppData permissions and checking WSL2 was working correctly; I reinstalled the requirements using pip.. Went from 100% CPU and 0% GPU with calculated 120hrs; to 20% CPU and 40% 3D on the GPU and dropped to 3hrs

Relevant Specs: Ryzen9 5950x Nvidia RTX3080Ti Windows 11 Pro 23H2 All VC Redists Python 3.12 onnxruntime-directml 1.17.3

For completeness of this discussion, heres what it looks like when its working properly with GPU in Windows

image

Jarsky avatar Aug 13 '24 09:08 Jarsky