# Conflicts: # Classes/00_signals/Signal.m # Functions/EQ_structures/duobinary_signaling.m # Functions/EQ_structures/vnle_postfilter_mlse.m # Functions/EQ_visuals/showLevelScatter.m
58 lines
1.6 KiB
Matlab
58 lines
1.6 KiB
Matlab
function [output, future] = submit_dsp(run_id, basePath, database_name, savePath, options)
|
|
% runDSPInBackground Runs or submits DSP processing based on 'parallel' flag.
|
|
%
|
|
% [output, future] = runDSPInBackground(..., options)
|
|
% - output: result from dsp_run_id (only immediately available in serial mode)
|
|
% - future: FevalFuture object if run in parallel, otherwise []
|
|
|
|
arguments
|
|
run_id
|
|
basePath
|
|
database_name
|
|
savePath
|
|
options.parallel (1,1) logical = true
|
|
options.max_occurences = 1;
|
|
options.paramstruct = struct();
|
|
end
|
|
|
|
if options.parallel
|
|
% Check if a pool exists
|
|
pool = gcp('nocreate');
|
|
if isempty(pool)
|
|
parpool(4);
|
|
end
|
|
|
|
% Submit the DSP function asynchronously
|
|
future = parfeval( ...
|
|
@dsp_run_id, 1, ... % One output
|
|
run_id, ...
|
|
"database_path", basePath, ...
|
|
"database_name", database_name, ...
|
|
'storage_path', savePath, ...
|
|
'append_to_db', 1, ...
|
|
'max_occurences', options.max_occurences, ...
|
|
'parameters', options.paramstruct ...
|
|
);
|
|
|
|
output = [];
|
|
fprintf('DSP task for run_id %d submitted to the pool.\n', run_id);
|
|
|
|
|
|
else
|
|
% Run synchronously (debug mode), capture output
|
|
fprintf('Running DSP task for run_id %d in main thread (debug mode).\n', run_id);
|
|
|
|
output = dsp_run_id( ...
|
|
run_id, ...
|
|
"database_path", basePath, ...
|
|
"database_name", database_name, ...
|
|
'storage_path', savePath, ...
|
|
'append_to_db', 1, ...
|
|
'max_occurences', options.max_occurences,...
|
|
'parameters', options.paramstruct ...
|
|
);
|
|
|
|
future = []; % No future since it's synchronous
|
|
end
|
|
end
|