You can check how much your GPU is being used by clicking on the "Performance" tab in Task Manager and looking at the graph.


If the GPU doesn’t appear even after clicking the Performance tab, it could mean that the driver is not properly installed or that the GPU is currently not in use.


If you haven't installed the correct graphics card driver, you should first check whether the driver is properly installed.

If the driver is installed correctly but you're still seeing Code 22, start by pressing Windows + R to open the Run dialog, then type dxdiag.

This will open the DirectX Diagnostic Tool. Normally, it will show that no problems were found under the Notes section. However, if the GPU didn’t appear in Task Manager earlier, this section might say that the device couldn't be found or display an error like Code 22.



If you see such an error, press Windows + R again to open the Run dialog, and this time type devmgmt.msc.


After clicking OK, the Device Manager will open. In the list, click on Display adapters, then select each device listed under it.




You will likely see a message saying that the device cannot be used, along with a Code 22 error.

Go to the Driver tab next to General, and click Enable Device.

The screen may briefly turn off and back on. Once it does, the Enable Device button will change to Disable Device, and the message under the General tab should now say that the device is working properly.

This means the GPU is now functioning correctly. If you go back to Task Manager and check the Performance tab again, the GPU should now appear. When you run your code again, you should notice it runs much faster, and the GPU usage graph will show higher activity.