Effacer les filtres
Effacer les filtres

Error using fetchnext and parallel.pool.constant

17 vues (au cours des 30 derniers jours)
Muna Tageldin
Muna Tageldin le 22 Oct 2020
Modifié(e) : Muna Tageldin le 26 Oct 2020
I have this code, that I run on a remote cluster. I followed this tutorial on using parallel.pool.constant with parfeval. I run into a problem in fetchnext. The error is "Error using parallel.FevalFuture/fetchNext . The function evaluation completed with an error. Caused by no workers abailable for FevalQueue excution". I followed this as well. An error occured during parallel.pool.constant . I am not sure how to proceed.
poolobj=parpool('my_cluster',8);
[up, op]=ndgri(1e-3:1e-2:1,1e-3:1e-2:1);
up=reshape(up, [1,size(up,1)*size(up,2)]);
up=reshape(up, [1,size(up,1)*size(up,2)]);
z=rand(5,5e3);
addAttachedFiles('<path to my function/cores_random.m');%%to add the function files to workers on the pool
C1=parallel.pool.Constant(z);%%use parallel.pool.Constant to copy these variables into workers
U2=parallel.pool.Constant(up);
O2=parallel.pool.Constant(op);
for i=1:size(up,2)
f1(i) = parfeval(poolobj,@cores_random, 3, i, 1,C1,U2,O2); %%line 11
f2(i) = parfeval(poolobj,@cores_random, 3, i, 2,C1,U2,O2);
f3(i) = parfeval(poolobj,@cores_random, 3, i, 3,C1,U2,O2);
f4(i) = parfeval(poolobj,@cores_random, 3, i, 4,C1,U2,O2);
f5(i) = parfeval(poolobj,@cores_random, 3, i, 5,C1,U2,O2);
end
wait(f1);
wait(f2);
wait(f3);
wait(f4);
wait(f5);
for j=1:size(up,2):-1:1
[idx1,u1,o1,ep1]=fetchNext(f1);
[idx2,u2,o2,ep2]=fetchNext(f2);
[idx3,u3,o3,ep3]=fetchNext(f3);
[idx4,u4,o4,ep4]=fetchNext(f4);
[idx5,u5,o5,ep5]=fetchNext(f5);
end
function [uu,oo,ep] = cores_random(i, zidx,C1,U2,O2)
up = U2.Value(i)
op = O2.Value(i);
z = C1.Value(zidx,:);
%%doing some calculations here
%%z is of size 1*1e3
%%up is scalar op is scalar
end
  3 commentaires
Muna Tageldin
Muna Tageldin le 22 Oct 2020
yes sorry I made a typo. Actually its 3 in the real code. This is a simplified code.
Muna Tageldin
Muna Tageldin le 22 Oct 2020
so basically, I should write 4 for outputs ? ( three from the function and one index)

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Asynchronous Parallel Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by