How to tell the graphic card memory usage? - monitoring

My application seems to be slow, but in terms of CPU and RAM, it seems that it is OK. So, I want to know how much memory of the graphic card I am using. I've seen some questions about this on SO, but they talk about Linux or NVidia. I would like to have this information for ATI cards on Windows.
Thanks.

How about the OpenGL debugger?

if you use OpenSceneGraph in order to render scene, there is a stats monitor that shows the usage of GPU.

Related

High CPU usage running webassembly based WebGL program

I am making a game using webassembly (C++ and emscripten), where I am using OpenGL to generate graphics. I have noticed that my game often uses a lot of CPU, typically 200-300%. This CPU usage becomes higher if I have a larger 3D model or if my shader is more complicated.
Is this normal for webassembly? Or am I doing something wrong? I'm bit worried that I made a mistake since normally I would not expect the CPU usage to be directly linked to the size of 3D models (I would expect that to mostly take a toll on the graphics card), but since it is webassembly it might be different.
Are there any good tips for trying to reduce CPU usage when running OpenGL and webassembly?
Edit:
The basic example I started working from was
https://github.com/timhutton/opengl-canvas-wasm
live demo here (https://timhutton.github.io/opengl-canvas-wasm/)
This already runs at quite high CPU. What is wrong with that example making it run at such high CPU load? It is not the glBufferData, even removing that keeps the CPU high.
Your browser may use software rendering for some reason, check your browsers GPU debugging page to see if there's anything wrong, in Chrome that is chrome://gpu, in Firefox it's the GPU section in about:support.

Getting FPS and frame-time info from a GPU

I am a mathematician and not a programmer, I have a notion on the basics of programming and am a quite advanced power-user both in linux and windows.
I know some C and some python but nothing much.
I would like to make an overlay so that when I start a game it can get info about amd and nvidia GPUs like frame time and FPS because I am quite certain the current system benchmarks use to compare two GPUs is flawed because small instances and scenes that bump up the FPS momentarily (but are totally irrelevant in terms of user experience) result in a higher average FPS number and mislead the market either unintentionally or intentionally (for example, I cant remember the name of the game probably COD there was a highly tessellated entity on the map that wasnt even visible to the player which lead AMD GPUs to seemingly under perform when roaming though that area leading to lower average FPS count)
I have an idea on how to calculate GPU performance in theory but I dont know how to harvest the data from the GPU, Could you refer me to api manuals or references to help me making such an overlay possible?
I would like to study as little as possible (by that I mean I would like to learn what I absolutely have to learn in order to get the job done I dont intent to become a coder).
I thank you in advance.
It is generally what the Vulkan Layer system is for, which allows to intercept API commands and inject your own. But it is nontrivial to code it yourself. Here are some pre-existing open-source options for you:
To get to timing info and draw your custom overlay you can use (and modify) a tool like OCAT. It supports Direct3D 11, Direct3D 12, and Vulkan apps.
To just get the timing (and other interesting info) as CSV you can use a command-line tool like PresentMon. Should work in D3D, and I have been using it with Vulkan apps too and it seems to accept them.

Micro SD Card as Arduino "main memory"

I would like to know if it is possible to store font code in a Micro SD card and then, afterwards, access this code to run the routines.
I'm doing some stuff with Arduino nano and due to the amount of sensors and components, I'm having problems with memory. It is causing an instability that might affect things to work properly.
Any suggestions?
The best suggestion that I can give you, is switch to an Arduino Mega, or an Arduino Due.
If you are not open to that solution, then things are going to be rough.
What you will need to do, is write a bootloader, which is able to read from the memory card and change the flash contents of your Atmega.
What this essentially means is that you have to write an OS level program for your Arduino Bootloader, and use the memory card like a hard-disk and the rest of your Arduino flash as the program RAM.
I hope this helps, good luck.
Nitro, Gerhard and datafiddler,
My problem was solved by a simple code optimization. I'm new to this Arduino world and so I was using a lot of unnecessary stuff.
I appreciated the help provided. Thanks!

Profile detailed GPU Memory Usage

So I have a GPU memory leak in certain scenarios in my application. However, I am not aware of any detailed memory profiler for the GPU like those for the CPU. Are there anything out there that can achieve this? I am using D3D (since its WPF, there are d3d9, d3d10, d3d11 components...)
Thanks!
Are you using the debug setting in Dx control panel? This helps you dump the id of the leaking allocation. You can then proceed to set a HKLM registry value and break on the leaking allocation, as is explained here:
http://legalizeadulthood.wordpress.com/2009/06/28/direct3d-programming-tip-5-use-the-debug-runtime/
http://www.gamedev.net/topic/313718-tracking-down-a-directx-leak/
You can also try NSight, which you can download for free from NVidia. For Maximus cards there is also a specific GPU Debugger, and otherwise you can use the Graphics Debugger and try to isolate the memory bump there. In the Performance Debugger you can detect both OpenGl and DirectX events, though this is more performance oriented.
Depending on your GPU's vendor (As you have not provided us with the information), here are the possible solutions:
Intel: Use the Intel Media SDK 's GPU Utilization Utility. This comes packaed in the Intel INDE (Integrated Developer Environment).
AMD: CodeXL provides an on-the-fly debugger and an extensive memory profiling tool, and is now provided as part of their GPUOPen initiative.
NVIDIA: Use the Nvidia Visual Profiler (NVVP) combined with traces from Nvidia Nsight, and these utilities are provided with the standard Nvidia CUDA installer.
Notes:
With Nvidia, you must also install the provided GPU driver (~from the CUDA SDK) to enable any form of GPU-based driver profiling and debugging. Take note of the above limitation if you use your development rig for other purposes such as gaming, as the bundled driver is often much, much older than the stock, Game-ready drivers.
Thanks and regards,
Brainiarc7.

Newbie to GPU programming: what to learn?

I am rendering a certain scene to an off-screen frame buffer (FBO) and then I'm reading the rendered image using glReadPixels() for processing on the CPU. The processing involves some very simple scanning routines and extraction of data.
After profiling I realized that most of what my application does is spend time in glReadPixels() - more than 50% of the time. So the natural step is to move the processing to the GPU so that the data would not have to be copied.
So my question is - what would be the best way to program such a thing to the GPU?
GLSL?
CUDA?
Anything else I'm not currently aware of?
The main requirements is that it'll have access to The rendered off-screen frame bufferes (or texture data since it is possible to render to a texture) and to be able to output some information to the CPU, say in the order of 1-2Kb per frame.
You might find the answers in the "Intro to GPU programming" questions useful.
-Adam
There are a number of pointers to getting started with GPU programming in other questions, but if you have an application that is already built using OpenGL, then probably your question really is "which one will interoperate with OpenGL"?
After all, your whole point is to avoid the overhead of reading your FBO back from the GPU to the CPU with glReadPixels(). If, for example you had to read it back anyway, then copy the data into a CUDA buffer, then transfer it back to the gpu using CUDA APIs, there wouldn't be much point.
So you need a GPGPU package that will take your OpenGL FBO object as an input directly, without any extra copying.
That would probably rule out everything except GLSL.
I'm not 100% sure whether CUDA has any way of operating directly on an OpenGL buffer object, but I don't think it has that feature.
I am sure that ATI's Stream SDK doesn't do that. (Although it will interoperate with DirectX.)
I doubt that the DirectX 11 "technology preview" with compute shaders has that feature, either.
EDIT: Follow-up: it looks like CUDA, at least the most recent version, has some support for OpenGL interoperability. If so, that's probably your best bet.
I recently found this Modern GPU
You may find OpenAI Triton useful

Resources