diff --git a/matlab/AnalyseComputationalEnviroment.m b/matlab/AnalyseComputationalEnviroment.m index 3453e1cc089266fce580c95621363ea94a94dee4..949b89dfa31fb1a4fdbe681ea2a8c4e80957b0ef 100644 --- a/matlab/AnalyseComputationalEnviroment.m +++ b/matlab/AnalyseComputationalEnviroment.m @@ -59,7 +59,7 @@ function [ErrorCode] = AnalyseComputationalEnviroment(DataInput) % Then at the point call of this function it is possible react in a best way, in accord % with the ErrorCode. -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2009-2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/DiffuseKalmanSmoother1.m b/matlab/DiffuseKalmanSmoother1.m index f23f9de7adb63efd2df72cc1fe30e9267de1979a..940befdeb8ef57df82aeebea3a7cea4029a0ac33 100644 --- a/matlab/DiffuseKalmanSmoother1.m +++ b/matlab/DiffuseKalmanSmoother1.m @@ -27,7 +27,7 @@ function [alphahat,etahat,atilde, aK] = DiffuseKalmanSmoother1(T,R,Q,Pinf1,Pstar % Models", S.J. Koopman and J. Durbin (2003, in Journal of Time Series % Analysis, vol. 24(1), pp. 85-98). -% Copyright (C) 2004-2008 Dynare Team +% Copyright (C) 2004-2008,2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/GiveCPUnumber.m b/matlab/GiveCPUnumber.m index ba11bfab1e04cffff92ff84c06e383fa8d5def15..2809d1696130c6999192aeda6399e10642104d32 100644 --- a/matlab/GiveCPUnumber.m +++ b/matlab/GiveCPUnumber.m @@ -1,58 +1,56 @@ -function [nCPU]= GiveCPUnumber (ComputerInformations) - -% DESCRIPTION -% This function return the CPUs or cores numer avaiable -% on the computer used for run parallel code. - -% INPUTS -% an array contained several fields that describe the hardaware -% software enviroments of a generic computer. -% -% OUTPUTS -% The CPUs or Cores numbers of computer. -% -% SPECIAL REQUIREMENTS -% none - -% Copyright (C) 2005-2009 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see <http://www.gnu.org/licenses/>. - - -nCPU=-1; - -OffSet=27; - -SringPosition=strfind(ComputerInformations, 'Processors:'); -nCPU=ComputerInformations(SringPosition+OffSet); - -% We check if there are Processors/Cores more than 9. - - - t0=ComputerInformations(SringPosition+OffSet+1); - t1=str2num(t0); - t1=isempty(t1); - - % if t1 is 0 the machine have more than 9 CPU. - - if t1==0 - nCPU=strcat(nCPU,t0); - end - - nCPU=str2num(nCPU); - - return - \ No newline at end of file +function [nCPU]= GiveCPUnumber (ComputerInformations) +% DESCRIPTION +% This function return the CPUs or cores numer avaiable +% on the computer used for run parallel code. +% +% INPUTS +% an array contained several fields that describe the hardaware +% software enviroments of a generic computer. +% +% OUTPUTS +% The CPUs or Cores numbers of computer. +% +% SPECIAL REQUIREMENTS +% none + +% Copyright (C) 2010 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + + +nCPU=-1; + +OffSet=27; + +SringPosition=strfind(ComputerInformations, 'Processors:'); +nCPU=ComputerInformations(SringPosition+OffSet); + +% We check if there are Processors/Cores more than 9. + + +t0=ComputerInformations(SringPosition+OffSet+1); +t1=str2num(t0); +t1=isempty(t1); + +% if t1 is 0 the machine have more than 9 CPU. + +if t1==0 + nCPU=strcat(nCPU,t0); +end + +nCPU=str2num(nCPU); + +return diff --git a/matlab/McMCDiagnostics.m b/matlab/McMCDiagnostics.m index c90b674649786e14bfe12ae9286ef903a47bae54..5763d8ed1353cc85a21aaafe45a381404b528e5a 100644 --- a/matlab/McMCDiagnostics.m +++ b/matlab/McMCDiagnostics.m @@ -13,7 +13,7 @@ function McMCDiagnostics(options_, estim_params_, M_) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2005-2008 Dynare Team +% Copyright (C) 2005-2008,2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/PosteriorIRF.m b/matlab/PosteriorIRF.m index 47548110dd3bfa54e186bd652a07cd80f5005087..4431e79dd33180b399670f94f2185528a399c59b 100644 --- a/matlab/PosteriorIRF.m +++ b/matlab/PosteriorIRF.m @@ -11,7 +11,7 @@ function PosteriorIRF(type) % SPECIAL REQUIREMENTS % None -% Copyright (C) 2006-2008 Dynare Team +% Copyright (C) 2006-2008,2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/PosteriorIRF_core1.m b/matlab/PosteriorIRF_core1.m index 27637e63601a7ecb75eead5a588b2f0e8837fd16..9d376ae8fe6a98eb16b05e7b7276035398d1e043 100644 --- a/matlab/PosteriorIRF_core1.m +++ b/matlab/PosteriorIRF_core1.m @@ -12,7 +12,7 @@ function myoutput=PosteriorIRF_core1(myinputs,fpar,npar,whoiam, ThisMatlab) % SPECIAL REQUIREMENTS % None -% Copyright (C) 2006-2008 Dynare Team +% Copyright (C) 2006-2008,2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/PosteriorIRF_core2.m b/matlab/PosteriorIRF_core2.m index 2a8846b6356d546be7ec544bd59e56ea249ac95f..0f1e330467506f86130ce7e06cb6a6d80ea0069d 100644 --- a/matlab/PosteriorIRF_core2.m +++ b/matlab/PosteriorIRF_core2.m @@ -1,5 +1,22 @@ function myoutput=PosteriorIRF_core2(myinputs,fpar,npar,whoiam, ThisMatlab) +% Copyright (C) 2006-2008,2010 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + global options_ M_ if nargin<4, diff --git a/matlab/ReshapeMatFiles.m b/matlab/ReshapeMatFiles.m index 950958e02cee4e7d7b70a930d005d0bbecf0b295..09217c1c59861670ef8062782b589b77228d6f89 100644 --- a/matlab/ReshapeMatFiles.m +++ b/matlab/ReshapeMatFiles.m @@ -25,7 +25,7 @@ function ReshapeMatFiles(type, type2) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2003-2007 Dynare Team +% Copyright (C) 2003-2007,2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/Tracing.m b/matlab/Tracing.m index e3814552f96bc123c36076e95837177715d9af8b..7d0e947c9772fe09098cd1d1fc3ce86a224ae7d5 100644 --- a/matlab/Tracing.m +++ b/matlab/Tracing.m @@ -1,40 +1,37 @@ -function [] = Tracing() - -% DESCRIPTION -% This function is used to test the correct execution of a matlab section -% on remote machine. -% -% If no error happen the function simply create a file. - -% INPUTS -% ... -% -% OUTPUTS -% ... -% -% SPECIAL REQUIREMENTS -% none - -% Copyright (C) 2005-2009 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see <http://www.gnu.org/licenses/>. - - - fid = fopen('Tracing.txt','w+'); - fclose (fid); - -exit - +function [] = Tracing() +% DESCRIPTION +% This function is used to test the correct execution of a matlab section +% on remote machine. +% +% If no error happen the function simply create a file. +% +% INPUTS +% ... +% +% OUTPUTS +% ... +% +% SPECIAL REQUIREMENTS +% none + +% Copyright (C) 2010 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +fid = fopen('Tracing.txt','w+'); +fclose (fid); + +exit diff --git a/matlab/closeSlave.m b/matlab/closeSlave.m index 8615606b60d441e347283afd97b6a436e7086923..150127ada09dfb25faeda5112eba0cbe3fcf3776 100644 --- a/matlab/closeSlave.m +++ b/matlab/closeSlave.m @@ -1,14 +1,31 @@ -function closeSlave(Parallel), -% In a parallelc context, this utility closes all remote matlab instances -% called by masteParallelMan (which leaves open remote matlab instances) - -delete( 'slaveParallel_input*.mat'); -for indPC=1:length(Parallel), - if Parallel(indPC).Local==0, - if isunix || (~matlab_ver_less_than('7.4') && ismac), - system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' rm -fr ',Parallel(indPC).RemoteFolder,'/slaveParallel_input*.mat']); - else - mydelete('slaveParallel_input*.mat',['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\']); - end - end -end +function closeSlave(Parallel), +% In a parallelc context, this utility closes all remote matlab instances +% called by masteParallelMan (which leaves open remote matlab instances) + +% Copyright (C) 2010 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +delete( 'slaveParallel_input*.mat'); +for indPC=1:length(Parallel), + if Parallel(indPC).Local==0, + if isunix || (~matlab_ver_less_than('7.4') && ismac), + system(['ssh ',Parallel(indPC).user,'@',Parallel(indPC).PcName,' rm -fr ',Parallel(indPC).RemoteFolder,'/slaveParallel_input*.mat']); + else + mydelete('slaveParallel_input*.mat',['\\',Parallel(indPC).PcName,'\',Parallel(indPC).RemoteDrive,'$\',Parallel(indPC).RemoteFolder,'\']); + end + end +end diff --git a/matlab/distributeJobs.m b/matlab/distributeJobs.m index 492f47cd8862b19fa5022cc8cee4b6a63c115aae..3ef9b0d93933ada1261235ed24441c7ecfb70f4b 100644 --- a/matlab/distributeJobs.m +++ b/matlab/distributeJobs.m @@ -1,37 +1,36 @@ -function [nCPU, totCPU, nBlockPerCPU] = distributeJobs(Parallel, fBlock, nBlock) - -% Determine the total number of available CPUs, and the number of threads to run on each CPU - -% Copyright (C) 2009 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see <http://www.gnu.org/licenses/>. - -totCPU=0; -for j=1:length(Parallel), - nCPU(j)=length(Parallel(j).NumCPU); - totCPU=totCPU+nCPU(j); -end - -nCPU=cumsum(nCPU); -offset0 = fBlock-1; -if (nBlock-offset0)>totCPU, - diff = mod((nBlock-offset0),totCPU); - nBlockPerCPU(1:diff) = ceil((nBlock-offset0)/totCPU); - nBlockPerCPU(diff+1:totCPU) = floor((nBlock-offset0)/totCPU); -else - nBlockPerCPU(1:nBlock-offset0)=1; - totCPU = nBlock-offset0; -end +function [nCPU, totCPU, nBlockPerCPU] = distributeJobs(Parallel, fBlock, nBlock) +% Determine the total number of available CPUs, and the number of threads to run on each CPU + +% Copyright (C) 2010 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. + +totCPU=0; +for j=1:length(Parallel), + nCPU(j)=length(Parallel(j).NumCPU); + totCPU=totCPU+nCPU(j); +end + +nCPU=cumsum(nCPU); +offset0 = fBlock-1; +if (nBlock-offset0)>totCPU, + diff = mod((nBlock-offset0),totCPU); + nBlockPerCPU(1:diff) = ceil((nBlock-offset0)/totCPU); + nBlockPerCPU(diff+1:totCPU) = floor((nBlock-offset0)/totCPU); +else + nBlockPerCPU(1:nBlock-offset0)=1; + totCPU = nBlock-offset0; +end diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index bff8b85c3dfd5565fa4906fabbe34ed960910ab3..8b8029c7f2e0b8c1eae514d3dc4bba3c388752a0 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -11,7 +11,7 @@ function global_initialization() % SPECIAL REQUIREMENTS % none -% Copyright (C) 2003-2008 Dynare Team +% Copyright (C) 2003-2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/independent_metropolis_hastings.m b/matlab/independent_metropolis_hastings.m index 4aa6916ab2cb760402558e8fba1b580a6bb15757..18a0ec576163244582da523ddb68865fadfe22fa 100644 --- a/matlab/independent_metropolis_hastings.m +++ b/matlab/independent_metropolis_hastings.m @@ -19,7 +19,7 @@ function independent_metropolis_hastings(TargetFun,ProposalFun,xparam1,vv,mh_bou % SPECIAL REQUIREMENTS % None. -% Copyright (C) 2006-2008 Dynare Team +% Copyright (C) 2006-2008,2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/masterParallel.m b/matlab/masterParallel.m index 9b4e698ef348ca6ecd1f949c7afc5fc734ecb087..6343a696cf6354a3eae8e752c4e46d4957d513aa 100644 --- a/matlab/masterParallel.m +++ b/matlab/masterParallel.m @@ -29,7 +29,7 @@ function [fOutVar,nBlockPerCPU, totCPU] = masterParallel(Parallel,fBlock,nBlock, % the number of CPU declared in "Parallel", if % the number of required threads is lower) -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2009-2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/masterParallelMan.m b/matlab/masterParallelMan.m index d4bd67b23c198dc8bb4675ec8c7ce8b17b38ea32..c543a8925ad7f49f6c9f4b8147250e1ec5a9a735 100644 --- a/matlab/masterParallelMan.m +++ b/matlab/masterParallelMan.m @@ -31,7 +31,7 @@ function [fOutVar,nBlockPerCPU, totCPU] = masterParallelMan(Parallel,fBlock,nBlo % the number of CPU declared in "Parallel", if % the number of required threads is lower) -% Copyright (C) 2009 Dynare Team +% Copyright (C) 2009-2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/pm3.m b/matlab/pm3.m index 7c682e4dbc10dea836e8ed65012f9198d9b9e209..9c28c7674d997af6852d253f767aac3c2e5d531f 100644 --- a/matlab/pm3.m +++ b/matlab/pm3.m @@ -1,6 +1,6 @@ function pm3(n1,n2,ifil,B,tit1,tit2,tit3,tit_tex,names1,names2,name3,DirectoryName,var_type) -% Copyright (C) 2007-2009 Dynare Team +% Copyright (C) 2007-2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/pm3_core.m b/matlab/pm3_core.m index 4ab6b40d0cc40fe41199b92bb19ec786607c063d..f7487547fef6b5a91cc21cf934fe50f568a610ce 100644 --- a/matlab/pm3_core.m +++ b/matlab/pm3_core.m @@ -1,5 +1,21 @@ function myoutput=pm3_core(myinputs,fpar,nvar,whoiam, ThisMatlab) +% Copyright (C) 2007-2010 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. if nargin<4, whoiam=0; diff --git a/matlab/prior_posterior_statistics.m b/matlab/prior_posterior_statistics.m index 7c60f7d17d1b0b49d9f652d782b3d8d8b32c3842..6e89773762e2ee43bf0cc658c9061f940f859e94 100644 --- a/matlab/prior_posterior_statistics.m +++ b/matlab/prior_posterior_statistics.m @@ -18,7 +18,7 @@ function prior_posterior_statistics(type,Y,gend,data_index,missing_value) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2005-2009 Dynare Team +% Copyright (C) 2005-2010 Dynare Team % % This file is part of Dynare. % diff --git a/matlab/prior_posterior_statistics_core.m b/matlab/prior_posterior_statistics_core.m index 8be66c9df0c0631517d5b50891f551e07e4c80a9..c7966a0975b2f5ed261714847a0a58d74a96479a 100644 --- a/matlab/prior_posterior_statistics_core.m +++ b/matlab/prior_posterior_statistics_core.m @@ -1,5 +1,21 @@ function myoutput=prior_posterior_statistics_core(myinputs,fpar,B,whoiam, ThisMatlab) +% Copyright (C) 2005-2010 Dynare Team +% +% This file is part of Dynare. +% +% Dynare is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% Dynare is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with Dynare. If not, see <http://www.gnu.org/licenses/>. if nargin<4, whoiam=0; diff --git a/matlab/random_walk_metropolis_hastings.m b/matlab/random_walk_metropolis_hastings.m index 825998d410997f448fb4b3fe7b8feb221aef400d..236ae898caf86298b6c3bc3deffb4a6ac9aa693d 100644 --- a/matlab/random_walk_metropolis_hastings.m +++ b/matlab/random_walk_metropolis_hastings.m @@ -19,7 +19,7 @@ function random_walk_metropolis_hastings(TargetFun,ProposalFun,xparam1,vv,mh_bou % SPECIAL REQUIREMENTS % None. -% Copyright (C) 2006-2008 Dynare Team +% Copyright (C) 2006-2008,2010 Dynare Team % % This file is part of Dynare. %