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

1 次查看(过去 30 天)
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?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel Computing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by