mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2011-02-26, 01:20   #12
ATH
Einyen
 
ATH's Avatar
 
Dec 2003
Denmark

2·32·191 Posts
Default

Quote:
Originally Posted by R.D. Silverman View Post
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?
ATH is online now   Reply With Quote
Old 2011-02-26, 01:28   #13
schickel
 
schickel's Avatar
 
"Frank <^>"
Dec 2004
CDP Janesville

41128 Posts
Default

Quote:
Originally Posted by R.D. Silverman View Post
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...)
schickel is offline   Reply With Quote
Old 2011-02-26, 10:50   #14
Brian Gladman
 
Brian Gladman's Avatar
 
May 2008
Worcester, United Kingdom

72·11 Posts
Default

Quote:
Originally Posted by R.D. Silverman View Post
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()
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

Last fiddled with by Brian Gladman on 2011-02-26 at 10:52 Reason: typo
Brian Gladman is offline   Reply With Quote
Old 2011-02-26, 13:49   #15
R.D. Silverman
 
R.D. Silverman's Avatar
 
"Bob Silverman"
Nov 2003
North of Boston

22·1,877 Posts
Default

Quote:
Originally Posted by ATH View Post
There is no installation or compiling, its just 1 .exe-file. You can scan it for virus and use it?
As I said, I am not allowed to download code.
R.D. Silverman is offline   Reply With Quote
Old 2011-02-26, 13:57   #16
R.D. Silverman
 
R.D. Silverman's Avatar
 
"Bob Silverman"
Nov 2003
North of Boston

22×1,877 Posts
Default

Quote:
Originally Posted by Brian Gladman View Post
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?
R.D. Silverman is offline   Reply With Quote
Old 2011-02-26, 16:20   #17
Brian Gladman
 
Brian Gladman's Avatar
 
May 2008
Worcester, United Kingdom

72×11 Posts
Default

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
Brian Gladman is offline   Reply With Quote
Old 2011-02-26, 16:55   #18
R.D. Silverman
 
R.D. Silverman's Avatar
 
"Bob Silverman"
Nov 2003
North of Boston

165248 Posts
Default

Quote:
Originally Posted by Brian Gladman View Post
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.
R.D. Silverman is offline   Reply With Quote
Old 2015-04-24, 18:30   #19
Madpoo
Serpentine Vermin Jar
 
Madpoo's Avatar
 
Jul 2014

5·677 Posts
Default

Quote:
Originally Posted by ATH View Post
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:
    Process Affinity Mask: 00000001
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.
Madpoo is offline   Reply With Quote
Old 2015-04-24, 22:46   #20
ATH
Einyen
 
ATH's Avatar
 
Dec 2003
Denmark

2·32·191 Posts
Default

Seems imagecfg.exe does not work on 64 bit applications.
ATH is online now   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set affinity does not work g33py Software 3 2016-07-27 05:26
Core affinity question philmoore Information & Answers 2 2013-06-16 05:44
(windows) How to launch mfaktO/C with processor affinity swl551 Software 1 2012-09-24 23:29
Helper Thread Affinity TObject Software 3 2012-07-20 19:21
Affinity on Linux bmg9611 Software 5 2002-11-04 21:26

All times are UTC. The time now is 02:40.


Sat Feb 4 02:40:28 UTC 2023 up 170 days, 9 mins, 1 user, load averages: 0.83, 0.99, 1.03

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