User`s guide
7 Program Independent Jobs
7-26
This example function uses only the three default arguments. You can have
additional arguments passed into your submit function, as discussed in “MATLAB
Client Submit Function” on page 7-22.
2
Identify the values you want to send to your environment variables. For convenience,
you define local variables for use in this function.
decodeFcn = 'mydecodefunc';
jobLocation = get(props, 'JobLocation');
taskLocations = get(props, 'TaskLocations'); %This is a cell array
storageLocation = get(props, 'StorageLocation');
storageConstructor = get(props, 'StorageConstructor');
The name of the decode function that must be available on the MATLAB worker
path is mydecodefunc.
3
Set the environment variables, other than the task locations. All the MATLAB
workers use these values when evaluating tasks of the job.
setenv('MDCE_DECODE_FUNCTION', decodeFcn);
setenv('MDCE_JOB_LOCATION', jobLocation);
setenv('MDCE_STORAGE_LOCATION', storageLocation);
setenv('MDCE_STORAGE_CONSTRUCTOR', storageConstructor);
Your submit function can use any names you choose for the environment variables,
with the exception of MDCE_DECODE_FUNCTION; the MATLAB worker looks for its
decode function identified by this variable. If you use alternative names for the other
environment variables, be sure that the corresponding decode function also uses your
alternative variable names. You can see the variable names used in the standard
decode function by typing
edit parallel.cluster.generic.independentDecodeFcn
4
Set the task-specific variables and scheduler commands. This is where you instruct
your scheduler to start MATLAB workers for each task.
for i = 1:props.NumberOfTasks
setenv('MDCE_TASK_LOCATION', taskLocations{i});
constructSchedulerCommand;
end
The line constructSchedulerCommand represents the code you write to construct
and execute your scheduler’s submit command. This command is typically a string
that combines the scheduler command with necessary flags, arguments, and values