From 0623d15cfaca37a92faddb00a9c60f8fdca9d257 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 23 Oct 2024 17:36:42 +0200
Subject: [PATCH] Parallel estimation: copy files for the sparse representation
 on remote hosts

The legacy representation is no longer used for the estimation chain.

Note that this mechanism is not robust (in particular it does not work with the
use_dll option), but this is not new.

Ref. #1859
---
 matlab/estimation/PosteriorIRF.m               | 10 ++++++----
 matlab/estimation/posterior_sampler.m          | 10 ++++++----
 matlab/estimation/prior_posterior_statistics.m |  8 +++++---
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/matlab/estimation/PosteriorIRF.m b/matlab/estimation/PosteriorIRF.m
index e5a9861ef..00366f090 100644
--- a/matlab/estimation/PosteriorIRF.m
+++ b/matlab/estimation/PosteriorIRF.m
@@ -216,10 +216,12 @@ else
     localVars.ifil2=ifil2;
 
     % which files have to be copied to run remotely
-    NamFileInput(1,:) = {'',[M_.fname '.static.m']};
-    NamFileInput(2,:) = {'',[M_.fname '.dynamic.m']};
+    NamFileInput(1,:) = {'',[M_.fname '.sparse.static_resid.m']};
+    NamFileInput(2,:) = {'',[M_.fname '.sparse.static_g1.m']};
+    NamFileInput(3,:) = {'',[M_.fname '.sparse.dynamic_resid.m']};
+    NamFileInput(4,:) = {'',[M_.fname '.sparse.dynamic_g1.m']};
     if M_.set_auxiliary_variables
-        NamFileInput(3,:) = {'',[M_.fname '.set_auxiliary_variables.m']};
+        NamFileInput(5,:) = {'',[M_.fname '.set_auxiliary_variables.m']};
     end
     if options_.steadystate_flag
         if options_.steadystate_flag == 1
@@ -436,4 +438,4 @@ if ~options_.nograph && ~options_.no_graph.posterior
     % END parallel code!
 end
 
-fprintf('%s: Posterior IRFs, done!\n',dispString);
\ No newline at end of file
+fprintf('%s: Posterior IRFs, done!\n',dispString);
diff --git a/matlab/estimation/posterior_sampler.m b/matlab/estimation/posterior_sampler.m
index f1939042b..2668ee1a5 100644
--- a/matlab/estimation/posterior_sampler.m
+++ b/matlab/estimation/posterior_sampler.m
@@ -37,7 +37,7 @@ function posterior_sampler(TargetFun,ProposalFun,xparam1,sampler_options,mh_boun
 % Then the comments write here can be used for all the other pairs of
 % parallel functions and also for management functions.
 
-% Copyright © 2006-2023 Dynare Team
+% Copyright © 2006-2024 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -128,10 +128,12 @@ else
     % Global variables for parallel routines.
     globalVars = struct();
     % which files have to be copied to run remotely
-    NamFileInput(1,:) = {'',[ModelName '.static.m']};
-    NamFileInput(2,:) = {'',[ModelName '.dynamic.m']};
+    NamFileInput(1,:) = {'',[ModelName '.sparse.static_resid.m']};
+    NamFileInput(2,:) = {'',[ModelName '.sparse.static_g1.m']};
+    NamFileInput(3,:) = {'',[ModelName '.sparse.dynamic_resid.m']};
+    NamFileInput(4,:) = {'',[ModelName '.sparse.dynamic_g1.m']};
     if M_.set_auxiliary_variables
-        NamFileInput(3,:) = {'',[M_.fname '.set_auxiliary_variables.m']};
+        NamFileInput(5,:) = {'',[M_.fname '.set_auxiliary_variables.m']};
     end
     if options_.steadystate_flag
         if options_.steadystate_flag == 1
diff --git a/matlab/estimation/prior_posterior_statistics.m b/matlab/estimation/prior_posterior_statistics.m
index 0768a4d30..36349dc6b 100644
--- a/matlab/estimation/prior_posterior_statistics.m
+++ b/matlab/estimation/prior_posterior_statistics.m
@@ -271,10 +271,12 @@ else
     localVars.ifil = ifil;
     globalVars = [];
     % which files have to be copied to run remotely
-    NamFileInput(1,:) = {'',[M_.fname '.static.m']};
-    NamFileInput(2,:) = {'',[M_.fname '.dynamic.m']};
+    NamFileInput(1,:) = {'',[M_.fname '.sparse.static_resid.m']};
+    NamFileInput(2,:) = {'',[M_.fname '.sparse.static_g1.m']};
+    NamFileInput(3,:) = {'',[M_.fname '.sparse.dynamic_resid.m']};
+    NamFileInput(4,:) = {'',[M_.fname '.sparse.dynamic_g1.m']};
     if M_.set_auxiliary_variables
-        NamFileInput(3,:) = {'',[M_.fname '.set_auxiliary_variables.m']};
+        NamFileInput(5,:) = {'',[M_.fname '.set_auxiliary_variables.m']};
     end
     if options_.steadystate_flag
         if options_.steadystate_flag == 1
-- 
GitLab