Commit 16a6eb64 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Merge pull request #354 from rattoma/master

several bug fixes for cluster computations
parents 2bc167fc c9402d9e
......@@ -457,6 +457,8 @@ if ~exist('OCTAVE_VERSION')
[fout] = masterParallel(options_.parallel, 1, M_.exo_nbr,NamFileInput,'PosteriorIRF_core2', localVars, globalVars, options_.parallel_info);
end
end
else
[fout] = PosteriorIRF_core2(localVars,1,M_.exo_nbr,0);
end
% END parallel code!
......
......@@ -31,6 +31,13 @@ function dyn_saveas(h,fname,DynareOptions)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if any(strcmp('eps',cellstr(DynareOptions.graph_format)))
if exist('OCTAVE_VERSION')
fname = strrep(fname,'/',filesep);
fname = strrep(fname,'\',filesep);
if DynareOptions.nodisplay && ispc,
set(h, 'Visible','on');
end
end
print(h,'-depsc2',[fname,'.eps'])
end
if any(strcmp('pdf',cellstr(DynareOptions.graph_format)))
......
......@@ -392,6 +392,7 @@ options_.mh_autocorrelation_function_size = 30;
options_.plot_priors = 1;
options_.cova_compute = 1;
options_.parallel = 0;
options_.parallel_info.isHybridMatlabOctave = false;
options_.parallel_info.leaveSlaveOpen = 0;
options_.parallel_info.RemoteTmpFolder = '';
options_.number_of_grid_points_for_kde = 2^9;
......
......@@ -189,13 +189,13 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
end
if (si1)
disp(['It is impossibile to be connected to the computer with name "',DataInput(Node).ComputerName,'" using the network!']);
disp(['It is impossibile to ping to the computer with name "',DataInput(Node).ComputerName,'" using the network!']);
disp(' ');
disp('ErrorCode 3.');
ErrorCode=3;
disp(' ');
disp(' ');
return;
% return;
else
disp('Check on ComputerName Variable ..... Ok!');
disp(' ');
......@@ -609,13 +609,13 @@ for Node=1:length(DataInput) % To obtain a recoursive function remove the 'for'
RealCPUnbr='';
% keyboard;
RealCPUnbr=GiveCPUnumber(de0);
RealCPUnbr=GiveCPUnumber(de0,Environment);
% Questo controllo penso che si possa MIGLIORARE!!!!!
if isempty (RealCPUnbr) && Environment==0,
[si0 de0]=system(['psinfo \\',DataInput(Node).ComputerName]);
end
RealCPUnbr=GiveCPUnumber(de0);
RealCPUnbr=GiveCPUnumber(de0,Environment);
if isempty (RealCPUnbr)
% An error occurred when we try to know the Cpu/Cores
......
function [nCPU]= GiveCPUnumber (ComputerInformations)
function [nCPU]= GiveCPUnumber (ComputerInformations, Environment)
% PARALLEL CONTEXT
% In a parallel context this function return the CPUs or cores numer avaiable
% on the computer used for run parallel code.
......@@ -33,13 +33,13 @@ function [nCPU]= GiveCPUnumber (ComputerInformations)
nCPU='';
Enviroment=-1;
if nargin < 2,
% Determine a specific operating system or software version when necessary
% for different command (sintax, name, ...).
Enviroment=~ispc; %isunix || (~matlab_ver_less_than('7.4') && ismac);
Environment=~ispc; %isunix || (~matlab_ver_less_than('7.4') && ismac);
end
switch Enviroment
switch Environment
case 0 %WINDOWS OPERATING SYSTEM
OffSet=27;
......
......@@ -45,6 +45,7 @@ end
global options_
isHybridMatlabOctave = false;
for j=1:length(options_.parallel),
if isempty(options_.parallel(j).MatlabOctavePath),
if exist('OCTAVE_VERSION')
......@@ -57,6 +58,13 @@ for j=1:length(options_.parallel),
dynareroot = strrep(which('dynare'),'dynare.m','');
options_.parallel(j).DynarePath=dynareroot;
end
isHybridMatlabOctave = isHybridMatlabOctave || any(regexpi([options_.parallel(j).MatlabOctavePath], 'octave'));
end
isHybridMatlabOctave = isHybridMatlabOctave && ~exist('OCTAVE_VERSION');
options_.parallel_info.isHybridMatlabOctave = isHybridMatlabOctave;
if isHybridMatlabOctave,
% Reset dynare random generator and seed.
set_dynare_seed('default');
end
......
......@@ -47,6 +47,12 @@ for indPC=1:length(Parallel),
end
if check ~= 0 || ~isempty(strfind(ax,'No such file or directory'));
ax=[];
else
indax=regexp(ax,'\n');
colax=indax(1);
rowax=length(indax);
ax=reshape(ax',[colax rowax])';
ax=ax(:,1:end-1);
end
else
......@@ -67,7 +73,6 @@ for indPC=1:length(Parallel),
end
end
dirlist = char(dirlist, ax);
else
if exist('OCTAVE_VERSION'), % Patch for peculiar behaviour of ls under Windows.
if Parallel(indPC).Local==0,
......@@ -92,6 +97,10 @@ for indPC=1:length(Parallel),
ax=ls(filename);
end
end
end
if isempty(dirlist),
dirlist=ax;
elseif ~isempty(ax),
dirlist = char(dirlist, ax);
end
end
......@@ -47,6 +47,7 @@ for indPC=1:length(Parallel),
end
if ~isempty(NewFilesFromSlaves)
pause(1);
for i=1:length(NewFilesFromSlaves)
SlashNumberAndPosition=[];
......
This diff is collapsed.
......@@ -24,7 +24,7 @@ if ~nargin
error('set_dynare_seed:: I need at least one input argument!')
end
matlab_random_streams = ~(exist('OCTAVE_VERSION') || matlab_ver_less_than('7.7'));
matlab_random_streams = ~(exist('OCTAVE_VERSION') || matlab_ver_less_than('7.7') || options_.parallel_info.isHybridMatlabOctave);
if matlab_random_streams% Use new matlab interface.
if nargin==1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment