how to clear temporary memory of workers in Parallel computing

2 views (last 30 days)
HI
how to clear temporary memory of workers in Parallel computing?
I have a parallel code given below
=============================
%Function File
function [PD PD123] = demo(PL)
if labindex==1
PD=125;
end
if labindex==2
PD=150;
end
if labindex==3
PD=175;
end
if labindex==4
PD=200;
end
PD123=PD+PL;
end
========================
=================================
% Main File
clear all
clc
PL=50;
jm=findResource('scheduler','configuration','jobmanagerconfig1')
pjob1=createParallelJob(jm,'configuration','jobmanagerconfig1')
set(pjob1,'Configuration','jobmanagerconfig1')
set(pjob1,'MinimumNumberOfWorkers',4);
set(pjob1,'MaximumNumberOfWorkers',4);
set(pjob1,'FileDependencies',{'demo.m'})
task1=createTask(pjob1,@demo,2,{PL})
submit(pjob1)
results=getAllOutputArguments(pjob1)
destroy(pjob1)
=================================
output i got like
=============================== results=
[125] [175]
[150] [200]
[175] [225]
[200] [250]
=============================
My question is ,
For the second time run, If I change "PL=100"
Then i got the same results.
I was think that may be PL is stored in temporary memory and it is not cleared during the second time run.
Will you suggest me some commands in parallel computing , so that the variable must be cleared if we want to run the same code for second or third times.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!