How to formulate problem so Matlab can use GPU functionality?
Show older comments
Often when I try to solve a problem and want to use the GPU I strugle to formulate the problem so Matlab can use GPU functionality.
Below is very simple example. I have a function with an array as input and I want to evaluate it with a large number of different parameters, in this example it's a filter that I want to test with different filter coefficients. It is possible to use "parfor" to parallelize it on the CPU. But how do I use the GPU to solve it?
.
X=sin((0:0.1:5)'); % Unfiltered signal
C = linspace(0,1,1e6)'; % Large number of filter coefficients
Y = zeros(length(X),length(C)); % Pre allocate storage for filtered signals
for k=1:length(C)
Y(:,k) = MyFilter(X,C(k)); % I want to parallelize this for-loop on the GPU
end
Accepted Answer
More Answers (0)
Categories
Find more on GPU Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!