Prev: Cannot load .asc file
Next: box constraint in svmtrain
From: Sumant on 21 Jan 2010 09:10 Dear all, I have a simulink model which refers one more model inside. I want to run this model using PCT in different workers. However i have realized that there are some data concurrency issues while running this model in different workers. so i have generated a code as mentioned in the support documentation 'Resolve Data concurrency issues'. The code looks like this: function x = parsim(modelname, k,j) Value = 10:10:70; Val = 10:10:40; spmdrun %function to extract variables in each workspace TestVar2 = Value(k); TestVar3 = Val(j); cwd = pwd; addpath(cwd) tmpdir = tempname; mkdir(tmpdir) cd(tmpdir) load_system(modelname) options = simset('SrcWorkspace', 'current'); x = sim(modelname,[0 100], options); cd(cwd) rmdir(tmpdir,'s') rmpath(cwd) This function is called under parfor command in a matlabpool: matlabpool open local 4 tic %addpath Z:\test\testpath parfor k=1:7 for j=1:4 x{k} = parsim('TestPar_parfor', k,j); end end toc matlabpool close Now when I execute this code the simulation starts but i get an error once it starts updating the model which is being refferred. the error reads: ''Real-Time Workshop build procedure for model: 'testmodel' aborted due to an error''. Is this the error due to the code that i have written ?? or Is it from the model itself..?? I would really appreciate if anyone could help me regarding this. Thanks Sumant
From: Rajesh Pavan Sunkari on 21 Jan 2010 15:56 Hi, It is best to use rapid accelerator mode to run parallel simulation. The Simulink documentation has a section on running parallel simulations which has more details. Regarding the error, it appears some model is being referenced and that seems to be failing to build as part of compilation. One common reason for this could be that the reference model is using some data that is not available on the worker. Hence all the data that is required should be transferred to the workers (from the host machine) by using an assignin command or something similar. Hope this helps. Thanks, Rajesh "Sumant " <stal_yaji2002(a)yahoo.co.in> wrote in message news:hj9n8c$6sl$1(a)fred.mathworks.com... > Dear all, > > I have a simulink model which refers one more model inside. I want to run > this model using PCT in different workers. However i have realized that > there are some data concurrency issues while running this model in > different workers. so i have generated a code as mentioned in the support > documentation 'Resolve Data concurrency issues'. > The code looks like this: > function x = parsim(modelname, k,j) > > Value = 10:10:70; > Val = 10:10:40; > spmdrun %function to extract variables in each workspace > TestVar2 = Value(k); > TestVar3 = Val(j); > > cwd = pwd; > addpath(cwd) > tmpdir = tempname; > mkdir(tmpdir) > cd(tmpdir) > load_system(modelname) > options = simset('SrcWorkspace', 'current'); > x = sim(modelname,[0 100], options); > cd(cwd) > rmdir(tmpdir,'s') > rmpath(cwd) > > This function is called under parfor command in a matlabpool: > matlabpool open local 4 > tic > %addpath Z:\test\testpath > parfor k=1:7 > for j=1:4 > x{k} = parsim('TestPar_parfor', k,j); > end > end > toc > matlabpool close > Now when I execute this code the simulation starts but i get an error once > it starts updating the model which is being refferred. the error reads: > ''Real-Time Workshop build procedure for model: 'testmodel' aborted due to > an error''. > > Is this the error due to the code that i have written ?? > or Is it from the model itself..?? > > I would really appreciate if anyone could help me regarding this. > > Thanks > > Sumant
From: Sumant on 22 Jan 2010 06:12 Hi Rajesh, Thats correct. The workers are not able to read the variables of the referenced model. As mentioned i also tried assigning the variables using assignin command in a function and introducing this function in the parfor loop. But the workers are not able to read the variables. for example the code for the variables: function variables assignin('caller','var','Varvalue') .. .. .. Could you please explain me as to how to proceed further, on assigning variables to the referenced model so that the variables are called by the workers. Thanks Sumant "Rajesh Pavan Sunkari" <rsunkari(a)mathworks.com> wrote in message <hjaf30$19j$1(a)fred.mathworks.com>... > Hi, > > > > It is best to use rapid accelerator mode to run parallel simulation. The > Simulink documentation has a section on running parallel simulations which > has more details. > > > > Regarding the error, it appears some model is being referenced and that > seems to be failing to build as part of compilation. One common reason for > this could be that the reference model is using some data that is not > available on the worker. Hence all the data that is required should be > transferred to the workers (from the host machine) by using an assignin > command or something similar. > > > > Hope this helps. > > > > Thanks, > > Rajesh > > > > > > "Sumant " <stal_yaji2002(a)yahoo.co.in> wrote in message > news:hj9n8c$6sl$1(a)fred.mathworks.com... > > Dear all, > > > > I have a simulink model which refers one more model inside. I want to run > > this model using PCT in different workers. However i have realized that > > there are some data concurrency issues while running this model in > > different workers. so i have generated a code as mentioned in the support > > documentation 'Resolve Data concurrency issues'. > > The code looks like this: > > function x = parsim(modelname, k,j) > > > > Value = 10:10:70; > > Val = 10:10:40; > > spmdrun %function to extract variables in each workspace > > TestVar2 = Value(k); > > TestVar3 = Val(j); > > > > cwd = pwd; > > addpath(cwd) > > tmpdir = tempname; > > mkdir(tmpdir) > > cd(tmpdir) > > load_system(modelname) > > options = simset('SrcWorkspace', 'current'); > > x = sim(modelname,[0 100], options); > > cd(cwd) > > rmdir(tmpdir,'s') > > rmpath(cwd) > > > > This function is called under parfor command in a matlabpool: > > matlabpool open local 4 > > tic > > %addpath Z:\test\testpath > > parfor k=1:7 > > for j=1:4 > > x{k} = parsim('TestPar_parfor', k,j); > > end > > end > > toc > > matlabpool close > > Now when I execute this code the simulation starts but i get an error once > > it starts updating the model which is being refferred. the error reads: > > ''Real-Time Workshop build procedure for model: 'testmodel' aborted due to > > an error''. > > > > Is this the error due to the code that i have written ?? > > or Is it from the model itself..?? > > > > I would really appreciate if anyone could help me regarding this. > > > > Thanks > > > > Sumant >
|
Pages: 1 Prev: Cannot load .asc file Next: box constraint in svmtrain |