I am trying to run a parallel job on a large cluster; all code and functions work fine on my computer (Mac OS 10.7 & Matlab v7.13.0.564 (R2011b)) but something is not working on the cluster (unix-redhat 5.5 - kernel = 2.6.18-238.12.1.el5 Matlab v7.13.0.564 (R2011b)
The following is a sequence of commands that works without error on my machine and fails on the cluster. The function add2nums is in the subdirectory ./lib, and is also documented below.
function out = add2nums(num1, num2)
out = num1+num2;
end
What is going on and how do I fix it?
>> addpath('./lib')
>> which add2nums
/My_Matlab_Path/lib/add2nums.m (matlab sees the function on my machine and on unix cluster)
>> sched = findResource('scheduler','type','local');
>> job = createParallelJob(sched,'configuration','local');
>> task = createTask(job,@add2nums,1,{[1 2],[3 4]},'CaptureCommandWindowOutput',true);
>> addpath('./lib')
>> submit(job)
>> waitForState(job)
>> task
task =
Task ID 1 from Job ID 19 Information
====================================
State : finished
Function : @add2nums
StartTime : Tue Aug 07 10:27:44 MDT 2012
Running Duration : 0 days 0h 0m 1s
- Task Result Properties
ErrorIdentifier : MATLAB:UndefinedFunction
ErrorMessage : Undefined function 'add2nums' for input arguments of type 'double'.