mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2013-04-13, 20:36   #1
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17×251 Posts
Default MfaktX Controller (Windows)

This is an app inspired by the MFAKTx speed menu batch file. It is a .Net 4.5 app that lets you choose the speed of mfaktx (slow/medium/fast) and start/stop it through a UI. Like the batch file, it requires you to set up slow/medium/fast .ini files, and it copies that into the real .ini file location. When you start it, it automatically begins at the Fast speed. A text area shows the output from mfaktx. It optionally detects when you're not using your PC by watching for the screen saver. A short time (checks every 15 seconds) after the screen saver comes on, it switches to Fast, and a short time after it goes away, it switches to Medium.

It's only been tested on my computer with mfaktc. I don't know enough about mfakto to tell you it will or won't work, but judging by the simplicity of the mfaktx speed menu batch file, I'm hopeful that it will. I'd expect everything except the idle detection to work on other platforms using Mono: the idle detection uses Windows APIs to check on the screensaver.

I'd recommend that you set the CheckpointDelay in your .ini's to 0 (immediate updates), since the controller will immediately close mfaktx instead of trying to close it nicely (I tried to do that, but it added a lot of complexity and didn't work well; Windows is surprisingly bad at the seemingly-simple task of programmatically nicely killing another process, and knowing when that's done). The speed gains you can get by having mfaktx run at its fastest speed when possible can easily outweigh the small losses of this partial work being lost.

Source and binaries are available at https://github.com/Mini-Geek/mfaktx-controller
Mini-Geek is offline   Reply With Quote
Old 2013-04-13, 21:11   #2
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

10000101010112 Posts
Default

.
Attached Thumbnails
Click image for larger version

Name:	mfaktx-controller.PNG
Views:	297
Size:	54.2 KB
ID:	9667  
Mini-Geek is offline   Reply With Quote
Old 2013-04-13, 22:02   #3
swl551
 
swl551's Avatar
 
Aug 2012
New Hampshire

23·101 Posts
Default

You can use and redistribute my SendCtrlCode.exe to handle the CTRL-C signalling to execute a graceful shutdown. Grab it from inside the lastest misfit release.

Run it from the command line to see expected parameter list.

Last fiddled with by swl551 on 2013-04-13 at 22:06
swl551 is offline   Reply With Quote
Old 2013-04-13, 22:11   #4
swl551
 
swl551's Avatar
 
Aug 2012
New Hampshire

23·101 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
.
Nice job by the way. Xyzzy will go CRAZY with joy!

Last fiddled with by swl551 on 2013-04-13 at 22:14
swl551 is offline   Reply With Quote
Old 2013-04-14, 00:42   #5
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts
Default

Quote:
Originally Posted by swl551 View Post
You can use and redistribute my SendCtrlCode.exe to handle the CTRL-C signalling to execute a graceful shutdown. Grab it from inside the lastest misfit release.

Run it from the command line to see expected parameter list.
Thanks. I had looked at that (and a similar program) earlier on, but I was on the wrong track and spun my wheels for a while - I don't need to keep track of when SendCtrlCode.exe closes, but when mfaktc.exe closes. I've made use of that now, and added some other minor features. My recommendation of putting CheckpointDelay at 0 no longer stands. I've put the client build out on github:
https://github.com/Mini-Geek/mfaktx-...roller-win.zip
Since I'm past the time that I can edit my post, if any mods are reading this, I'd like if the zip I attached in the first post could be removed and the last line changed to: "Source and binaries are available at https://github.com/Mini-Geek/mfaktx-controller"
Quote:
Originally Posted by swl551 View Post
Nice job by the way. Xyzzy will go CRAZY with joy!
Thanks. I hope more than myself will find a use for it. It seems like it's taken way more work than it's worth.

Last fiddled with by Mini-Geek on 2013-04-14 at 00:45
Mini-Geek is offline   Reply With Quote
Old 2013-04-14, 11:40   #6
swl551
 
swl551's Avatar
 
Aug 2012
New Hampshire

23·101 Posts
Default

Code:
 
privatebool processStop()
{
//call must wrap this call in try/catch
bool SentStopSignalOK = false;
int counter = 0;
foreach (string pname in globals.cfg.settingStopProcessList) //list of process names found in your INI file
{
Process[] processList = Process.GetProcessesByName(pname);
if (processList.Length > 0)
{
foreach (Process P in processList)
{
ProcessStartInfo Pinfo = newProcessStartInfo(Globals.APP_CTRLC_SIGNAL, P.Id.ToString() + " 0");
Pinfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(Pinfo);
counter++;
System.Threading.Thread.Sleep(20);
}
}

}
if (counter > 0)
SentStopSignalOK = true;
else
SentStopSignalOK = false;
return SentStopSignalOK;
}
swl551 is offline   Reply With Quote
Old 2013-04-14, 16:19   #7
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

19·433 Posts
Default

A very awesome program!

We did not notice any documentation but editing the XML file seems to explain everything.

We had to download the .Net 4.5 stuff but it prompted us to do this automatically.

By default it starts on the fast setting. Having a choice which speed to start with would be very cool.

We do not understand how to use the scroll buffer. If we scroll up the next update scrolls it back down. (How many lines can we reasonably buffer? 10,000? 100,000?)

