Speeding up stream2 with parallel computing?

조회 수: 9 (최근 30일)
Stuart
Stuart 2015년 7월 16일
댓글: Stuart 2015년 7월 16일
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.

답변 (1개)

Matt J
Matt J 2015년 7월 16일
Not
EP = arrayfun(stream2,....)
You need the @,
EP = arrayfun(@stream2,...)
  댓글 수: 1
Stuart
Stuart 2015년 7월 16일
Thanks. Looks like I'd forgotten, not all my inputs are the same size and shape, so arrayfun won't take them.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by