Implementation of GPU computing with gpuArray?

6 views (last 30 days)
Hi!
I have a probplem with GPU computing.
I have implemented in my code and in all my functions (*m-files) GPU computing by adding gpuArray.
However, I did not observe significant improvment in computational time. Moreover, in my task maneger GPU is loaded only max 3%.
Can anyone advice what would be the best way to double check if my code really addresses the GPU? What could be a possible solution of this problem?
As a part of my code, I use the VideoWriter function to save frames of figures after every "for loop". Can it be a possible issue why the speed is not improved?
Thank you in advance for any help!
Best regards,
Ivan

Answers (1)

Walter Roberson
Walter Roberson on 2 Oct 2020
Every iteration, you have to bring back the solution from the GPU and write it to video. Writing to video can involve some compression steps, depending on what kind of file you are writing and what kind of "profile" you are using. That processing could easily take a lot more time than the iterations take on the GPU.
Remember that there is overhead getting the data to and from the GPU and in instructing the GPU what to do. If the problem you are sending to the GPU is not "big enough" then you can even end up with worse performance than using CPU.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!