mersenneforum.org  

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

Reply
 
Thread Tools
Old 2009-09-11, 14:18   #1
lycorn
 
lycorn's Avatar
 
Sep 2002
Oeiras, Portugal

145210 Posts
Default P-1 with 2 threads?

Quick question:
On a Core 2 Duo, is it a good option to run one P-1 worker window with two threads? I mean, is the P-1 software multithreaded the same way LL is?
Although for LL tests it is generally better to run separate tests on separate cores, running two simultaneous windows of P-1 would lead to a substantial reduction in the amount of memory available for each test, and probably to some competition for memory access, which makes me unsure about the best option in this case.
Thx in advance.
lycorn is offline   Reply With Quote
Old 2009-09-11, 15:09   #2
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts
Default

Stage 1: Yes, can multithread
Stage 1 GCD: No, can't multithread
Stage 2: Yes, can multithread
Stage 2 GCD: Haven't checked, but almost certainly: No, can't multithread

P-1 uses the same FFT code that the LL does, so it's multithreaded too. While we're on the subject, TF (and, apparently, the GCD code) isn't based on the FFT, and it can't be multithreaded.

Prime95 actually tells you the FFT length it's using for stage 1 and 2, which you can compare to a benchmark of your machine to tell you how much faster you can do one P-1 over 2 threads compared to 2 separate P-1s over 1 thread each. That would help with figuring if it'd be better to do that instead.
Mini-Geek is offline   Reply With Quote
Old 2009-09-11, 16:04   #3
lycorn
 
lycorn's Avatar
 
Sep 2002
Oeiras, Portugal

22·3·112 Posts
Default

Thanks for your reply, Mini-Geek.
In fact, if I just compare the FFT timings provided by the benchmarks, it seems that running two instances of P-1, each on a different core, would be better than one multithreaded test, which is the "expectable" result.
Now P-1 stage 2 uses a lot of memory. As the functionality that will allow the allocation of a specific amount of memory to a specific worker window is not yet available, according to http://="http://www.mersenneforum.or...&postcount=44", I suspect that each worker will try to reserve as much memory as declared available in Prime95´s GUI, which will lead to process stalling, most probably. With that functionality enabled, this problem will be mitigated, but there will be much less memory available for each test, compared to running a single multithreaded test.
That´s why I ask this question, before start wasting processing time to reach conclusions that are probably already known to some forum participants.
lycorn is offline   Reply With Quote
Old 2009-09-11, 17:58   #4
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

426710 Posts
Default

Quote:
Originally Posted by lycorn View Post
Thanks for your reply, Mini-Geek.
In fact, if I just compare the FFT timings provided by the benchmarks, it seems that running two instances of P-1, each on a different core, would be better than one multithreaded test, which is the "expectable" result.
I'm not surprised by the time difference a bit, (AFAIK no parallelized FFT code is over 2x as fast on 2 cores at a time - the benefits of multithreading are certainly not directly efficiency) but have you considered the higher B1 and B2 bounds, (and so better chance of finding a factor) and more relative primes at a time, that could be done with the higher memory? I'd guess that the difference would come down to a "which is more important to you" question than a certain answer one way or the other.
Quote:
Originally Posted by lycorn View Post
Now P-1 stage 2 uses a lot of memory. As the functionality that will allow the allocation of a specific amount of memory to a specific worker window is not yet available, according to ="http://www.mersenneforum.org/showpost.php?p=182643&postcount=44", I suspect that each worker will try to reserve as much memory as declared available in Prime95´s GUI, which will lead to process stalling, most probably. With that functionality enabled, this problem will be mitigated, but there will be much less memory available for each test, compared to running a single multithreaded test.
That´s why I ask this question, before start wasting processing time to reach conclusions that are probably already known to some forum participants.
No, they share nicely. It's true that you can't set a separate amount for each, but the way it works it out is fine. e.g. if you allow 700 MB total, and two workers want to run stage 2 at the same time, they'll each take ~350 MB. After one finishes, the other will use the full 700 MB (it can't readjust the B1 and B2 since it's already mid-test, but it'll run more relative primes at once to fill the memory).
Quote:
Originally Posted by Mini-Geek View Post
P-1 uses the same FFT code that the LL does, so it's multithreaded too. While we're on the subject, TF (and, apparently, the GCD code) isn't based on the FFT, and it can't be multithreaded.
I should clarify that this doesn't mean that the TF and GCD code for some reason can't be multithreaded, rather that Woltman hasn't (yet) made them multithreaded. And that when the FFT code for LLs became multithreaded, that also allowed multithreading of P-1/ECM's stage 1 and 2, but no such work has been put towards multithreading the TF and GCD work. (or if it has been worked on, hasn't been completed and implemented)

Last fiddled with by Mini-Geek on 2009-09-11 at 18:26
Mini-Geek is offline   Reply With Quote
Old 2009-09-12, 22:46   #5
lycorn
 
lycorn's Avatar
 
Sep 2002
Oeiras, Portugal

22·3·112 Posts
Default

Thanks again. No , your answer was very informative and welcome
Actually, it is in line with my previous feeling that running just one P-1 worker with 2 threads would be a good option, because more memory is then available for the test. And it was interesting to learn that 2 workers share the memory in a fair way, even if we don´t enforce it on the client.
lycorn is offline   Reply With Quote
Old 2009-09-13, 02:53   #6
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

7,411 Posts
Default

P-1 and ECM are not good candidates for multithreading. Unlike LL tests, P-1 and ECM do additions and subtractions of these big numbers. These operations are not multithreaded.
Prime95 is offline   Reply With Quote
Old 2009-09-13, 03:06   #7
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17×251 Posts
Default

Quote:
Originally Posted by Prime95 View Post
P-1 and ECM are not good candidates for multithreading. Unlike LL tests, P-1 and ECM do additions and subtractions of these big numbers. These operations are not multithreaded.
Then why is it that when I set the number of threads to 2 the CPU usage goes from 50 to 99, Prime95 says it's using two threads, and the times drop just like the benchmarks suggest they should? I mean, hey, you're in a position to know and be right about what you're saying, but my experiments show just the opposite, so...I don't know what's up.
Mini-Geek is offline   Reply With Quote
Old 2009-09-13, 03:19   #8
lfm
 
lfm's Avatar
 
Jul 2006
Calgary

52·17 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
Then why is it that when I set the number of threads to 2 the CPU usage goes from 50 to 99, Prime95 says it's using two threads, and the times drop just like the benchmarks suggest they should? I mean, hey, you're in a position to know and be right about what you're saying, but my experiments show just the opposite, so...I don't know what's up.
How long did you watch it? There could be another time scale involved.
lfm is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use more threads? physicist PrimeNet 2 2018-01-10 17:07
How to use all threads (i7-920) petsoukos Software 2 2013-06-04 20:33
Workers, Threads, Helper Threads, Cores, Affinity. lorgix Information & Answers 12 2011-01-13 22:31
How can I close my own threads? petrw1 Information & Answers 1 2007-09-25 21:02
No threads or posts from me! mfgoode Forum Feedback 10 2007-03-22 16:32

All times are UTC. The time now is 05:43.

Mon Apr 19 05:43:47 UTC 2021 up 11 days, 24 mins, 0 users, load averages: 1.53, 1.50, 1.52

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.