Error using arrayfun inside spmd function

I'm using spmd to run parallel instances of a function. Inside that function, I'm attempting to use arrayfun. When I run in serial, without spmd, it works fine but more slowly. When using the two features in combination I get this error:
Error detected on worker 3.
The class parallel.internal.types.Atomic has no Constant property or Static method name 'enumerate'.
Is this supported? I see on the linked page that spmd cannot contain par-for loops, but no mention of arrayfun. http://www.mathworks.com/help/distcomp/programming-tips_brukbnp-9.html#brukbnp-12

2 件のコメント

michio
michio 2016 年 9 月 1 日
Do you use arrayfun to run on GPU?
Zac Drake
Zac Drake 2016 年 9 月 1 日
Yes, the data passed into arrayfun is on the GPU.

サインインしてコメントする。

 採用された回答

michio
michio 2016 年 9 月 2 日

0 投票

I believe use of arrayfun (GPU) within spmd itself is supported. Will the following script give an error on your environment?
fun = @(x,y)(x.*y);
spmd
%GPU run code from each worker
R1 = rand(labindex,5,'gpuArray');
R2 = rand(labindex,5,'gpuArray');
R = arrayfun(fun,R1,R2);
end
R
Could you share a sample script that allows us to reproduce the issue?

2 件のコメント

Zac Drake
Zac Drake 2016 年 9 月 7 日
Your sample code ran perfectly. I ran my code again and I'm no longer receiving the error. All I can think of is bad data in my workspace. Thank you for your help!
michio
michio 2016 年 9 月 7 日
Good to hear that you do not get errors anymore!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeParallel Computing についてさらに検索

タグ

質問済み:

2016 年 9 月 1 日

コメント済み:

2016 年 9 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by