I want give all my CPU and all size of my laptop to run my codes

조회 수: 1 (최근 30일)
Rahim Rahim
Rahim Rahim 2021년 2월 7일
댓글: Walter Roberson 2021년 2월 7일
I have a code matlab, was run fast. The same code become slow,
I am biggener in matlab. How I make my cpu run my code 100%.
  댓글 수: 2
Ive J
Ive J 2021년 2월 7일
Your question seems related to the one you already asked here.
But regarding your question, it depends if you can reformulate it in a proper manner (e.g. if you use parfor loop). You first need Parallel Computing Toolbox installed, and as a starting point you can try something like this:
myPool = parpool('local', 2); % should be configured according to your machine
parfor i = 1:N
% do my work
end
delete(myPool); % delete this pool
Walter Roberson
Walter Roberson 2021년 2월 7일
Parallel Computing Toolbox would not be effective for the code that was outlined in that question. The code would have to be rewritten to parallize, to avoid accessing the main variable in two different index patterns (prohibitted for parfor), which is something that could be done for the two outer loops. But by the time you get to the (now rewritten) inner loop, there is too little work to make using parfor cost effective.

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

답변 (1개)

Walter Roberson
Walter Roberson 2021년 2월 7일
  1. Uninstall all other software that could potentially want to run while you are running your MATLAB code. For example, do not simply assume that your anti-virus will not happen to run while your MATLAB code is running: uninstall the anti-virus so that it's background checking for database updates is removed. Be sure to uninstall all email programs and browsers as well, as they often run in the background
  2. For windows, use netserv to disable all services except the ones strictly needed for running MATLAB, including services such as checking for windows updates, and Windows firewall, and remove drive access, and remote desktop services
  3. Be sure to disable services automatically started upon login that you have configured for your account, such as disabling your hot-key manager and Whatsapp. The approach for this and the previous point should be turn off everything and only re-enable the ones that cause MATLAB to crash when they are not there.
  4. Turn off your hard-drive SMART monitoring, and automatic recovery of sector errors. Any millisecond spent preventing your system from corrupting itself is time not running MATLAB 100%
  5. Turn down your mouse sensitivity and mouse event rate.
  6. Unplug all devices from your computer except the ones actively needed for your MATLAB code. Unplug that backup USB drive, and that webcam: even when you are not actively using them, the fact that they exist and are powered on causes the USB drivers to have to spend time checking in with them to see whether there is work to do.
  7. Unplug that high-quality keyboard and go back to using that crappy built-in keyboard. You want 100% performance, right? Your time spent trying to remember which alt-key combination is needed to generate the [ key is of no importance for saving 1 millisecond every minute.
  8. Turn off wifi and bluetooth and unplug the ethernet cable. A millisecond saved is a millisecond available for MATLAB.
  9. Make sure the insides of your computer are dust-free and that there is plenty of dust-free ventilation space around your computer. If you can, move the computer into a cooler place. If it is winter where you are, consider moving your computer outside, perhaps into the garage or shed to keep the rain and snow off of it. Colder components run faster. For example, it is currently negative 30C outside where I live, which would do nicely for cooling. Wear good gloves if frostbite would be a risk while you are working on the computer outside.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by