We are unable to (using two separate directories) run two instances for two different video cards. Are we missing something?

Thanks a bunch!

Xyzzy is offline   Reply With Quote
Old 2013-04-14, 16:39   #8
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

19·433 Posts
Default

Quote:
We are unable to (using two separate directories) run two instances for two different video cards. Are we missing something?
We renamed the mfaktc binary to different names and now both run!



(We are tempted to try to get everything to run from one directory but it works right now, and we are lazy. Perhaps some rainy day we will revisit that.)

Xyzzy is offline   Reply With Quote
Old 2013-04-14, 18:12   #9
swl551
 
swl551's Avatar
 
Aug 2012
New Hampshire

32816 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
We renamed the mfaktc binary to different names and now both run!



(We are tempted to try to get everything to run from one directory but it works right now, and we are lazy. Perhaps some rainy day we will revisit that.)

Just rememeber MISFIT does not support multiple MFAKTx installations in the same directory.
swl551 is offline   Reply With Quote
Old 2013-04-14, 19:36   #10
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts
Default

Quote:
Originally Posted by Xyzzy View Post
A very awesome program!
Thank you.
Quote:
Originally Posted by Xyzzy View Post
By default it starts on the fast setting. Having a choice which speed to start with would be very cool.
I can add that. The thought had crossed my mind, but I wasn't sure if it'd be used so I hadn't done it yet.
Quote:
Originally Posted by Xyzzy View Post
We do not understand how to use the scroll buffer. If we scroll up the next update scrolls it back down. (How many lines can we reasonably buffer? 10,000? 100,000?)
Hm...maybe it should only automatically scroll down again if it was scrolled to the bottom when the new line came in. I'll see if I can improve this. I had based it off of the Windows command window, which does a similar thing.

The more lines you have, the more memory/CPU it'll take, and the harder it'll be to use the scroll bar (since it's scrolling through so much). I picked 300 as the default simply because that's what I had my mfaktc command window set at. I don't see any problem with 100,000 lines - it might take around 32 MB of memory extra (100,000 lines x 80 chars per line x 2 bytes per char x 2 places it's stored) and a similarly small amount (i.e. somewhere between trivial and large, in my opinion) of CPU. If you notice the updates being slow or the app hogging memory with it set like that, let me know and I'll see if I can make improvements.
Quote:
Originally Posted by Xyzzy View Post
We are unable to (using two separate directories) run two instances for two different video cards. Are we missing something?


...
We renamed the mfaktc binary to different names and now both run!

There is a MaxInstances that should be set to 2 (or higher) in both config files (Edit: there's also MfaktXArguments where you should put your -d x mfaktc argument to specify the device). If that's already set correctly, could you tell me what doesn't work? I've only got one CUDA-capable GPU, so I haven't tested that.

Could you remove the attachment from the first post? I'd prefer it being somewhere I can update it (github). Also please change the last line to:
Source and binaries are available at https://github.com/Mini-Geek/mfaktx-controller

Last fiddled with by Mini-Geek on 2013-04-14 at 20:09
Mini-Geek is offline   Reply With Quote
Old 2013-04-14, 22:16   #11
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

19·433 Posts
Default

Quote:
There is a MaxInstances that should be set to 2 (or higher) in both config files (Edit: there's also MfaktXArguments where you should put your -d x mfaktc argument to specify the device). If that's already set correctly, could you tell me what doesn't work? I've only got one CUDA-capable GPU, so I haven't tested that.
We overlooked "MfaktXArguments" but now we can see how it should work.

However, we are going to continue to use separate binary names because it works and because if we accidentally started a second instance in the same directory the safeguard will save us from ourselves.

Quote:
Could you remove the attachment from the first post? I'd prefer it being somewhere I can update it (github). Also please change the last line to:
Source and binaries are available at https://github.com/Mini-Geek/mfaktx-controller
Done.

FWIW, we have tested the screensaver option with both the DPMS screensaver (in the "Power Options" control panel) and with the "blank" screensaver (in the "Personalization" control panel) and neither worked.

We are using Windows 7, if that helps.

Finally, since you can detect that an instance is running, is it safe to assume that you can detect other things running? If you can, could you implement a "PauseWhileRunning" option?

It never hurts to ask!



Christmas List:
Option to start at a particular speed.
Option for "PauseWhileRunning".
Option to show which GPU is being used in the window and/or title bar.
Option to specify a font for the console output.
Xyzzy is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
released: MISFIT for MFAKTx version 2.11.0 (31-Jan-2017) swl551 MISFIT 19 2020-11-18 14:29
MISFIT for MFAKTx swl551 MISFIT 186 2014-02-05 23:27
MFAKTx speed menu (windows) swl551 Software 8 2013-03-07 00:16
mfaktX result: "found 1 factor for M" swl551 GPU Computing 2 2012-12-20 15:20
(archive)mfaktXHelper - utility for managing mfaktX installations swl551 MISFIT 57 2012-08-12 03:37

All times are UTC. The time now is 08:18.


Tue Jul 27 08:18:13 UTC 2021 up 4 days, 2:47, 0 users, load averages: 1.84, 1.87, 1.79

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, 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.