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

Reduce CPU load during GPU initialization #118

Closed
maxpla3 opened this issue Aug 10, 2023 · 2 comments · Fixed by #188
Closed

Reduce CPU load during GPU initialization #118

maxpla3 opened this issue Aug 10, 2023 · 2 comments · Fixed by #188
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@maxpla3
Copy link

maxpla3 commented Aug 10, 2023

The CPU load during initialization is constantly at 100% for each postcli process. This has been reported from many users.

This issue is due to the specific Nvidia implementation of the OpenCL synchronization. The enqueued buffer read operation is constantly probing the status of the running OpenCL kernel, which puts the CPU under high load.

A workaround would be to put the CPU thread in sleep for a defined duration right after enqueuing the kernel, and only then enqueue a buffer read. The sleep duration can be obtained by averaging the execution time over a number of kernel executions and then subtracting a safety factor from it (e.g. sleep duration is 90% of kernel execution).
Ideally, the kernel execution time should be measured periodically by disabling the sleep for a couple of kernel executions every few seconds. This ensures that if the kernel execution time decreases below the sleep duration (e.g. becuase the user increased the power limit of the GPU), the decrease is properly detected.

Tests on a RTX 3080 Ti show, that a sleep duration of 25ms reduces the CPU load to 10% while maintaining the initialization speed. While a further increase of the sleep duration to 30ms reduced the CPU load to 2.5% it has a negative impact on the initialization speed.

sleep (ms) CPU load (%) init. speed (MiB/s)
0 100 3.30
25 10 3.30
30 2.5 2.75
@KVolc5O1
Copy link

I experience the same issue on my node. Would be nice if there was a fix to save some electricity 👍

@poszu poszu self-assigned this Aug 11, 2023
@poszu poszu added enhancement New feature or request good first issue Good for newcomers labels Aug 11, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Dev team kanban Aug 11, 2023
@poszu
Copy link
Collaborator

poszu commented Aug 11, 2023

Thanks for creating the issue @maxpla3 👍 . I will take it as soon as I finish other tasks.

@poszu poszu moved this from 📋 Backlog to 🏗 Doing in Dev team kanban Feb 15, 2024
@github-project-automation github-project-automation bot moved this from 🏗 Doing to ✅ Done in Dev team kanban Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants