Prime Numbers

Message boards : Number crunching : Prime Numbers

To post messages, you must log in.

AuthorMessage
Allen Paschke

Send message
Joined: 27 Jan 18
Posts: 23
Credit: 8,176,088
RAC: 812
   
Message 1262 - Posted: 26 Oct 2019, 13:50:45 UTC

Each time An Amicable Numbers 10^21 task is run, all the prime numbers < 10^11 need to be stored in memory.

Are all the prime numbers < 10^11 computed each time a 10^21 task is run?
If so, is it possible to store all the prime numbers < 10^11 in a file, such as Primes.txt at c:\ProgramData\BOINC\projects\sech.me_boinc_Amicable?

Under Amicable Number preferences, there would be 3 choices
- Amicable Numbers up to 10^21, create Prime Table --- This task would be run only once
- Amicable Numbers up to 10^21 --- Each task would compute all the prime numbers < 10^11
- Amicable Numbers up to 10^21, Prime Table Exists --- The logic would have to be modified to access the Prime Table rather than compute all the prime numbers < 10^11.
ID: 1262 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Sergei Chernykh
Project administrator
Project developer

Send message
Joined: 5 Jan 17
Posts: 459
Credit: 72,451,573
RAC: 0
   
Message 1263 - Posted: 26 Oct 2019, 15:56:06 UTC - in response to Message 1262.  

I prefer not to store prime table on disc as it can get corrupt/overwritten either occasionally or maliciously.
ID: 1263 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Allen Paschke

Send message
Joined: 27 Jan 18
Posts: 23
Credit: 8,176,088
RAC: 812
   
Message 1267 - Posted: 27 Oct 2019, 15:42:10 UTC - in response to Message 1263.  

I understand your concerns regarding corruption/overwriting of a prime table; however, there are steps which can be taken to manage this and minimize the possibility of corruption/overwriting occurring.

- When the prime table is loaded into an Amicable Numbers task, verify that the number of prime numbers is correct and utilize some type of check sum.
If the number of prime numbers or check sum is incorrect, regenerate the prime table.
- Automatically replace and regenerate the prime table on a specific interval, such as when you encounter a prime table that is older than 7, 14 or 28, etc. days.
The date and time of when the prime table was generated can be the first record on the prime table.
- Each Amicable Numbers task is run twice, as a double check.
When the double check task doesn't agree with the first run, run the task a third time.

When I think of how much time my computer spends each month generating the same prime table for each Amicable Numbers task, it is a huge amount of my computer's CPU time. Yes, it is possible that a minimal number of Amicable Pairs may not be found; however, it will really speed up 10^21 and allow getting to 10^22 much faster.
ID: 1267 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Speedy

Send message
Joined: 6 Jun 17
Posts: 61
Credit: 106,757,761
RAC: 13,982
   
Message 1268 - Posted: 28 Oct 2019, 0:29:34 UTC - in response to Message 1267.  

however, it will really speed up 10^21 and allow getting to 10^22 much faster.

Alan how much quicker do you think it would allow us to move onto 10^22? I am not sure that speed is the name of the game here
ID: 1268 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Allen Paschke

Send message
Joined: 27 Jan 18
Posts: 23
Credit: 8,176,088
RAC: 812
   
Message 1270 - Posted: 28 Oct 2019, 15:59:47 UTC - in response to Message 1268.  

You asked a good question. This is hard to estimate because an Amicable Numbers task does not provide any information regarding when it's computing and loading the prime table vs. when it's searching for amicable pairs.

I run Amicable Numbers on two PCs in CPU mode, each using 3 CPUs. Each task requires about 6 hours elapsed time to run, so 8 tasks are run daily across the 2 PCs. I run 8 tasks daily, 56 runs weekly, 240 tasks monthly.

At least for the first hour of each CPU task, if not longer, the prime table is being computed and loaded. During this time period on my PC, my memory utilization is very high and other apps response time is very slow. If the first hour of each task is computing and loading the prime table, then 1 hour could be saved on each task if the prime table were just simply loaded. This would result in a 16.7% reduction in CPU time per task, allowing me to run 288 tasks monthly vs. 240 monthly. If the CPU time to compute and load the prime table is longer than 1 hour, then the savings would be greater.

For a GPU task, it is my understanding that the prime table is loaded using CPU, then the search for amicable pairs is done using GPU. The savings for loading the prime table directly into a GPU task may be more significant.
ID: 1270 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Sergei Chernykh
Project administrator
Project developer

Send message
Joined: 5 Jan 17
Posts: 459
Credit: 72,451,573
RAC: 0
   
Message 1271 - Posted: 28 Oct 2019, 16:23:10 UTC - in response to Message 1270.  

If it takes 1 hour to compute prime table, you're doing something seriously wrong. It usually takes no more than 1 minute and is done on a single CPU core, then it starts using all CPU cores, so it's easy to notice how much time it takes.
ID: 1271 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote
Speedy

Send message
Joined: 6 Jun 17
Posts: 61
Credit: 106,757,761
RAC: 13,982
   
Message 1272 - Posted: 28 Oct 2019, 20:59:19 UTC - in response to Message 1271.  

If it takes 1 hour to compute prime table, you're doing something seriously wrong. It usually takes no more than 1 minute and is done on a single CPU core, then it starts using all CPU cores, so it's easy to notice how much time it takes.

Thanks Alan for your detailed description below. I honestly cannot see task processing been increased a a lot because of the message above.
ID: 1272 · Rating: 0 · rate: Rate + / Rate - Report as offensive    Reply Quote

Message boards : Number crunching : Prime Numbers


©2022 Sergei Chernykh