You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Any tutorial about avoiding GPU data starvation ? #729
So basically i want to use multithreads to feed my model to prevent data starvation. But there isn't any tutorial i found that is easy to understand and follow. Any ideas ?
First i do not use Keras.NET. Second i think u misunderstood my question. So currently i'm running my model with session.run() but it's slow and my GPU is having some weird usage spike #719 . After googling around i found out that my GPU is starving of data aka the CPU is too slow preparing data to push it into the GPU.
Example, the entire process from preparing data to invoke session.run() to preparing result take 120ms.
Preparing data need 60ms, session.run() need 30ms, preparing result need 30ms
The entire thing run on 1 thread 60 + 30 + 30 = 120ms. So after the session.run() done processing the GPU need entire 90ms = 30ms (preparing result step) + 60ms (preparing data step) for new data to process (data starvation). So the idea is to create 4 threads, 2 threads for data preparing step (step 1), 1 thread invoke session.run() (step 2), 1 thread for preparing step (step 3).
So the pipeline will change as follow. Step 1 pump out 2 new piece of data after 60ms. Step 2 somehow get the data from step 2 and after 30ms step 2 pump out 1 piece of result, step 2 get the other data and process it (AND step 1 is half way done). Step 3 get the result and process it 30ms (step 1 is done and step 2 ALSO done), step 3 get the new result from step 2 and step 2 get 2 new data from step 1. And the loop continue, so with thread the entire process is 4 times FASTER from 120ms to 30ms.
And this is the result i want to achieve, any ideas (concurrent queue) ?
Activity
Oceania2018 commentedon Jan 21, 2021
There is a memory leak issue in Keras implementation. #727
minhduc66532 commentedon Jan 22, 2021
First i do not use Keras.NET. Second i think u misunderstood my question. So currently i'm running my model with session.run() but it's slow and my GPU is having some weird usage spike #719 . After googling around i found out that my GPU is starving of data aka the CPU is too slow preparing data to push it into the GPU.
Example, the entire process from preparing data to invoke session.run() to preparing result take 120ms.
Preparing data need 60ms, session.run() need 30ms, preparing result need 30ms
The entire thing run on 1 thread 60 + 30 + 30 = 120ms. So after the session.run() done processing the GPU need entire 90ms = 30ms (preparing result step) + 60ms (preparing data step) for new data to process (data starvation). So the idea is to create 4 threads, 2 threads for data preparing step (step 1), 1 thread invoke session.run() (step 2), 1 thread for preparing step (step 3).
So the pipeline will change as follow. Step 1 pump out 2 new piece of data after 60ms. Step 2 somehow get the data from step 2 and after 30ms step 2 pump out 1 piece of result, step 2 get the other data and process it (AND step 1 is half way done). Step 3 get the result and process it 30ms (step 1 is done and step 2 ALSO done), step 3 get the new result from step 2 and step 2 get 2 new data from step 1. And the loop continue, so with thread the entire process is 4 times FASTER from 120ms to 30ms.
And this is the result i want to achieve, any ideas (concurrent queue) ?
Oceania2018 commentedon Jan 22, 2021
Check if the
QueuehelpTensorFlow.NET/test/TensorFlowNET.UnitTest/Basics/QueueTest.cs
Line 37 in ceaa09c
minhduc66532 commentedon Jan 22, 2021
TensorFlow.NET/test/TensorFlowNET.UnitTest/Basics/QueueTest.cs
Line 40 in ceaa09c
You mean "push 2 elements" ? Anyway thanks for the suggestion, i will report back result soon enough (hopefully)
Oceania2018 commentedon Feb 7, 2021
Please try latest version.