Added test function for parallel routines.

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2711 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
ratto 2009-05-28 08:07:12 +00:00
parent 63232d540a
commit 5c2b1a2aae
2 changed files with 197 additions and 0 deletions

100
tests/parallel/data_ca1.m Normal file
View File

@ -0,0 +1,100 @@
data = [0.928467646476 11.8716889412 20 0.418037507392 0.227382377518 ...
-0.705994063083 11.7522582094 21.25 1.09254424511 -1.29488274994 ...
-0.511895351926 9.68144025625 17.25 -1.66150408407 0.331508393098 ...
-0.990955971267 10.0890781236 17 1.43016275252 -2.43589670141 ...
-0.981233061806 12.1094840679 18.25 2.91293288733 -0.790246576864 ...
-0.882182844512 8.54559460406 15 0.419579139481 0.358729719566 ...
-0.930893002836 6.19238374422 12.5 -1.48847457959 0.739779938797 ...
1.53158206947 2.76544271886 11.5 -0.336216769682 0.455559918769 ...
2.2659052834 5.47418162513 11 0.306436789767 -0.0707985731221 ...
1.05419803797 6.35698426189 11 0.140700250477 0.620401487202 ...
1.20161076793 3.4253301593 11 0.461296492351 0.14354323987 ...
1.73934077971 4.70926070322 11.5 1.35798282982 0.38564694435 ...
1.71735262584 3.54232079749 12.5 2.9097529155 -0.804308583301 ...
0.426343657844 3.32719108897 13 1.64214862652 -1.18214664701 ...
1.67751812324 2.93444727338 11.25 0.344434910651 -1.6529373719 ...
1.37013301099 4.72303361923 11.75 2.61511526582 0.327684243041 ...
0.281231073781 4.4893853071 10.5 1.17043449257 1.12855106649 ...
1.53638992834 3.7325309699 10.25 -0.683947046728 0.11943538737 ...
1.68081431462 3.34729969129 10 1.41159342106 -1.59065680853 ...
-0.343321601133 5.05563513564 12 1.75117366498 -2.40127764642 ...
0.873415608666 3.2779996255 10.25 -1.39895866711 0.0971444398216 ...
0.26399696544 4.78229419828 9.75 0.0914692438124 0.299310457612 ...
-0.562233624818 3.88598638237 9.75 -0.0505384765105 0.332826708151 ...
2.15161914936 3.84859710132 8.75 -3.44811080489 0.789138678784 ...
1.2345093726 5.62225030942 9.5 -0.366945407434 2.32974981198 ...
1.62554967459 4.24667132831 10 -0.800958371402 0.0293183770935 ...
1.33035402527 2.75248979249 9.75 -0.855723113225 0.852493939813 ...
1.52078814077 3.53415985826 9.75 -3.37963469203 -1.05133958119 ...
1.16704983697 4.92754079464 10.75 -3.0142303324 0.459907431978 ...
0.277213572101 4.55532133037 11.75 -0.851995599415 2.03242034852 ...
0.842215068977 3.11164509647 12.25 -1.08290421696 0.014323281961 ...
1.05325028606 4.92882647578 13.5 -1.1953883867 0.706764750654 ...
0.453051253568 6.82998950103 13.5 0.111803656462 0.088462593153 ...
0.199885995525 5.82643354662 13.5 -0.920501518421 -0.26504958666 ...
0.137907999624 2.66076369132 13.5 -1.17122929812 -0.995642430514 ...
0.721949686709 5.70497876823 14.25 1.19378169018 -1.10644839651 ...
-0.418465249225 3.75861110232 14.75 -1.03131674824 0.188507675831 ...
-0.644028342116 4.15104788154 13.75 -1.48911756546 0.204560913792 ...
-0.848213852668 5.65580324027 12.75 0.677011703877 -0.849628054542 ...
-1.51954076928 11.4866911266 11.25 -0.446024680774 -0.456342350765 ...
0.265275055215 2.85472749592 9.75 -0.598778202436 -0.907311640831 ...
0.356162529063 2.29614015658 9.5 -0.46820788432 -1.22130883441 ...
0.368308864363 -0.539083504685 8 -0.781333991956 0.374007246518 ...
-0.145751412732 1.61507621789 8.25 3.68291932628 1.32438399845 ...
0.285457283664 2.14334055993 7 1.42819405379 -0.00818660844123 ...
0.372390129412 1.60000213334 6.25 0.626106424052 -0.10136772765 ...
0.382720203063 1.72614243263 7.25 4.89631941021 -1.10060711916 ...
0.737957515573 2.90430582851 6 -0.0422721010314 0.4178952497 ...
0.649532581668 0.657135682543 6 0.692066153971 0.422299120276 ...
0.627159201987 1.70352689913 5.75 2.62066711305 -1.29237304034 ...
0.905441299817 1.95663197267 5.5 1.5949697565 -0.27115830703 ...
1.49322577898 -2.08741765309 6.25 1.23027694802 0.418336889527 ...
1.48750731567 -1.57274121871 8 3.01660550994 -0.893958254365 ...
1.39783858087 2.22623066426 7 -0.80842319214 1.47625453886 ...
0.89274836317 1.30378081742 8 -0.249485058661 0.159871204185 ...
0.920652246088 4.1437741965 9.75 2.8204453623 0.178149239655 ...
-0.00264276644799 3.07989972052 8.75 -2.56342461535 2.105998353 ...
0.0198190461681 0.766283759256 8 -1.15838865989 1.56888883418 ...
0.440050515311 0.127570085801 7.5 0.0400753569995 0.028914333532 ...
0.129536637901 1.78174141526 6.75 0.959943962785 0.307781224401 ...
0.398549827172 3.03606770667 6.5 -0.340209794742 0.100979469478 ...
1.17174775425 0.629625188037 5.75 0.403003686814 0.902394579377 ...
0.991163981251 2.50862910684 4.75 -1.44963996982 1.16150986945 ...
0.967603566096 2.12003739013 4.75 0.610846030775 -0.889994896068 ...
1.14689383604 1.24185011459 4.75 2.01098091308 -1.73846431001 ...
1.32593824054 0.990713820685 4.75 -0.0955142989332 -0.0369257308362 ...
0.861135002644 -0.24744943605 6 1.72793107135 -0.691506789639 ...
1.26870850151 2.09844764887 6.5 1.50720217572 -1.31399187077 ...
0.260364987715 1.10650139716 6.5 1.13659047496 0.0720441664643 ...
1.09731242214 0.490796381346 7.25 4.59123894147 -2.14073070763 ...
1.63792841781 0.612652594286 6.75 1.79604605035 -0.644363995357 ...
1.48465576034 0.978295808687 6.75 -2.00753620902 1.39437534964 ...
1.0987608663 4.25212569087 6.25 -2.58901196498 2.56054320803 ...
1.42592178132 2.76984518311 6.25 0.888195752358 1.03114549274 ...
1.52958239462 1.31795955491 6.5 -0.902907564082 -0.0952198893776 ...
1.0170168994 2.14733589918 7 -1.3054866978 2.68803738466 ...
0.723253652257 3.43552889347 7.5 1.8213700853 0.592593586195 ...
1.24720806008 3.87383806577 7.5 0.0522300654168 0.988871238698 ...
0.482531471239 2.67793287032 7.5 2.9693944293 -0.108591166081 ...
0.154056100439 0.927269031704 6.75 0.119222057561 3.30489209451 ...
0.0694865769274 6.65916526788 6.25 0.889014476084 -2.83976849035 ...
-0.121267434867 0.341442615696 5.25 0.323053239216 -3.49289229012 ...
0.726473690375 -3.5423730964 4 2.19149290449 -3.20855054004 ...
1.39271709108 2.63121085718 3.75 0.88406577736 0.75622580197 ...
1.07502077727 5.88578836799 4.25 -2.55088273352 2.89018116374 ...
0.759049251607 4.24703604223 4.5 0.575687665685 -0.388292506167 ...
];
data = reshape(data,5,86)';
y_obs = data(:,1);
pie_obs = data(:,2);
R_obs = data(:,3);
de = data(:,4);
dq = data(:,5);
%Country: Canada
%Sample Range: 1981:2 to 2002:3
%Observations: 86
%Variables: Real GDP Growth [%], Inflation [annualized %], Nom Rate [%],
% Exchange Rate Change [%], Terms of Trade Change [%]

