Skip to content
Snippets Groups Projects
Commit 6d353234 authored by Marco Ratto's avatar Marco Ratto
Browse files

use Save_files to save different names under parallel execution, to avoid...

use Save_files to save different names under parallel execution, to avoid crashes from different threads attempting to write on the same file
parent b1aa88e8
Branches
No related tags found
No related merge requests found
...@@ -83,11 +83,11 @@ while i<n ...@@ -83,11 +83,11 @@ while i<n
end end
x = check_bounds(x,bounds); x = check_bounds(x,bounds);
if Save_files if Save_files
save('gstep.mat','x','h1','f0') save(['gstep' int2str(Save_files) '.mat'],'x','h1','f0')
end end
end end
if Save_files if Save_files
save('gstep.mat','x','h1','f0') save(['gstep' int2str(Save_files) '.mat'],'x','h1','f0')
end end
return return
......
...@@ -256,7 +256,7 @@ if outer_product_gradient ...@@ -256,7 +256,7 @@ if outer_product_gradient
end end
hh1=hess_info.h1; hh1=hess_info.h1;
if Save_files if Save_files
save('hess.mat','hessian_mat') save(['hess' int2str(Save_files) '.mat'],'hessian_mat')
end end
else else
hessian_mat=[]; hessian_mat=[];
......
...@@ -132,7 +132,7 @@ if Verbose ...@@ -132,7 +132,7 @@ if Verbose
end end
end end
if Save_files if Save_files
save('m1.mat','x','hh','g','hhg','igg','fval0') save(['m' int2str(Save_files) '.mat'],'x','hh','g','hhg','igg','fval0')
end end
igrad=1; igrad=1;
...@@ -248,11 +248,11 @@ while norm(gg)>gtol && check==0 && jit<nit ...@@ -248,11 +248,11 @@ while norm(gg)>gtol && check==0 && jit<nit
if norm(x(:,icount)-xparam1)>1.e-12 && analytic_derivation==0 if norm(x(:,icount)-xparam1)>1.e-12 && analytic_derivation==0
try try
if Save_files if Save_files
save('m1.mat','x','fval0','nig','-append') save(['m' int2str(Save_files) '.mat'],'x','fval0','nig','-append')
end end
catch catch
if Save_files if Save_files
save('m1.mat','x','fval0','nig') save(['m' int2str(Save_files) '.mat'],'x','fval0','nig')
end end
end end
[dum, gg, htol0, igg, hhg, h1, hess_info]=mr_hessian(xparam1,func0,penalty,flagit,htol,hess_info,bounds,prior_std,Save_files,varargin{:}); [dum, gg, htol0, igg, hhg, h1, hess_info]=mr_hessian(xparam1,func0,penalty,flagit,htol,hess_info,bounds,prior_std,Save_files,varargin{:});
...@@ -297,12 +297,12 @@ while norm(gg)>gtol && check==0 && jit<nit ...@@ -297,12 +297,12 @@ while norm(gg)>gtol && check==0 && jit<nit
disp_verbose(['Elapsed time for iteration ',num2str(t),' s.'],Verbose) disp_verbose(['Elapsed time for iteration ',num2str(t),' s.'],Verbose)
g(:,icount+1)=gg; g(:,icount+1)=gg;
if Save_files if Save_files
save('m1.mat','x','hh','g','hhg','igg','fval0','nig','H') save(['m' int2str(Save_files) '.mat'],'x','hh','g','hhg','igg','fval0','nig','H')
end end
end end
end end
if Save_files if Save_files
save('m1.mat','x','hh','g','hhg','igg','fval0','nig') save(['m' int2str(Save_files) '.mat'],'x','hh','g','hhg','igg','fval0','nig')
end end
if ftol>ftol0 if ftol>ftol0
skipline() skipline()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment