This shows you the differences between two versions of the page.
ep:labs:05:contents:tasks:ex4 [2025/02/20 11:58] cezar.craciunoiu [04. [30p] GPU Monitoring] |
ep:labs:05:contents:tasks:ex4 [2025/02/20 15:04] (current) cezar.craciunoiu [04. [30p] GPU Monitoring] |
||
---|---|---|---|
Line 1: | Line 1: | ||
==== 04. [30p] GPU Monitoring ==== | ==== 04. [30p] GPU Monitoring ==== | ||
- | [0p] a. Clone Repository and Build Project | + | === a. [0p] Clone Repository and Build Project === |
- | [10p] b. Run Project and Collect Measurements | + | |
- | [10p] c. Generate Plot | + | Clone the repository containing the tasks and change to this lab's task 04. |
- | [10] d. Interpret Results on Plot | + | Follow the instructions to install the dependencies and build the project from the **README.md**. |
+ | |||
+ | <note tip> | ||
+ | <code> | ||
+ | $ git clone https://github.com/cs-pub-ro/EP-labs.git | ||
+ | $ cd EP-labs/lab_05/task_04 | ||
+ | </code> | ||
+ | </note> | ||
+ | |||
+ | === b. [10p] Run Project and Collect Measurements === | ||
+ | |||
+ | To run the project, simply run the binary generated by the build step. | ||
+ | This will render a scene with a sphere. | ||
+ | Follow the instructions in the terminal and progressively increase the number of vertices. | ||
+ | Upon exiting the simulation with **Esc**, two **.csv** files will be created. | ||
+ | You will use these measurements to generate plots. | ||
+ | |||
+ | <note warning> | ||
+ | The simulation runs with FPS unbounded, this means it will use your whole GPU. **Careful!** | ||
+ | |||
+ | Also pay close attention to your RAM! | ||
+ | </note> | ||
+ | |||
+ | <note tip> | ||
+ | Every time you modify the number of vertices, wait at least a couple of seconds so the FPS becomes stable. | ||
+ | |||
+ | Increase vertices until you have less than 10 FPS for good results. | ||
+ | </note> | ||
+ | |||
+ | <solution -hidden> | ||
+ | Students might face difficulties installing packages and/or running the project depending on their system. | ||
+ | You can let them run the experiment on their collegues' computer. | ||
+ | They can then send the generated results back to them to continue the exercise. | ||
+ | </solution> | ||
+ | |||
+ | === c. [10p] Generate Plot === | ||
+ | |||
+ | We want to interpret the results recorded. | ||
+ | In order to do this, we need to visually see them in a suggestive way. | ||
+ | Plot the results in such a way that they are suggestive and easy to understand. | ||
+ | |||
+ | <note> | ||
+ | Recommended way to do the plots would be to follow these specifications: | ||
+ | * One single plot for all results | ||
+ | * Left OY axis shows FPS as a continuous variable | ||
+ | * Right OY axis shows time spent per event in **ms** | ||
+ | * OX axis follows the time of the simulation without any time ticks | ||
+ | * OX axis has ticks showing the number of vertices for each event that happens | ||
+ | * Every event marked with ticks on the OX axis has one stacked bar chart made of two components: | ||
+ | * a. a bottom component showing time spent copying buffers | ||
+ | * b. a top component showing the rest **without the time spent on copying buffers** | ||
+ | |||
+ | </note> | ||
+ | |||
+ | <solution -hidden> | ||
+ | Recommend students to follow the guide from the notes in the task. | ||
+ | If they do not follow it make sure it is an improvement over the suggestion. | ||
+ | Otherwise, mark them as you fit. | ||
+ | </solution> | ||
+ | |||
+ | === d. [10p] Interpret Results === | ||
+ | |||
+ | Explain the results you have plotted. | ||
+ | Answer the following questions: | ||
+ | * Why does the FPS plot look like downwards stairs upon increasing the number of vertices? | ||
+ | * Why does the FPS decrease more initially and the stabilizes itself at a higher value? | ||
+ | * What takes more to compute: generating the vertices, or copying them in the VRAM? | ||
+ | * What is the correlation between the number of vertices and the time to copy the Vertex Buffer? | ||
+ | * Why is the program less responsive on a lower number of frames? | ||
+ | <solution -hidden> | ||
+ | Answers: | ||
+ | * FPS stays stable until a button is pushed, and then it descends as the scene becomes more complex. | ||
+ | * The more complex the scene, the more data needs to be copied, which means a longer pause between the last and the current frame. As the FPS is calculated per second, this will mean the result is tarnished/skewed for the first second since the button is pressed. | ||
+ | * They need to compare the bar chart components and see which is bigger for them. Theoretically generating takes more time. | ||
+ | * The higher the number of vertices, the bigger the Vertex Buffer, the longer it takes to copy it into VRAM from RAM. | ||
+ | * Input is computed per frame. If input comes while the program is busy, it will be ignored. The smaller the FPS, the more unresponsive the program becomes. Easy to observe on <5 FPS. | ||
+ | |||
+ | Any format suggesting these is ok. | ||
+ | </solution> | ||
+ | |||
+ | === e. [10p] Bonus Dedicated GPU === | ||
+ | |||
+ | Go back to step b. and rerun the binary and make it run on your dedicated GPU. | ||
+ | Redo the plot with the new measurements. | ||
+ | You do not need to answer the questions again. | ||
+ | |||
+ | <note tip> | ||
+ | If you use Nvidia, you can use **prime-run**. | ||
+ | |||
+ | https://gist.github.com/abenson/a5264836c4e6bf22c8c8415bb616204a | ||
+ | |||
+ | If you use AMD, you can use the **DRI_PRIME=1** environment variable. | ||
+ | </note> | ||
+ | |||
+ | <solution -hidden> | ||
+ | If they did the other tasks this will be easy enough for them. | ||
+ | |||
+ | I would not give them the extra points if they did not answer the questions on point d. | ||
+ | </solution> |