Speeding up stream2 with parallel computing?

2 views (last 30 days)
Stuart
Stuart on 16 Jul 2015
Commented: Stuart on 16 Jul 2015
I've got a set of data that I'm looping through almost 4 million times, and it's iterative, so I can't just parfor it. The whole script takes a couple of days to run. I ran it through the built in profiler and 83-87% of the computation time is spent in stream2. I'm leaning towards GPU, since the lab I'm working for has a computer with a Nvidia Tesla K40, but my parallel computing experience is nonexistent.
The inputs to stream2 are all arrays except of the step size and max vertices, which I need to be able to control. I've tried putting it in to arrayfun and putting all the inputs in to gpuArrays, but stream2 throws an error:
Error using stream2>parseargs (line 100)
Wrong number of input arguments.
Error in stream2 (line 29)
[x, y, u, v, sx, sy, step, maxvert] = parseargs(nargin,varargin);
Here's the code I'm working with:
OPTIONS = [0.05 , 2];
EP = arrayfun(@stream2,C.x/10,C.y/10,C.u/10,C.v/10,Xin,Yin);
Where C is a structure array. As I loop through, the output of stream2 from the n-1 loop will be the Xin and Yin for the nth loop.
Any thoughts on speeding this up?
Edit: Added the @ in front of my function, turns out I had forgotten my inputs to stream2 weren't the same size and shape, so arrayfun probably isn't the solution.

Answers (1)

Matt J
Matt J on 16 Jul 2015
Not
EP = arrayfun(stream2,....)
You need the @,
EP = arrayfun(@stream2,...)
  1 Comment
Stuart
Stuart on 16 Jul 2015
Thanks. Looks like I'd forgotten, not all my inputs are the same size and shape, so arrayfun won't take them.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!