How can I permanently set the processor affinity for an application on Multi-CPU machines on a Windows machine?

7 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
Processor affinity is used when it is necessary to continue processing an application that is tied to a subset of the hardware, so that transitions from one processor to another are minimized. You can establish affinity on a server that is supporting multiple applications so that a processor is dedicated to each Application.
You can permanently set processor affinity for a non-operating system executable, on NT based operating systems (Windows NT, 2000 Family, XP Family, 2003 Family, Longhorn/Vista) by using the IMAGECFG.EXE tool from the \support\debug\i386 folder of a Windows NT 4.0 CD-ROM, or the IMAGECFG.EXE tool from the Windows 2000 Server Resource Kit Supplement One.
Copy imagecfg.exe to %systemroot%\system32
Doing so will make imagecfg a system command.
NOTE: This application will modify the exe and will write out a new header. You should backup the executable files you modify in case you need to set the application to use both cores again.
To permanently set the processor affinity for MATLAB.EXE, open a CMD prompt and type
move %MATLAB%\bin\win32\MATLAB.exe %MATLAB%\bin\win32\MATLAB_backup.exe
imagecfg -a 0xn %MATLAB%\bin\win32\MATLAB.exe
where 0xn is the affinity mask. The mask constrains your application to a specific CPU, from 0 - 31,
where:
CPU MASK
0 0x1
1 0x2
2 0x4
3 0x8
4 0x10
5 0x20
6 0x40
7 0x80
8 0x100
...

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2007a

Community Treasure Hunt

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

Start Hunting!

Translated by