parent
1021e43d47
commit
55764e667f
|
@ -18,6 +18,10 @@ function prior_posterior_statistics(type,Y,gend,data_index,missing_value)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
|
% PARALLEL CONTEXT
|
||||||
|
% See the comments random_walk_metropolis_hastings.m funtion.
|
||||||
|
|
||||||
|
|
||||||
% Copyright (C) 2005-2010 Dynare Team
|
% Copyright (C) 2005-2010 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
|
@ -142,7 +146,7 @@ end
|
||||||
|
|
||||||
% Store the variable mandatory for local/remote parallel computing.
|
% Store the variable mandatory for local/remote parallel computing.
|
||||||
|
|
||||||
localVars.typee=type;
|
localVars.type=type;
|
||||||
localVars.run_smoother=run_smoother;
|
localVars.run_smoother=run_smoother;
|
||||||
localVars.gend=gend;
|
localVars.gend=gend;
|
||||||
localVars.Y=Y;
|
localVars.Y=Y;
|
||||||
|
@ -158,6 +162,8 @@ localVars.iendo=iendo;
|
||||||
if horizon
|
if horizon
|
||||||
localVars.i_last_obs=i_last_obs;
|
localVars.i_last_obs=i_last_obs;
|
||||||
localVars.IdObs=IdObs;
|
localVars.IdObs=IdObs;
|
||||||
|
localVars.MAX_nforc1=MAX_nforc1;
|
||||||
|
localVars.MAX_nforc2=MAX_nforc2;
|
||||||
end
|
end
|
||||||
localVars.exo_nbr=exo_nbr;
|
localVars.exo_nbr=exo_nbr;
|
||||||
localVars.maxlag=maxlag;
|
localVars.maxlag=maxlag;
|
||||||
|
@ -168,10 +174,6 @@ if naK
|
||||||
localVars.MAX_naK=MAX_naK;
|
localVars.MAX_naK=MAX_naK;
|
||||||
end
|
end
|
||||||
localVars.MAX_nruns=MAX_nruns;
|
localVars.MAX_nruns=MAX_nruns;
|
||||||
if horizon
|
|
||||||
localVars.MAX_nforc1=MAX_nforc1;
|
|
||||||
localVars.MAX_nforc2=MAX_nforc2;
|
|
||||||
end
|
|
||||||
localVars.MAX_momentsno = MAX_momentsno;
|
localVars.MAX_momentsno = MAX_momentsno;
|
||||||
localVars.ifil=ifil;
|
localVars.ifil=ifil;
|
||||||
|
|
||||||
|
@ -191,10 +193,10 @@ end
|
||||||
|
|
||||||
b=0;
|
b=0;
|
||||||
|
|
||||||
|
% Like sequential execution!
|
||||||
|
if isnumeric(options_.parallel),% | isunix, % For the moment exclude unix platform from parallel implementation!
|
||||||
if isnumeric(options_.parallel),% | isunix, % for the moment exclude unix platform from parallel implementation
|
|
||||||
[fout] = prior_posterior_statistics_core(localVars,1,B,0);
|
[fout] = prior_posterior_statistics_core(localVars,1,B,0);
|
||||||
|
% Parallel execution!
|
||||||
else
|
else
|
||||||
[nCPU, totCPU, nBlockPerCPU] = distributeJobs(options_.parallel, 1, B);
|
[nCPU, totCPU, nBlockPerCPU] = distributeJobs(options_.parallel, 1, B);
|
||||||
for j=1:totCPU-1,
|
for j=1:totCPU-1,
|
||||||
|
@ -252,7 +254,8 @@ save([DirectoryName '/' M_.fname '_data.mat'],'stock_gend','stock_data');
|
||||||
if ~isnumeric(options_.parallel),
|
if ~isnumeric(options_.parallel),
|
||||||
leaveSlaveOpen = options_.parallel_info.leaveSlaveOpen;
|
leaveSlaveOpen = options_.parallel_info.leaveSlaveOpen;
|
||||||
if options_.parallel_info.leaveSlaveOpen == 0,
|
if options_.parallel_info.leaveSlaveOpen == 0,
|
||||||
options_.parallel_info.leaveSlaveOpen = 1; % force locally to leave open remote matlab sessions (repeated pm3 calls)
|
% Commenting for testing!
|
||||||
|
% options_.parallel_info.leaveSlaveOpen = 1; % Force locally to leave open remote matlab sessions (repeated pm3 calls)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,28 @@
|
||||||
function myoutput=prior_posterior_statistics_core(myinputs,fpar,B,whoiam, ThisMatlab)
|
function myoutput=prior_posterior_statistics_core(myinputs,fpar,B,whoiam, ThisMatlab)
|
||||||
|
% PARALLEL CONTEXT
|
||||||
% Copyright (C) 2005-2010 Dynare Team
|
% Core functionality for prior_posterior.m function, which can be parallelized.
|
||||||
|
% See also the comment in random_walk_metropolis_hastings_core.m funtion.
|
||||||
%
|
%
|
||||||
|
% INPUTS
|
||||||
|
% See See the comment in random_walk_metropolis_hastings_core.m funtion.
|
||||||
|
|
||||||
|
% OUTPUTS
|
||||||
|
% o myoutput [struc]
|
||||||
|
% Contained OutputFileName_smooth;
|
||||||
|
% _update;
|
||||||
|
% _inno;
|
||||||
|
% _error;
|
||||||
|
% _filter_step_ahead;
|
||||||
|
% _param;
|
||||||
|
% _forc_mean;
|
||||||
|
% _forc_point
|
||||||
|
%
|
||||||
|
% ALGORITHM
|
||||||
|
% Portion of prior_posterior.m function.
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
% SPECIAL REQUIREMENTS.
|
||||||
|
% None.
|
||||||
% Dynare is free software: you can redistribute it and/or modify
|
% Dynare is free software: you can redistribute it and/or modify
|
||||||
% it under the terms of the GNU General Public License as published by
|
% it under the terms of the GNU General Public License as published by
|
||||||
% the Free Software Foundation, either version 3 of the License, or
|
% the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -23,7 +42,14 @@ if nargin<4,
|
||||||
whoiam=0;
|
whoiam=0;
|
||||||
end
|
end
|
||||||
|
|
||||||
typee=myinputs.typee;
|
global options_ oo_ M_ bayestopt_ estim_params_
|
||||||
|
|
||||||
|
|
||||||
|
% Reshape 'myinputs' for local computation.
|
||||||
|
% In order to avoid confusion in the name space, the instruction struct2local(myinputs) is replaced by:
|
||||||
|
|
||||||
|
% Da CONTROLLARE con MARCO!
|
||||||
|
type=myinputs.type;
|
||||||
run_smoother=myinputs.run_smoother;
|
run_smoother=myinputs.run_smoother;
|
||||||
gend=myinputs.gend;
|
gend=myinputs.gend;
|
||||||
Y=myinputs.Y;
|
Y=myinputs.Y;
|
||||||
|
@ -39,27 +65,31 @@ iendo=myinputs.iendo;
|
||||||
if horizon
|
if horizon
|
||||||
i_last_obs=myinputs.i_last_obs;
|
i_last_obs=myinputs.i_last_obs;
|
||||||
IdObs=myinputs.IdObs;
|
IdObs=myinputs.IdObs;
|
||||||
|
MAX_nforc1=myinputs.MAX_nforc1;
|
||||||
|
MAX_nforc2=myinputs.MAX_nforc2;
|
||||||
end
|
end
|
||||||
|
if naK
|
||||||
|
MAX_naK=myinputs.MAX_naK;
|
||||||
|
end
|
||||||
|
|
||||||
exo_nbr=myinputs.exo_nbr;
|
exo_nbr=myinputs.exo_nbr;
|
||||||
maxlag=myinputs.maxlag;
|
maxlag=myinputs.maxlag;
|
||||||
MAX_nsmoo=myinputs.MAX_nsmoo;
|
MAX_nsmoo=myinputs.MAX_nsmoo;
|
||||||
MAX_ninno=myinputs.MAX_ninno;
|
MAX_ninno=myinputs.MAX_ninno;
|
||||||
MAX_nerro =myinputs. MAX_nerro;
|
MAX_nerro = myinputs.MAX_nerro;
|
||||||
if naK
|
|
||||||
MAX_naK=myinputs.MAX_naK;
|
|
||||||
end
|
|
||||||
MAX_nruns=myinputs.MAX_nruns;
|
MAX_nruns=myinputs.MAX_nruns;
|
||||||
if horizon
|
MAX_momentsno = myinputs.MAX_momentsno;
|
||||||
MAX_nforc1=myinputs.MAX_nforc1;
|
|
||||||
MAX_nforc2=myinputs.MAX_nforc2;
|
|
||||||
end
|
|
||||||
MAX_momentsno =myinputs. MAX_momentsno;
|
|
||||||
ifil=myinputs.ifil;
|
ifil=myinputs.ifil;
|
||||||
|
|
||||||
if ~strcmpi(typee,'prior'),
|
if ~strcmpi(type,'prior'),
|
||||||
x=myinputs.x;
|
x=myinputs.x;
|
||||||
logpost=myinputs.logpost;
|
logpost=myinputs.logpost;
|
||||||
end
|
end
|
||||||
|
if whoiam
|
||||||
|
Parallel=myinputs.Parallel;
|
||||||
|
MasterName=myinputs.MasterName;
|
||||||
|
DyMo=myinputs.DyMo;
|
||||||
|
end
|
||||||
|
|
||||||
DirectoryName = CheckPath('metropolis');
|
DirectoryName = CheckPath('metropolis');
|
||||||
|
|
||||||
|
@ -97,12 +127,12 @@ end
|
||||||
|
|
||||||
for b=fpar:B
|
for b=fpar:B
|
||||||
|
|
||||||
% [deep, logpo] = GetOneDraw(typee);
|
% [deep, logpo] = GetOneDraw(type);
|
||||||
% set_all_parameters(deep);
|
% set_all_parameters(deep);
|
||||||
% dr = resol(oo_.steady_state,0);
|
% dr = resol(oo_.steady_state,0);
|
||||||
if strcmpi(typee,'prior')
|
if strcmpi(type,'prior')
|
||||||
|
|
||||||
[deep, logpo] = GetOneDraw(typee);
|
[deep, logpo] = GetOneDraw(type);
|
||||||
|
|
||||||
else
|
else
|
||||||
deep = x(b,:);
|
deep = x(b,:);
|
||||||
|
@ -171,12 +201,6 @@ for b=fpar:B
|
||||||
|
|
||||||
irun = irun + ones(7,1);
|
irun = irun + ones(7,1);
|
||||||
|
|
||||||
%
|
|
||||||
% TempPath=DirectoryName;
|
|
||||||
% DirectoryNamePar='C:\dynare_calcs\ModelTest\ls2003\metropolis'
|
|
||||||
% DirectoryName=DirectoryNamePar;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if irun(1) > MAX_nsmoo || b == B
|
if irun(1) > MAX_nsmoo || b == B
|
||||||
stock = stock_smooth(:,:,1:irun(1)-1);
|
stock = stock_smooth(:,:,1:irun(1)-1);
|
||||||
|
|
Loading…
Reference in New Issue