Why has transferring complex data slowed compared to transferring non-complex data, using the MATLAB engine and parallel workers, since release 2017b?

1 visualización (últimos 30 días)
The following example script:
% Demonstrate very slow complex data transfer after R2017b
ver('matlab')
% Start one worker
p=parpool(1);
fprintf('Generate non-complex data on worker (800,000,000 bytes)...\n')
spmd; a=ones(2, 1e8, 'like', single(1)); end
fprintf('Transfer to client...')
tic;result=a{1};toc;
fprintf('Transfer to worker...')
tic; spmd; a2=result; end; toc
fprintf('Generate complex data on worker (800,000,000 bytes)...\n')
spmd; a=ones(1, 1e8, 'like', single(1i)); end
fprintf('Transfer to client...')
tic;result=a{1};toc;
fprintf('Transfer to worker...')
tic; spmd; a2=result; end; toc
% Shut down worker
delete(p);
generates the following similar timings for complex and non-complex data on R2017b (Update 9):
Generate non-complex data on worker (800,000,000 bytes)...
Transfer to client...Elapsed time is 2.900314 seconds.
Transfer to worker...Elapsed time is 4.685561 seconds.
Generate complex data on worker (800,000,000 bytes)...
Transfer to client...Elapsed time is 2.708720 seconds.
Transfer to worker...Elapsed time is 4.738205 seconds.
but on R2018a, onwards, much slower timings, particularly for complex data. Here R2019b (Update 1):
Generate non-complex data on worker (800,000,000 bytes)...
Transfer to client...Elapsed time is 3.357897 seconds.
Transfer to worker...Elapsed time is 5.630650 seconds.
Generate complex data on worker (800,000,000 bytes)...
Transfer to client...Elapsed time is 6.457379 seconds.
Transfer to worker...Elapsed time is 22.077327 seconds.
The exact timings vary slighly, of course, but complex data transfer is consistently very much slower than non-complex (e.g. 5x!). A similar slow-down effect occurs with engPutVariable, etc. in the C MATLAB engine API.
Did something bad happen to data transfer with the switch to interleaved complex memory layout in R2018a?

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by