Block decomposition now compatible with 'use_dll' option
parent
3dd0b0e110
commit
ee05ff6c6a
|
@ -1 +1 @@
|
|||
Subproject commit f098329c74225d68fe84f2a5aa32721c2b76036c
|
||||
Subproject commit ad5e196d3064fd3b431b0a0dd34c66f42b52dbc6
|
|
@ -16,18 +16,18 @@ rho_A = 0.2;
|
|||
rho_ys = 0.9;
|
||||
rho_pies = 0.7;
|
||||
|
||||
@#if !block && !bytecode
|
||||
@#if !block && !bytecode && !use_dll
|
||||
model;
|
||||
@#else
|
||||
@# if block && !bytecode
|
||||
@#elseif block && !bytecode && !use_dll
|
||||
model(block, cutoff=0);
|
||||
@# else
|
||||
@# if !block && bytecode
|
||||
@#elseif !block && bytecode
|
||||
model(bytecode);
|
||||
@# else
|
||||
@#elseif block && bytecode
|
||||
model(block, bytecode, cutoff=0);
|
||||
@# endif
|
||||
@# endif
|
||||
@#elseif !block && use_dll
|
||||
model(use_dll);
|
||||
@#else
|
||||
model(block, use_dll, cutoff=0);
|
||||
@#endif
|
||||
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;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function run_ls2003(block, bytecode, solve_algo, stack_solve_algo)
|
||||
function run_ls2003(block, storage, solve_algo, stack_solve_algo)
|
||||
|
||||
% Copyright (C) 2010-2013 Dynare Team
|
||||
%
|
||||
|
@ -18,13 +18,15 @@ function run_ls2003(block, bytecode, solve_algo, stack_solve_algo)
|
|||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
disp(['TEST: ls2003 (block=' num2str(block) ', bytecode=' ...
|
||||
num2str(bytecode) ', solve_algo=' num2str(solve_algo) ...
|
||||
', stack_solve_algo=' num2str(stack_solve_algo) ')...']);
|
||||
num2str(storage==2) ', use_dll=' num2str(storage==1) ...
|
||||
', solve_algo=' num2str(solve_algo) ...
|
||||
', stack_solve_algo=' num2str(stack_solve_algo) ')...']);
|
||||
fid = fopen('ls2003_tmp.mod', 'w');
|
||||
assert(fid > 0);
|
||||
fprintf(fid, ['@#define block = %d\n@#define bytecode = %d\n' ...
|
||||
'@#define use_dll = %d\n' ...
|
||||
'@#define solve_algo = %d\n@#define stack_solve_algo = %d\n' ...
|
||||
'@#include \"ls2003.mod\"\n'], block, bytecode, ...
|
||||
'@#include \"ls2003.mod\"\n'], block, storage==2, storage==1, ...
|
||||
solve_algo, stack_solve_algo);
|
||||
fclose(fid);
|
||||
dynare('ls2003_tmp.mod','console')
|
||||
|
|
|
@ -40,13 +40,13 @@ cd([top_test_dir filesep 'block_bytecode']);
|
|||
has_optimization_toolbox = user_has_matlab_license('optimization_toolbox');
|
||||
tic;
|
||||
for blockFlag = 0:1
|
||||
for bytecodeFlag = 0:1
|
||||
for storageFlag = 0:2 % 0=M-file, 1=use_dll, 2=bytecode
|
||||
default_solve_algo = 2;
|
||||
default_stack_solve_algo = 0;
|
||||
if ~blockFlag && ~bytecodeFlag
|
||||
if ~blockFlag && storageFlag ~= 2
|
||||
solve_algos = [1:4 9];
|
||||
stack_solve_algos = [0 6];
|
||||
elseif blockFlag && ~bytecodeFlag
|
||||
elseif blockFlag && storageFlag ~= 2
|
||||
solve_algos = [1:4 6:9];
|
||||
stack_solve_algos = 0:4;
|
||||
else
|
||||
|
@ -59,13 +59,13 @@ for blockFlag = 0:1
|
|||
|
||||
for i = 1:length(solve_algos)
|
||||
num_block_tests = num_block_tests + 1;
|
||||
if ~blockFlag && ~bytecodeFlag && (i == 1)
|
||||
if ~blockFlag && storageFlag == 0 && (i == 1)
|
||||
% This is the reference simulation path against which all
|
||||
% other simulations will be tested
|
||||
try
|
||||
old_path = path;
|
||||
save wsMat
|
||||
run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo)
|
||||
run_ls2003(blockFlag, storageFlag, solve_algos(i), default_stack_solve_algo)
|
||||
load wsMat
|
||||
path(old_path);
|
||||
y_ref = oo_.endo_simul;
|
||||
|
@ -73,31 +73,31 @@ for blockFlag = 0:1
|
|||
catch exception
|
||||
load wsMat
|
||||
path(old_path);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
|
||||
clear exception
|
||||
end
|
||||
else
|
||||
try
|
||||
old_path = path;
|
||||
save wsMat
|
||||
run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo)
|
||||
run_ls2003(blockFlag, storageFlag, solve_algos(i), default_stack_solve_algo)
|
||||
load wsMat
|
||||
path(old_path);
|
||||
% Test against the reference simulation path
|
||||
load('test.mat','y_ref');
|
||||
diff = oo_.endo_simul - y_ref;
|
||||
if(abs(diff) > options_.dynatol.x)
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
if abs(diff) > options_.dynatol.x
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
exception = MException('ERROR: simulation path differs from the reference path');
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
|
||||
clear exception
|
||||
end
|
||||
catch exception
|
||||
load wsMat
|
||||
path(old_path);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
|
||||
clear exception
|
||||
end
|
||||
end
|
||||
|
@ -107,23 +107,23 @@ for blockFlag = 0:1
|
|||
try
|
||||
old_path = path;
|
||||
save wsMat
|
||||
run_ls2003(blockFlag, bytecodeFlag, default_solve_algo, stack_solve_algos(i))
|
||||
run_ls2003(blockFlag, storageFlag, default_solve_algo, stack_solve_algos(i))
|
||||
load wsMat
|
||||
path(old_path);
|
||||
% Test against the reference simulation path
|
||||
load('test.mat','y_ref');
|
||||
diff = oo_.endo_simul - y_ref;
|
||||
if(abs(diff) > options_.dynatol.x)
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||
if abs(diff) > options_.dynatol.x
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||
exception = MException('ERROR: simulation path difers from the reference path');
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
|
||||
clear exception
|
||||
end
|
||||
catch exception
|
||||
load wsMat
|
||||
path(old_path);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
|
||||
clear exception
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,13 +42,13 @@ num_block_tests = 0;
|
|||
cd([top_test_dir filesep 'block_bytecode']);
|
||||
tic;
|
||||
for blockFlag = 0:1
|
||||
for bytecodeFlag = 0:1
|
||||
for storageFlag = 0:2 % 0=M-file, 1=use_dll, 2=bytecode
|
||||
default_solve_algo = 2;
|
||||
default_stack_solve_algo = 0;
|
||||
if !blockFlag && !bytecodeFlag
|
||||
if !blockFlag && storageFlag != 2
|
||||
solve_algos = [0:4 9];
|
||||
stack_solve_algos = [0 6];
|
||||
elseif blockFlag && !bytecodeFlag
|
||||
elseif blockFlag && storageFlag != 2
|
||||
solve_algos = [0:4 6:9];
|
||||
stack_solve_algos = 0:4;
|
||||
else
|
||||
|
@ -56,17 +56,20 @@ for blockFlag = 0:1
|
|||
stack_solve_algos = 0:5;
|
||||
endif
|
||||
|
||||
pause(1) # Workaround for strange race condition related to the _static.m file
|
||||
# Workaround for strange race condition related to the static/dynamic
|
||||
# files (especially when we switch to/from use_dll)
|
||||
rmdir('+ls2003_tmp', 's')
|
||||
pause(1)
|
||||
|
||||
for i = 1:length(solve_algos)
|
||||
num_block_tests = num_block_tests + 1;
|
||||
if !blockFlag && !bytecodeFlag && (i == 1)
|
||||
if !blockFlag && storageFlag == 0 && (i == 1)
|
||||
## This is the reference simulation path against which all
|
||||
## other simulations will be tested
|
||||
try
|
||||
old_path = path;
|
||||
save wsOct
|
||||
run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo)
|
||||
run_ls2003(blockFlag, storageFlag, solve_algos(i), default_stack_solve_algo)
|
||||
load wsOct
|
||||
path(old_path);
|
||||
y_ref = oo_.endo_simul;
|
||||
|
@ -74,31 +77,29 @@ for blockFlag = 0:1
|
|||
catch
|
||||
load wsOct
|
||||
path(old_path);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], lasterror);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], lasterror);
|
||||
end_try_catch
|
||||
else
|
||||
try
|
||||
old_path = path;
|
||||
save wsOct
|
||||
run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo)
|
||||
run_ls2003(blockFlag, storageFlag, solve_algos(i), default_stack_solve_algo)
|
||||
load wsOct
|
||||
path(old_path);
|
||||
## Test against the reference simulation path
|
||||
load('test.mat','y_ref');
|
||||
diff = oo_.endo_simul - y_ref;
|
||||
if(abs(diff) > options_.dynatol.x)
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
if abs(diff) > options_.dynatol.x
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
differr.message = ["ERROR: simulation path differs from the reference path" ];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], differr);
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], differr);
|
||||
endif
|
||||
catch
|
||||
load wsOct
|
||||
e = lasterror(); # The path() command alters the lasterror, because of io package
|
||||
path(old_path);
|
||||
lasterror(e);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], lasterror);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], lasterror);
|
||||
end_try_catch
|
||||
endif
|
||||
endfor
|
||||
|
@ -107,24 +108,22 @@ for blockFlag = 0:1
|
|||
try
|
||||
old_path = path;
|
||||
save wsOct
|
||||
run_ls2003(blockFlag, bytecodeFlag, default_solve_algo, stack_solve_algos(i))
|
||||
run_ls2003(blockFlag, storageFlag, default_solve_algo, stack_solve_algos(i))
|
||||
load wsOct
|
||||
path(old_path);
|
||||
## Test against the reference simulation path
|
||||
load('test.mat','y_ref');
|
||||
diff = oo_.endo_simul - y_ref;
|
||||
if(abs(diff) > options_.dynatol.x)
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||
if abs(diff) > options_.dynatol.x
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||
differr.message = ["ERROR: simulation path differs from the reference path" ];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], differr);
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], differr);
|
||||
endif
|
||||
catch
|
||||
load wsOct
|
||||
e = lasterror(); # The path() command alters the lasterror, because of io package
|
||||
path(old_path);
|
||||
lasterror(e);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], lasterror);
|
||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], lasterror);
|
||||
end_try_catch
|
||||
endfor
|
||||
endfor
|
||||
|
|
Loading…
Reference in New Issue