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

조회 수: 6 (최근 30일)
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'));

채택된 답변

Sivsankar
Sivsankar 2024년 7월 17일
편집: Sivsankar 2024년 7월 17일
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!
  댓글 수: 1
阳 刘
阳 刘 2024년 7월 17일
Thank you for your suggestions. Switching to hardware-accelerated OpenGL helped resolve the issue.
Thanks again!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by