How to convert this vectorized code into GPU code for MAXIMUM speedup ?
显示 更早的评论

1 个评论
Jan
2017-4-26
Please post code as text and not as a screenshot. Then it can be used by copy&paste to create an answer.
回答(2 个)
Joss Knight
2017-4-18
I was able to get a marginal speedup with additional vectorization of the mask:
x = sum(I < cat(3, 120, 155, 160), 3) == true;
but otherwise you've done pretty well. You've got to wonder why you need to replicate the output on every channel however. Why not discard the colour channels if you're using grayscale?
2 个评论
Tanmay Virnodkar
2017-4-20
编辑:Tanmay Virnodkar
2017-4-20
Joss Knight
2017-4-26
Right, but then you're including the cost of replicating data in GPU memory and doing indexing, which is memory-bound and doesn't necessarily show the GPU in a great light.
Jan
2017-4-18
0 个投票
The bottlenecks of the code are the darn clear all and the disk access using imwrite. Moving this to the GPU will not help.
类别
在 帮助中心 和 File Exchange 中查找有关 GPU Computing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!