In a spmd statement ,How to call a function that contains another spmd statement.

1 次查看(过去 30 天)
I am sure that my PC can open at least 12 workers by using local profile. if I use another spmd statement in the function, the error is" Could not create an SPMD block to match the requested size: 2. The matlabpool size is: 0." Also I can not execute matlabpool open on the labs.
it seems like:
...
spmd
...
function
end
function()
spmd
...
end
end

回答(2 个)

Richard Brown
Richard Brown 2012-7-2
编辑:Richard Brown 2012-7-2
It's because you're calling spmd within another spmd block (I'm not sure you can do this). Your initial spmd call will take up all of the labs from your pool. Perhaps what you actually want to do is either
  • Have no spmd block inside your function, or
  • Call the function from outside the spmd block? You can still pass it the composite objects generated from your first spmd call, and have it access them correctly within the spmd block inside your function.

yu xu
yu xu 2012-7-2
cpoy FROM Matlab HELP
Nested spmd Statements The body of an spmd statement cannot contain another spmd. However, it can call a function that contains another spmd statement. Be sure that your MATLAB pool has enough workers to accommodate such expansion.

类别

Help CenterFile Exchange 中查找有关 Distributed Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by