Parcellfun gives error while getting the results

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Parcellfun gives error while getting the results

Prasad K
Hi all,

I was using parcellfun function from parallel package v3.1.1 but since after
updating it to parallel package v3.1.2 is am getting an error saying  

"error: cat: dimension mismatch
error: called from
    cell2mat at line 80 column 11
    parcellfun at line 448 column 23"

when uniformoutput is enabled in parcellfun. But i did not face this error
in parallel package v3.1.1 so is there any fix for this problem?






--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Parcellfun gives error while getting the results

Olaf Till-2
On Thu, May 24, 2018 at 04:06:06AM -0700, Prasad K wrote:

> Hi all,
>
> I was using parcellfun function from parallel package v3.1.1 but since after
> updating it to parallel package v3.1.2 is am getting an error saying  
>
> "error: cat: dimension mismatch
> error: called from
>     cell2mat at line 80 column 11
>     parcellfun at line 448 column 23"
>
> when uniformoutput is enabled in parcellfun. But i did not face this error
> in parallel package v3.1.1 so is there any fix for this problem?
When I tested parallel-3.1.2 with Octave-4.4, I got no error from
parcellfun with UniformOutput enabled. So could you provide an example
for triggering this error?

Olaf

--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Parcellfun gives error while getting the results

Prasad K
Thanks Olaf

The following is the example test program which triggers that error when
uniform output is enabled.

my function:

/"function z =  testfun(x,y)
     z = x + y;
end

my main code:

pkg load parallel
clc;clear all;close all
Nproc = 8

input1 = repmat(1:500,20,1);
input2 = 1:500;
inputcell1= num2cell(input1,2);
inputcell2 = num2cell(input2,2);

output = parcellfun(Nproc, @testfun,
(inputcell1),(inputcell2),"uniformoutput",true)"/


When uniformoutput is false the program shows no error and executes as
expected.
But when uniformoutput is true it gives following error

"
Nproc =  8
parcellfun: 20/20 jobs done
error: reshape: can't reshape 1x10000 array to 20x1 array
error: called from
    parcellfun at line 452 column 21
    main at line 20 column 8

"



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Parcellfun gives error while getting the results

Olaf Till-2
On Thu, May 24, 2018 at 10:01:59PM -0700, Prasad K wrote:

> Thanks Olaf
>
> The following is the example test program which triggers that error when
> uniform output is enabled.
>
> my function:
>
> /"function z =  testfun(x,y)
>      z = x + y;
> end
>
> my main code:
>
> pkg load parallel
> clc;clear all;close all
> Nproc = 8
>
> input1 = repmat(1:500,20,1);
> input2 = 1:500;
> inputcell1= num2cell(input1,2);
> inputcell2 = num2cell(input2,2);
>
> output = parcellfun(Nproc, @testfun,
> (inputcell1),(inputcell2),"uniformoutput",true)"/
>
>
> When uniformoutput is false the program shows no error and executes as
> expected.
> But when uniformoutput is true it gives following error
>
> "
> Nproc =  8
> parcellfun: 20/20 jobs done
> error: reshape: can't reshape 1x10000 array to 20x1 array
> error: called from
>     parcellfun at line 452 column 21
>     main at line 20 column 8
In your previous post you reported a different error for this issue,
something with 'cat' and 'cell2mat' in line 448 of parcellfun.m.

If really the current error is your issue: This is not expected to
work with parcellfun (or with cellfun). Your function (testfun) has to
return only scalars to work with UniformOutput enabled. (The error
message of parcellfun could be improved for this.)

If your previously posted error message was the real issue, I'd need
an example triggering this.

Olaf

--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net



signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Parcellfun gives error while getting the results

Prasad K
Thanks Olaf

Sorry for triggering a wrong error, An updated example for triggering the
same error as i reported earlier

my function:

/"function z =  testfun(x,y)

Repeat = round(rand(1)*10);
for i = 1:Repeat
     z(i,:) = x + y;
end

end

my main code:

pkg load parallel

clc;clear all;close all;

Nproc = 8;

input1 = repmat(1:500,10,1);
input2 = 5;
inputcell1 = num2cell(input1,2);
inputcell2 = num2cell(input2,2);

output = parcellfun(Nproc, @testfun,
(inputcell1),(inputcell2),"uniformoutput",true);"/


When uniformoutput is false the program shows no error and executes as
expected.
But when uniformoutput is true it gives following error

"parcellfun: 10/10 jobs done
error: cat: dimension mismatch
error: called from
    cell2mat at line 80 column 11
    parcellfun at line 448 column 23
    main at line 19 column 8
"





--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html