MATLAB Parallel server: save output data of each worker by program independent job
Show older comments
The program independent job can work on 10 workers like the following example.
It is assumed that all workers are diffrent nodes each other (node01~node10).
The following code is run on the worker of node01.
% % example.m
c = parcluster;
job1 = createJob(c);
num_worker = 10;
for cnt = 1:num_worker
input_var{cnt} = cnt;
end
createTask(job1,@test_func,1,input_var);
submit(job1);
wait(job1);
result = fetchOutputs(job1);
function output_var = test_func(input_var)
A = rand(100,100) + 1i*rand(100,100);
output_var = A*input_var;
I want to save the results from all workers.
If the system memory of computing the results is over the limit, we can't acquire and save these results.
So, I try to save each result inside the function, 'test_func.m', as follows.
function [] = test_func(input_var)
A = rand(100,100) + 1i*rand(100,100);
output_var = A*input_var;
save(sprintf('filename_%d.mat',input_var),'output_var');
If the function is changed as above, the result of each worker is saved in the following path,
'C:\ProgramData\MJS\Checkpoint\node(number)._worker01_mlworker_log\matlab\work'.
I want to save these files on the other path, not a default path,
like the path of node01, '\\node01\E:\folder_name\'.
The follows have error, not to find the path on the other worker except to headnode (node01).
function [] = test_func(input_var)
A = rand(100,100) + 1i*rand(100,100);
output_var = A*input_var;
save(sprintf('\\node01\E:\folder_name\filename_%d.mat',input_var),'output_var');
I wonder how to save output data of each worker on user-defined path of headnode.
Please, help me.
Thank you.
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!