mersenneforum.org Processor Affinity
 Register FAQ Search Today's Posts Mark Forums Read

2011-02-26, 01:20   #12
ATH
Einyen

Dec 2003
Denmark

65568 Posts

Quote:
 Originally Posted by R.D. Silverman Very Nice! But I am not allowed to download/install code from the net onto any office machines.
There is no installation or compiling, its just 1 .exe-file. You can scan it for virus and use it?

2011-02-26, 01:28   #13
schickel

"Frank <^>"
Dec 2004
CDP Janesville

2·1,061 Posts

Quote:
 Originally Posted by R.D. Silverman I would have to designate a machine to be the server. I have no way to assure that said machine will be up at any given time. I am using public machines which are subject to being disconnected (so others can plug in their laptop), turned off at the whim of the last one to log in, etc. etc. Sometimes people disconnect a machine to plug in their laptop only to fail to restore the connection later. The only machanism that I have for starting distributed processes is the Windows task scheduler (equivalent to Unix cron jobs). Availability of machines is very unreliable. I can't use my laptop as the server since I often take it home.
Unfortunately, since the ECMNET code is DOS, there will be a DOS window open on the machines that you use.

However, if you can count on the DOS windows staying running, you can run a master server that you use to control the numbers being worked on with a slave server on each of the client machines. Configure the client machines to connect to the local server and they get and report work to themselves, effectively. The slave servers, then, will attempt to connect to the master server on a configurable basis to send their wok in for collation. The communication interval is configurable as "time between connections" with a "time after communication error" interval. The servers will attempt to communicate on the "between" interval, falling back to retrying on the "error" interval until communication is made. The later versions of the server give a little bit finer control over server-server communications, with the ability to designate alternate servers.....although if you can't control which machines will stay up and available, that might be less useful to you.

Unfortunately, there is no turnkey way to control starting up jobs, except putting both client and server shortcuts in the Startup folder which would give you the ability to have the clients start automatically on login. The local server gives the ability to be able to work around network cables being connected, but that's about all. There is a program out there that is able to hide DOS windows on the taskbar, but your software environment might be too restrictive to use a solution like that. (I would also have to look in to that further to see if I could find the program again. wblipp may know that; I think he was using that for his ECMNET setups for 11smooth...)

2011-02-26, 10:50   #14

May 2008
Worcester, United Kingdom

72·11 Posts

Quote:
 Originally Posted by R.D. Silverman Very Nice! But I am not allowed to download/install code from the net onto any office machines.
Not even when it is provided by Microsoft and can be authenticated if necessary? imagecfg.exe is a part of the Microsoft Application Compatibility Toolkit 5.6.

If your security administrators are allowing Microsoft security fixes to be installed on your Windows machines (which is crucial to maintain security), they are evidently trusting Microsoft so why would they not trust another program supplied by Microsoft? It can probably be obtained on CD if they are paranoid about using the Microsoft download site.

To set process/thread affinity in a program requires quite a few system calls. The two calls:

ph = GetCurrentProcess()

gets the variable afp in which the bits correspond with the processors (cores) on which the running process can run when scheduled. The process can then be limited to a single core using, for example:

afp &= (1 << CurrentProcessorNumber());

This just locks it to the core on which it is now running (I use this for timing code).

Unfortunately 'system' is too crude to allow you to set the affinity of the launched process (as far as I know).

If the thread is not launched in a suspended state and is already running on a different core it will be suspended and rescheduled accordingly.

Brian

Last fiddled with by Brian Gladman on 2011-02-26 at 10:52 Reason: typo

2011-02-26, 13:49   #15
R.D. Silverman

"Bob Silverman"
Nov 2003
North of Boston

22·1,877 Posts

Quote:
 Originally Posted by ATH There is no installation or compiling, its just 1 .exe-file. You can scan it for virus and use it?

2011-02-26, 13:57   #16
R.D. Silverman

"Bob Silverman"
Nov 2003
North of Boston

750810 Posts

Quote:
 Originally Posted by Brian Gladman Not even when it is provided by Microsoft and can be authenticated if necessary? imagecfg.exe is a part of the Microsoft Application Compatibility Toolkit 5.6.
Ah! In this case, I can get approval. Thanks for the info.

