I want to use the parallel package to furnish a large 4 dimensional array. The following:
clear;
function a=single_thread(ky);
a(:,:,1)=ky*[1,2;4,5];
a(:,:,2)=[1,2;4,5];
a(:,:,3)=-ky*[1,2;4,5];
endfunction
b=pararrayfun(4,@single_thread,[1:4],"ChunksPerProc", 1)
works, giving b that has the results from each thread tacked onto the end.
Changing the (1:4] to [1:5] in the invocation breaks the script with errors:
warning: parcellfun: unhandled error in subprocess 2
warning: parcellfun: unhandled error in subprocess 1
warning: called from
parcellfun at line 291 column 9
warning: called from
chunk_parcellfun at line 47 column 23
parcellfun at line 291 column 9
parcellfun at line 137 column 26
chunk_parcellfun at line 47 column 23
pararrayfun at line 85 column 26
parcellfun at line 137 column 26
playparallel at line 8 column 2
pararrayfun at line 85 column 26
playparallel at line 8 column 2
I can fix the last version by increasing ChunksPer Proc to 2.
I know this means I don't understand the features of the parallel package, but it is way too wonderful to not take advantage of. Can anyone shed some light, particularly on how the output value (b in the case here) is constructed if it is multidimensional?
Many thanks