mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > Msieve

Reply
 
Thread Tools
Old 2009-02-24, 13:22   #1
Andi47
 
Andi47's Avatar
 
Oct 2004
Austria

2×17×73 Posts
Exclamation GNFS poly search time limit oddity

Yesterday, I switched my PC to standby overnight (it is standing in my sleeping room, and the fan is damn loud) approx. 5-10 minutes after msieve had started to search for a polynomial for a c108. When I switched it on again to day in the morning, msieve thought that poly search had exceeded the time limit and stopped searching.

So msieve seems to measure "calender time" and not cpu-time. Is there a possibility to determine, how long msieve is running on the cpu - and take this value to tell if the time limit has been exceeded?
Andi47 is offline   Reply With Quote
Old 2009-02-24, 13:40   #2
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

24×13×17 Posts
Default

I don't know a portable way for C programs to measure CPU time and not calendar time. Linux has the means to get that information, but IIRC it's not filled in by the OS. If the CPU actually throttles to a low clock speed, even that won't be sufficient.
jasonp is offline   Reply With Quote
Old 2009-02-24, 14:17   #3
akruppa
 
akruppa's Avatar
 
"Nancy"
Aug 2002
Alexandria

2,467 Posts
Default

The clock() function is in C89, C99 and Posix. Most Unix-like OSs should have it. It usually has pretty poor resolution (1/100 second on Linux I think...) but that's not an issue for measuring how long the poly selection ran so far. However, clock() does not exist on Windows afaik, so in GMP-ECM we use GetProcessTimes() if _WIN32 is defined.

Alex
akruppa is offline   Reply With Quote
Old 2009-02-24, 14:18   #4
fivemack
(loop (#_fork))
 
fivemack's Avatar
 
Feb 2006
Cambridge, England

13×491 Posts
Default

I believe on linux that clock() measures something like CPU time; though this is only because I recall that it gave useless results in multi-threaded programs.

http://msdn.microsoft.com/en-us/libr...37(VS.85).aspx looks as if it might be helpful for Win32, though it was introduced in Win2000 so isn't portable back to Win98.

My machines never sleep so the issue doesn't arise for me
fivemack is offline   Reply With Quote
Old 2009-02-24, 16:11   #5
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

24×13×17 Posts
Default

Would the time fields from getrusage() be better than what clock() returns?
jasonp is offline   Reply With Quote
Old 2009-02-24, 19:34   #6
akruppa
 
akruppa's Avatar
 
"Nancy"
Aug 2002
Alexandria

2,467 Posts
Default

getrusage() usually has better resolution (often microsecond), so it's nice for timing smallish functions. You can also tell it whether you want to include cpu time used by child processes. For getting the time in hours that the poly selection ran, clock() should easily suffice, though. As for machines with variable clock rate... I suppose you could read the cpu cycle counter, if available. But that will be seriously thrown off if the machine is busy and other processes get cycles.

Alex

Last fiddled with by akruppa on 2009-02-24 at 23:08 Reason: The sentence no verb
akruppa is offline   Reply With Quote
Old 2009-02-24, 19:38   #7
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

22·5·373 Posts
Default

Quote:
Originally Posted by jasonp View Post
I don't know a portable way for C programs to measure CPU time and not calendar time. Linux has the means to get that information, but IIRC it's not filled in by the OS. If the CPU actually throttles to a low clock speed, even that won't be sufficient.

Isn't get_rusage(....) available???
R.D. Silverman is offline   Reply With Quote
Old 2009-02-24, 22:37   #8
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

24×13×17 Posts
Default

getrusage appears to be POSIX but google shows lots of people needing a windows equivalent. It's also not in the MinGW headers, so I suspect it's not in the win32 collection
jasonp is offline   Reply With Quote
Old 2009-02-24, 22:42   #9
Brian Gladman
 
Brian Gladman's Avatar
 
May 2008
Worcester, United Kingdom

2×263 Posts
Default

Jason, I can let you have a version of get_rusage() that I use on Windows if this would help.

As Alex says the appropriate Windows call is GetProcessTimes() and I use this to emulate get_rusage().

Brian Gladman
Brian Gladman is offline   Reply With Quote
Old 2009-02-24, 23:26   #10
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

11101001001002 Posts
Default

Quote:
Originally Posted by jasonp View Post
getrusage appears to be POSIX but google shows lots of people needing a windows equivalent. It's also not in the MinGW headers, so I suspect it's not in the win32 collection
I can supply high resolution CPU timing for Windows.
R.D. Silverman is offline   Reply With Quote
Old 2009-02-25, 00:03   #11
jasonp
Tribal Bullet
 
jasonp's Avatar
 
Oct 2004

DD016 Posts
Default

As mentioned, for this particular application there isn't a need for high-resolution timing, only for a moderately accurate measure of CPU time. There are certainly alternatives that are available, so I can build whatever I need.

PS: Alex, according to the clock() man page the timing resolution is supposed to be fixed at 1 microsecond, but going through the headers the value of a clock_t is a 32-bit integer on 32-bit linux. That means the clock count would wrap around every 72 minutes, which isn't enough for a long-duration event like the limit on poly selection.

Last fiddled with by jasonp on 2009-02-25 at 00:08
jasonp is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search result limit davar55 Forum Feedback 15 2019-02-26 15:41
Poly search candidates schickel Msieve 32 2013-11-05 19:11
Poly Search vs Sieving times EdH Factoring 10 2013-10-14 20:00
GNFS poly selection frmky Factoring 14 2012-07-23 01:57
gpu poly search error bdodson Msieve 10 2010-11-09 19:46

All times are UTC. The time now is 20:29.

Mon Apr 12 20:29:00 UTC 2021 up 4 days, 15:09, 1 user, load averages: 2.94, 2.82, 2.84

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.