mersenneforum.org  

Go Back   mersenneforum.org > New To GIMPS? Start Here! > Information & Answers

Reply
 
Thread Tools
Old 2008-11-13, 00:04   #1
Jud McCranie
 
Jud McCranie's Avatar
 
Oct 2007

1328 Posts
Default Bug in CPU "daytime"

There seems to be a bug in the CPU "daytime" hours. I wanted daytime to go from 10:30 am to 1:30 am - the hours when I may be working. If the second time is after midnight the program swaps the start and end times.
Jud McCranie is offline   Reply With Quote
Old 2008-11-13, 00:43   #2
cheesehead
 
cheesehead's Avatar
 
"Richard B. Woods"
Aug 2002
Wisconsin USA

769210 Posts
Default

Quote:
Originally Posted by Jud McCranie View Post
There seems to be a bug in the CPU "daytime" hours. I wanted daytime to go from 10:30 am to 1:30 am - the hours when I may be working. If the second time is after midnight the program swaps the start and end times.
In source module commonc.c, there's:

Code:
 if (day_start_time > day_end_time) {
  temp = day_memory; day_memory = night_memory; night_memory = temp;
  temp = day_start_time; day_start_time = day_end_time; day_end_time = temp;
... which swaps the day/night memory and day start/end time values in your case.

So, you can either:

1. Leave your day start/end times as 10:30 am and 1:30 am, but switch your memory specifications so that the "daytime memory" is actually what you want as your night memory, and vice versa,

or

2. Leave your memory figures alone and swap your day start/end times.

In either case, prime95 will then use your desired daytime memory allocation from 10:30 am until 1:30 am the following day, and your desired nighttime memory allocation from 1:30 am until 10:30 am the same day.

Last fiddled with by cheesehead on 2008-11-13 at 00:55
cheesehead is offline   Reply With Quote
Old 2008-11-13, 00:47   #3
Jud McCranie
 
Jud McCranie's Avatar
 
Oct 2007

10110102 Posts
Default

Quote:
Originally Posted by cheesehead View Post
I'm fairly sure you can workaround this by (1) specifying daytime to start at 1:30 am and end at 10:30 am, then (2) put your desired nighttime setting in the daytime field, and your desired daytime setting in the nighttime field.

(I'll look through the source code and come back with an update if necessary.)
Yes, that makes sense.
Jud McCranie is offline   Reply With Quote
Old 2008-11-13, 00:50   #4
Jud McCranie
 
Jud McCranie's Avatar
 
Oct 2007

5A16 Posts
Default

Of course, it would be better for Prime95 to point that out and ask if you want to swap the times. Quite a few people are up after midnight.
Jud McCranie is offline   Reply With Quote
Old 2008-11-13, 08:43   #5
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

1D3D16 Posts
Default

Quote:
Originally Posted by Jud McCranie View Post
There seems to be a bug in the CPU "daytime" hours. I wanted daytime to go from 10:30 am to 1:30 am - the hours when I may be working. If the second time is after midnight the program swaps the start and end times.
I presume you wanted a 15 hour daytime period. If the code did not do that, then I need to fix it. I'll look at it when I get back from vacation.
Prime95 is offline   Reply With Quote
Old 2008-11-13, 12:02   #6
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

10AB16 Posts
Default

Quote:
Originally Posted by Prime95 View Post
I presume you wanted a 15 hour daytime period. If the code did not do that, then I need to fix it. I'll look at it when I get back from vacation.
Quote:
Originally Posted by cheesehead View Post
In source module commonc.c, there's:

Code:
 if (day_start_time > day_end_time) {
  temp = day_memory; day_memory = night_memory; night_memory = temp;
  temp = day_start_time; day_start_time = day_end_time; day_end_time = temp;
I'd guess it was coded like that assuming people would accidentally put the two values in the wrong spot and so it swaps them, but apparently that means you can't set the night time values to happen past midnight. Did it used to be like this? I don't think so...I recall having night set to 10 pm to 6 am and it seemed to respect the values correctly.
Mini-Geek is offline   Reply With Quote
Old 2008-11-13, 14:53   #7
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

3·5·499 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
Did it used to be like this? I don't think so....
I'll have to check out the source control system when I return from vacation.
Prime95 is offline   Reply With Quote
Old 2008-11-13, 15:58   #8
Jud McCranie
 
Jud McCranie's Avatar
 
Oct 2007

1328 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
I'd guess it was coded like that assuming people would accidentally put the two values in the wrong spot and so it swaps them, but apparently that means you can't set the night time values to happen past midnight. Did it used to be like this? I don't think so...I recall having night set to 10 pm to 6 am and it seemed to respect the values correctly.
I don't know if it used to be like that or not. Just after I upgraded to version 25 I went through the options and I noticed that the 10:30am (daytime start) and 1:30am (daytime end) were backwards. I thought "why did I put it in that way?" After I changed them I noticed that the program automatically reversed them.
Jud McCranie is offline   Reply With Quote
Old 2008-11-13, 19:59   #9
cheesehead
 
cheesehead's Avatar
 
"Richard B. Woods"
Aug 2002
Wisconsin USA

1E0C16 Posts
Default

Quote:
Originally Posted by cheesehead View Post
In source module commonc.c
... version 25.7, I should have specified.

In version 24.13, module commonc.c does not have such code, but commonb.c has:

Code:
/* Return memory available now */
/* Compute the time where we must halt processing to change the */
/* amount of available memory. */ 
unsigned int avail_mem (void)
{
 time_t t;
 struct tm *x;
 unsigned int curtime;
/* Set flag indicating we are using a lot of memory */
 HIGH_MEMORY_USAGE = TRUE;
/* If the same memory is available both day and night, then return */
/* that value and note that we won't have to stop in the future. */
 if (DAY_MEMORY == NIGHT_MEMORY) {
  STOP_TIME = 0;
  return (DAY_MEMORY);
 }
/* Determine whether it is daytime or nighttime. */
/* Return corresponding available memory. */
/* Set timer for when daytime or nighttime ends. */
 time (&t);
        x = localtime (&t);
 curtime = x->tm_hour * 60 + x->tm_min;
 if (DAY_START_TIME < DAY_END_TIME) {
  if (curtime < DAY_START_TIME) {
   STOP_TIME = t + (DAY_START_TIME - curtime) * 60;
   return (NIGHT_MEMORY);
  } else if (curtime < DAY_END_TIME) {
   STOP_TIME = t + (DAY_END_TIME - curtime) * 60;
   return (DAY_MEMORY);
  } else {
   STOP_TIME = t + (DAY_START_TIME + 1440 - curtime) * 60;
   return (NIGHT_MEMORY);
  }
 } else {
  if (curtime < DAY_END_TIME) {
   STOP_TIME = t + (DAY_END_TIME - curtime) * 60;
   return (DAY_MEMORY);
  } else if (curtime < DAY_START_TIME) {
   STOP_TIME = t + (DAY_START_TIME - curtime) * 60;
   return (NIGHT_MEMORY);
  } else {
   STOP_TIME = t + (DAY_END_TIME + 1440 - curtime) * 60;
   return (DAY_MEMORY);
  }
 }
}
(Did that have the same practical effect? When I try to figure it out in my head without writing down, there's a spinning sensation ... I'll go for a walk. :-)

Last fiddled with by cheesehead on 2008-11-13 at 20:16
cheesehead is offline   Reply With Quote
Old 2008-11-13, 21:16   #10
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

426710 Posts
Default

day start = 11:00 am
day end = 10:00 am
current time = 10:30 am
Code:
if (11:00 < 10:00) {
//false
  } else {
  if (10:30 < 10) {
//false
  } else if (10:30 < 11:00) {
//true
   STOP_TIME = t + (11:00 - 10:30) * 60;
   return (NIGHT_MEMORY);
  }
I don't think it's the same. Looks like if you have the day start after the day end and the current time is between the two (in this case, 11 am, 10 am, 10:30 am respectively. Using the example of the OP's times, we could say 10:30 am, 1:30 am, and 6 am respectively, which would be expected to be night), it returns the night memory like it's supposed to.
Mini-Geek is offline   Reply With Quote
Old 2008-11-13, 22:19   #11
cheesehead
 
cheesehead's Avatar
 
"Richard B. Woods"
Aug 2002
Wisconsin USA

22×3×641 Posts
Default

A little walk can do wonders for clearing ones mind.

Quote:
Originally Posted by Mini-Geek View Post
day start = 11:00 am
day end = 10:00 am
current time = 10:30 am
Code:
if (11:00 < 10:00) {
//false
  } else {
  if (10:30 < 10) {
//false
  } else if (10:30 < 11:00) {
//true
   STOP_TIME = t + (11:00 - 10:30) * 60;
   return (NIGHT_MEMORY);
  }
I don't think it's the same.
Doesn't your example show that at 10:30 am, the night setting is used by v24?

That's the same as v25 does. After exchanging day start and end times, it exchanges day and night memory allocations. Thus, at 10:30 am, v25 will consider it to be "day"time, and so will then use the memory allocation that the user originally specified for night, which had been exchanged into the "day" allocation slot.

Quote:
Looks like if you have the day start after the day end and the current time is between the two (in this case, 11 am, 10 am, 10:30 am respectively.
Right -- so in v24 it will at that time (10:30 am) use the "night"time memory allocation. So would v25, but accomplished via different means.

Quote:
Using the example of the OP's times, we could say 10:30 am, 1:30 am, and 6 am respectively, which would be expected to be night), it returns the night memory like it's supposed to.
Correct, in either v24 or v25.

- - -

To anyone still confused: Take a little walk; draw a couple of deep breaths; return.
cheesehead is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stockfish game: "Move 8 poll", not "move 3.14159 discussion" MooMoo2 Other Chess Games 5 2016-10-22 01:55
"Master" and "helper" threads Madpoo Software 0 2016-09-08 01:27
Aouessare-El Haddouchi-Essaaidi "test": "if Mp has no factor, it is prime!" wildrabbitt Miscellaneous Math 11 2015-03-06 08:17
Would Minimizing "iterations between results file" may reveal "is not prime" earlier? nitai1999 Software 7 2004-08-26 18:12

All times are UTC. The time now is 06:57.

Sun May 9 06:57:12 UTC 2021 up 31 days, 1:38, 0 users, load averages: 2.15, 1.96, 2.18

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.