Quote:
 If your security administrators are allowing Microsoft security fixes to be installed on your Windows machines (which is crucial to maintain security), they are evidently trusting Microsoft so why would they not trust another program supplied by Microsoft? It can probably be obtained on CD if they are paranoid about using the Microsoft download site. To set process/thread affinity in a program requires quite a few system calls. The two calls: ph = GetCurrentProcess() GetProcessAffinityMask(ph, &afp, &afs) gets the variable afp in which the bits correspond with the processors (cores) on which the running process can run when scheduled. The process can then be limited to a single core using, for example: afp &= (1 << CurrentProcessorNumber()); SetProcessAffinityMask(ph, afp)) This just locks it to the core on which it is now running (I use this for timing code). Unfortunately 'system' is too crude to allow you to set the affinity of the launched process (as far as I know). To do this you need to use _beginthread() or _beginthreadex() to launch a thread and then use SetThreadAffinityMask() to lock this thread to a specific core. If the thread is not launched in a suspended state and is already running on a different core it will be suspended and rescheduled accordingly. Brian
What I need is not so much the ability to SET the affinity. Instead, I
need to be able to GET the affinity once a process is running.

However, I can avoid all of this just by using the catenated hostname and
process ID as a unique file name.

Brian, can you recommend a good (detailed!) book on Windows system
programming?

 2011-02-26, 16:20 #17 Brian Gladman     May 2008 Worcester, United Kingdom 10338 Posts HI Bob, I am afraid that most of my books on this are years old and are now out if date so I'm reluctant to recommend them. The only recent one I have is: Windows System Programming (4th Edition) (Addison-Wesley Microsoft Technology Series) by Johnson M. Hart and I don't hence have anything modern to compare it with. But I have earlier versions of this book as well and I like the his approach. When you say you want to get the affinity of a process, do you mean what cores it can run on or what core it is running on at the point you query it? Last fiddled with by Brian Gladman on 2011-02-26 at 16:33 Reason: typo
2011-02-26, 16:55   #18
R.D. Silverman

"Bob Silverman"
Nov 2003
North of Boston

165248 Posts

Quote:
 Originally Posted by Brian Gladman HI Bob, I am afraid that most of my books on this are years old and are now out if date so I'm reluctant to recommend them. The only recent one I have is: Windows System Programming (4th Edition) (Addison-Wesley Microsoft Technology Series) by Johnson M. Hart and I don't hence have anything modern to compare it with. But I have earlier versions of this book as well and I like the his approach. When you say you want to get the affinity of a process, do you mean what cores it can run on or what core it is running on at the point you query it?
The core that it is running on when queried.

I am aware that it has not been pinned to that core.

2015-04-24, 18:30   #19
Serpentine Vermin Jar

Jul 2014

64718 Posts

Quote:
 Originally Posted by ATH You can have one copy of gmp-ecm for each core. Use imagecfg.exe to setup each gmp-ecm to run on a specific core: http://www.robpol86.com/index.php/ImageCFG imagecfg.exe -a 0x1 ecm.exe imagecfg.exe -a 0x2 ecm.exe imagecfg.exe -a 0x4 ecm.exe imagecfg.exe -a 0x8 ecm.exe this setting remains with the ecm.exe until changed with imagecfg or until ecm.exe overwritten by a recompile.
FYI for anyone digging into old threads... I tried imagecfg.exe on the latest version (ecm644_win64_i7.zip) of ECM and it doesn't work.
imagecfg.exe -a 0x1 ecm.exe
Code:
ecm.exe contains no configuration information
ecm.exe contains a Subsystem Version of 5.2
ecm.exe updated with the following configuration information:
IMAGECFG: Unable to update configuration information in image.
Maybe how it was compiled? "no configuration information" means there's nothing it can modify, I suppose?

All I really want is a way to run it with a settable affinity at launch and still be able to redirect output to a file for later examination. And have multiple instances running on different cores.

"start /affinity" gets me close, except the redirecting output, and I can manually change affinity after it's been launched but that's not automated.

My best option at the moment is to use a powershell script to change the affinity, but if you have multiple instances running you need a way to know which particular one to target.

It'd be a lot simpler if there were just a switch you could specify when launching.

 2015-04-24, 22:46 #20 ATH Einyen     Dec 2003 Denmark D6E16 Posts Seems imagecfg.exe does not work on 64 bit applications.

 Similar Threads Thread Thread Starter Forum Replies Last Post g33py Software 3 2016-07-27 05:26 philmoore Information & Answers 2 2013-06-16 05:44 swl551 Software 1 2012-09-24 23:29 TObject Software 3 2012-07-20 19:21 bmg9611 Software 5 2002-11-04 21:26

All times are UTC. The time now is 03:15.

Sat Feb 4 03:15:52 UTC 2023 up 170 days, 44 mins, 1 user, load averages: 1.05, 1.10, 0.99