f



Parallel Computing in Distributed Computing Toolbox

I made the following function/script and I get an empty
array of 4 by 0

I wanted to see if I could initialize labs with data, by
attaching it to the root.

jm = findResource('scheduler','configuration','jobmanager',
'name', ...
    'IPS_Manager', 'LookupURL', 'ava-310848');
pjob = createParallelJob(jm);
set(pjob, 'MinimumNumberOfWorkers', 4);
set(pjob, 'MaximumNumberOfWorkers', 4);
createTask(pjob, @getLabIndex, 1, {});
submit(pjob);
waitForState(pjob);
out = getAllOutputArguments(pjob)
clear jm;


function foo = getLabIndex
handle = findobj;
switch labindex
    case 1,
        setappdata(handle, 'foo', 1)
    case 2,
        setappdata(handle, 'foo', 2)
    case 3,
        setappdata(handle, 'foo', 3)
    case 4,
        setappdata(handle, 'foo', 4)
    otherwise
        setappdata(handle, 'foo', NaN)
end

foo = getappdata(handle, 'foo');
0
8/6/2007 6:32:38 PM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
822 Views

Similar Articles

[PageSpeed] 56

"Colleen " <colleen.leung.nospam@lmco.com> wrote in message
<f97pg6$kjb$1@fred.mathworks.com>...
> I made the following function/script and I get an empty
> array of 4 by 0
> 
> I wanted to see if I could initialize labs with data, by
> attaching it to the root.
> 
> jm = findResource('scheduler','configuration','jobmanager',
> 'name', ...
>     'IPS_Manager', 'LookupURL', 'ava-310848');
> pjob = createParallelJob(jm);
> set(pjob, 'MinimumNumberOfWorkers', 4);
> set(pjob, 'MaximumNumberOfWorkers', 4);
> createTask(pjob, @getLabIndex, 1, {});
> submit(pjob);
> waitForState(pjob);
> out = getAllOutputArguments(pjob)
> clear jm;
> 
> 
> function foo = getLabIndex
> handle = findobj;
> switch labindex
>     case 1,
>         setappdata(handle, 'foo', 1)
>     case 2,
>         setappdata(handle, 'foo', 2)
>     case 3,
>         setappdata(handle, 'foo', 3)
>     case 4,
>         setappdata(handle, 'foo', 4)
>     otherwise
>         setappdata(handle, 'foo', NaN)
> end
> 
> foo = getappdata(handle, 'foo');

It seems like the problem is that you didn't specify your
function "getLabIndex" as FileDependencies. When you define
your parallel job, do this.

pjob=createParallelJob(jm,'FileDependencies',{'getLabIndex.m'});


When it returns empty matrices, it's likely that there was
an error in the process. You can check it by examining the
tasks:

pjob
% notice that it will say "TaskID of errors : [1  2  3  4]"

ptasks = pjob.Tasks
ptasks(1)

% this should tell you what the error was.

Take a look at the following help:

http://www.mathworks.com/access/helpdesk/help/toolbox/distcomp/f5-15569.html#f5-18963


Hope this helps
0
jiro.doke1 (127)
8/6/2007 11:29:17 PM
Reply: