Clear Filters
Clear Filters

Can you please help me? My CPU usage remains consistently low when using parallel processing.

50 views (last 30 days)
I investigated multiple reasons and discovered that the command matlab --prefersoftwareopengl is causing high I/O usage. How can I resolve this I/O hogging issue?
T1=20001;
T2=29000;
% Start the parallel pool
parpool('Threads', 64);
N=T2-T1+1; % 数据点数
dmix = zeros(nx-start1-end1,ny-start2-end2,N);
parfor k = 1:N
i = T1 + k - 1;
fileName = sprintf('./left.out/m%06d.ovf', i-1);
fid = fopen(fileName, 'r');
datam = textscan(fid, '%f%f%f', 'headerlines', 28, 'collectoutput', 1);
fclose(fid);
datam = datam{1};
mix111 = reshape(datam(:,2), [nx, ny, nz]); % select x component
mix111 = permute(mix111, [2 1 3]); % x-y transform
mix11 = mix111(start1+1:nx-end1, start2+1:ny-end2, 2) - mix111(start1+1:nx-end1, start2+1:ny-end2, 1);
mix1 = squeeze(mix11);
% Compute the difference and store in dmix
dmix(:,:,k) = mix1;
end
delete(gcp('nocreate'));

Accepted Answer

Sivsankar
Sivsankar on 17 Jul 2024 at 6:26
Edited: Sivsankar on 17 Jul 2024 at 6:31
Hi,
I believe that the high I/O usage is maybe because of the simultaneous load of software rendering of OpenGL and parallel computation on the CPU. Subsequently when your system runs out of available RAM due to the combined load of software rendering and parallel computations, it may start using swap space on the disk, leading to high disk I/O usage.
So, you can maybe shift from software OpenGL to hardware-accelerated OpenGL so that the rendering tasks would be taken up by the GPU allotting the CPU for the parallel worker threads. Refer to the following MathWorks documentation to implement it
You could also make use of the ‘profile’ tool available in MATLAB to pinpoint if the high I/O usage is due to the software OpenGL or the parallel worker threads.
Here is the documentation on ‘profile’ tool
Let me know if these steps work. Thanks!

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!