97
tests/parallel/ls2003.mod Normal file
View File

@ -0,0 +1,97 @@
var y y_s R pie dq pie_s de A y_obs pie_obs R_obs;
varexo e_R e_q e_ys e_pies e_A;
parameters psi1 psi2 psi3 rho_R tau alpha rr k rho_q rho_A rho_ys rho_pies;
psi1 = 1.54;
psi2 = 0.25;
psi3 = 0.25;
rho_R = 0.5;
alpha = 0.3;
rr = 2.51;
k = 0.5;
tau = 0.5;
rho_q = 0.4;
rho_A = 0.2;
rho_ys = 0.9;
rho_pies = 0.7;
model(linear);
y = y(+1) - (tau +alpha*(2-alpha)*(1-tau))*(R-pie(+1))-alpha*(tau +alpha*(2-alpha)*(1-tau))*dq(+1) + alpha*(2-alpha)*((1-tau)/tau)*(y_s-y_s(+1))-A(+1);
pie = exp(-rr/400)*pie(+1)+alpha*exp(-rr/400)*dq(+1)-alpha*dq+(k/(tau+alpha*(2-alpha)*(1-tau)))*y+alpha*(2-alpha)*(1-tau)/(tau*(tau+alpha*(2-alpha)*(1-tau)))*y_s;
pie = de+(1-alpha)*dq+pie_s;
R = rho_R*R(-1)+(1-rho_R)*(psi1*pie+psi2*(y+alpha*(2-alpha)*((1-tau)/tau)*y_s)+psi3*de)+e_R;
dq = rho_q*dq(-1)+e_q;
y_s = rho_ys*y_s(-1)+e_ys;
pie_s = rho_pies*pie_s(-1)+e_pies;
A = rho_A*A(-1)+e_A;
y_obs = y-y(-1)+A;
pie_obs = 4*pie;
R_obs = 4*R;
end;
shocks;
var e_R = 1.25^2;
var e_q = 2.5^2;
var e_A = 1.89;
var e_ys = 1.89;
var e_pies = 1.89;
end;
varobs y_obs R_obs pie_obs dq de;
estimated_params;
psi1 , gamma_pdf,1.5,0.5;
psi2 , gamma_pdf,0.25,0.125;
psi3 , gamma_pdf,0.25,0.125;
rho_R ,beta_pdf,0.5,0.2;
alpha ,beta_pdf,0.3,0.1;
rr ,gamma_pdf,2.5,1;
k , gamma_pdf,0.5,0.25;
tau ,gamma_pdf,0.5,0.2;
rho_q ,beta_pdf,0.4,0.2;
rho_A ,beta_pdf,0.5,0.2;
rho_ys ,beta_pdf,0.8,0.1;
rho_pies,beta_pdf,0.7,0.15;
stderr e_R,inv_gamma_pdf,1.2533,0.6551;
stderr e_q,inv_gamma_pdf,2.5066,1.3103;
stderr e_A,inv_gamma_pdf,1.2533,0.6551;
stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
end;
// common syntax for win and unix, for local parallel runs (assuming quad-core):
// all empty fields, except Local and NumCPU
options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
// windows syntax for remote runs (Local=0):
// win passwd has to be typed explicitly!
// RemoteDrive has to be yped explicitly!
// for user, ALSO the group has to be specified, like ISIS\rattoma, i.e. user rattoma in group ISIS
// PcName is the name of the computed in the windows network, i.e. the output of hostname, or the full IP adress
//options_.parallel=struct('Local', 0, 'PcName','iazz9000','NumCPU', [4:6], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
// example to use several remote PC's to build a grid on windows:
//options_.parallel=struct('Local', 0, 'PcName','iazz9000','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(2)=struct('Local', 0, 'PcName','paperino','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'D', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(3)=struct('Local', 0, 'PcName','didietro','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', ppp(1), 'RemoteFolder',ppp(4:end));
//options_.parallel(4)=struct('Local', 0, 'PcName','uasalap29','NumCPU', [0:1], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
//options_.parallel(5)=struct('Local', 0, 'PcName','brigitta','NumCPU', [0:3], 'user','ISIS\azziniv','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
// unix syntax for remote runs (Local=0):
// no passwd and RemoteDrive needed!
// PcName: full IP address or address
//options_.parallel=struct('Local', 0, 'PcName','paperino.jrc.it','NumCPU', [0:3], 'user','rattoma','passwd','', 'RemoteDrive', '', 'RemoteFolder','/home/rattoma/Remote');
// example to combine local and remote runs (on unix):
//options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
//options_.parallel(2)=struct('Local', 0, 'PcName','paperino.jrc.it','NumCPU', [0:3], 'user','rattoma','passwd','', 'RemoteDrive', '', 'RemoteFolder','/home/rattoma/Remote');
// example to combine local and remote runs (on win):
//options_.parallel=struct('Local', 1, 'PcName','','NumCPU', [0:3], 'user','','passwd','','RemoteDrive', '', 'RemoteFolder','');
//options_.parallel(2)=struct('Local', 0, 'PcName','uasalap29','NumCPU', [0:1], 'user','ISIS\rattoma','passwd','****', 'RemoteDrive', 'C', 'RemoteFolder','dynare_calcs\Remote');
estimation(datafile=data_ca1,first_obs=8,nobs=79,mode_compute=0, mode_file=ls2003_mode, mh_nblocks=4,prefilter=1,mh_jscale=0.5,mh_replic=2000);//, load_mh_file);