chipmonger Posted October 12, 2016 Posted October 12, 2016 Have a master program that constantly calls a series of sub-programs. The sub-programs are copies of one master sub-program - the only difference is a filename each is passed as a command line parameter when calling the sub-program. I'd like to take advantage of the number of cores of the system where these programs will eventually run so I'd like the master program to run on CPU 0 and each of the sub programs run on its own CPU (the system has 24 cores). When the master program is run with no process affinity set (running on all cores), the sub-programs can be set with the appropriate affinity (core1.exe runs on CPU1, core2.exe runs on CPU2, etc). When I start the master program with a shortcut using /affinity 1 (to run only on CPU0), all the sub-programs run on CPU0 as well - they do not get the appropriate affinity as they do when the master program runs on all cores. I've tried two different ways to set the process affinity as shown below: $ProcessID = run($ProgramDir & "\Secondaries\" & $ProcessName & " " & $FileName, "", @SW_HIDE) ProcessWait ($ProcessName) _WinAPI_SetProcessAffinityMask($ProcessID, 2^$Core) And the second way: $Submit = "start /affinity " & 2 ^ $Core & " " & $ProgramDir & "\Secondaries\" & $ProcessName & " " & $FileName run(@ComSpec & " /C " & $Submit,"", @SW_HIDE) sleep(50) The sleep option is to prevent multiple processes being created for a CPU. Any ideas? Thanks, Chip
genius257 Posted October 12, 2016 Posted October 12, 2016 (edited) I believe the second way should be: $Submit = "start /affinity " & 2 ^ $Core & ' "' & $ProgramDir & "\Secondaries\" & $ProcessName & '" "' & $FileName & '"' This is to avoid the path to be interpreted as multiple parameters. Edited October 12, 2016 by genius257 To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
chipmonger Posted October 12, 2016 Author Posted October 12, 2016 Thanks for responding. The new line is definitely being handled differently. Getting an error that Windows cannot find the file name being passed by $FileName. Will look into it further this evening.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now