I want give all my CPU and all size of my laptop to run my codes
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Ive J
le 7 Fév 2021
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
le 7 Fév 2021
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.
Réponses (1)
Walter Roberson
le 7 Fév 2021
- 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
- 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
- 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.
- 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%
- Turn down your mouse sensitivity and mouse event rate.
- 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.
- 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.
- Turn off wifi and bluetooth and unplug the ethernet cable. A millisecond saved is a millisecond available for MATLAB.
- 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.
0 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!