|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
DoubleMark (Prime Benchmark) - Open Source
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#41 (permalink) | |||||||||||||||
|
Luck : 10pts
![]() |
Quote:
Code:
while (Continue == true) // ///////////////////////Benching loop
{
if (CurrentDivisor > (CurrentNumber / 2)) // ///////Skip if larger then half
{
CurrentNumber += RelInc;
CurrentDivisor = 2;
ThisPrimes += 1;
}
if (CurrentNumber > (TestLength - 1))
{
if (ThreadCount == 1)
{
FoundPrimes += ThisPrimes;
Time2 = (Convert.ToDecimal(DateTime.Now.Millisecond)
+ (Convert.ToDecimal(DateTime.Now.Second) * 1000)
+ (Convert.ToDecimal(DateTime.Now.Minute) * 60000)
+ (Convert.ToDecimal(DateTime.Now.Hour) * 3600000)) - Time;
MessageBox.Show("Time to complete : "
+ Convert.ToString(Time2)
+ "ms - Prime Numbers found : "
+ Convert.ToString(FoundPrimes));
Rad1.Enabled = true;
Rad2.Enabled = true;
Rad3.Enabled = true;
Rad4.Enabled = true;
Rad5.Enabled = true;
Rad6.Enabled = true;
Rad7.Enabled = true;
Rad8.Enabled = true;
Rad9.Enabled = true;
Rad10.Enabled = true;
Rad11.Enabled = true;
Rad12.Enabled = true;
Rad13.Enabled = true;
Rad14.Enabled = true;
Rad15.Enabled = true;
Btn2.Enabled = true;
Btn1.Text = "Benchmark";
Btn1.Enabled = true;
FoundPrimes = 1;
progressBar1.Value = 0;
ThreadsFinished = 0;
Continue = false;
Thread.CurrentThread.Abort();
}
else
{
if (ThreadsFinished == (ThreadCount - 1))
{
FoundPrimes += ThisPrimes;
Time2 = (Convert.ToDecimal(DateTime.Now.Millisecond)
+ (Convert.ToDecimal(DateTime.Now.Second) * 1000)
+ (Convert.ToDecimal(DateTime.Now.Minute) * 60000)
+ (Convert.ToDecimal(DateTime.Now.Hour) * 3600000)) - Time;
MessageBox.Show("Time to complete : "
+ Convert.ToString(Time2)
+ "ms - Prime Numbers found : "
+ Convert.ToString(FoundPrimes));
Rad1.Enabled = true;
Rad2.Enabled = true;
Rad3.Enabled = true;
Rad4.Enabled = true;
Rad5.Enabled = true;
Rad6.Enabled = true;
Rad7.Enabled = true;
Rad8.Enabled = true;
Rad9.Enabled = true;
Rad10.Enabled = true;
Rad11.Enabled = true;
Rad12.Enabled = true;
Rad13.Enabled = true;
Rad14.Enabled = true;
Rad15.Enabled = true;
Btn2.Enabled = true;
Btn1.Text = "Benchmark";
Btn1.Enabled = true;
FoundPrimes = 1;
progressBar1.Value = 0;
ThreadsFinished = 0;
Continue = false;
Thread.CurrentThread.Abort();
}
else
{
FoundPrimes += ThisPrimes;
ThreadsFinished += 1;
Continue = false;
Thread.CurrentThread.Abort();
}
}
}
if (Decimal.Round(CurrentNumber / CurrentDivisor, 0) == (CurrentNumber / CurrentDivisor)
| Decimal.Round(CurrentNumber / CurrentDivisor, 0) - 1 == (CurrentNumber / CurrentDivisor))
{
CurrentDivisor = 2;
CurrentNumber += RelInc;
if (Convert.ToDecimal(ThreadNumber) == 1)
{
progressBar1.Value = Convert.ToInt32((CurrentNumber / TestLength) * 100); //
}
}
else
{
CurrentDivisor += 1;
}
}
Quote:
YIM/MSN : dager332@yahoo.com Xfire : dekustars We can talk more there. Or over PM (not preferred) if you don't have any messengers. I do need help working on an algorithm at the moment... quite complex...
__________________
|
|||||||||||||||
|
|
|
|
#42 (permalink) | |||||||||||||
|
With great difficulty
![]() |
That really only tests the floating point divide performance, which is an extremely slow and relatively uncommon instruction. I hate to say it so bluntly, but that's a pretty bad benchmark. Is that the entire thing?
__________________
|
|||||||||||||
|
|
|
|
#43 (permalink) | |||||||||||||
|
Luck : 10pts
![]() |
I'm adding more tests next build. For the most part of the code that is it. You can of course change the division to multiplication. Quite easily actually. I was not aware that division was a complicated instruction for the CPU to carry out. That and the fact its a floating point instruction gives AMD a massive advantage if i remember correctly... Hm. Anyways might as well spill it i'm working on multi-threaded pi calculation among other things.
__________________
|
|||||||||||||
|
|
|
|
#44 (permalink) | ||||||||||||||
|
With great difficulty
![]() |
Quote:
|
||||||||||||||
|
|
|
|
#45 (permalink) | |||||||||||||
|
Luck : 10pts
![]() |
Very interesting information. So turn division into multiplication (simple enough) and avoid numbers 3, 5, and 38 and you should notice decent-great performance gains?
__________________
|
|||||||||||||
|
|
|
|
#46 (permalink) | |||||||||||||
|
Off By 340 Undecillion
![]() |
Just a few nitpicks on the algorithm, you only need to check up to the square root of the number in question, not half the number. Also, If you wanted to keep the calculations in integers you can use the remainder function to see if a number evenly divides (remainder = 0)
|
|||||||||||||
|
|
|
|
#47 (permalink) | ||||||||||||||
|
Luck : 10pts
![]() |
Quote:
__________________
|
||||||||||||||
|
|
|
|
#48 (permalink) | ||||||||||||||
|
With great difficulty
![]() |
Quote:
The focus isn't be getting it to run as fast as possible. A good benchmark should try to test common instructions, weighted by how common they are. The instructions you test would depend on what kind of benchmark you want. Real-world apps tend to use different instructions than multimedia apps or scientific apps, for example Anything with a decimal is stored as a floating point number. Floating point instructions are generally a good bit slower than integer
|
||||||||||||||
|
|
|
|
#49 (permalink) | |||||||||||||||
|
Luck : 10pts
![]() |
Quote:
Quote:
__________________
|
|||||||||||||||
|
|
|
|
#50 (permalink) | ||||||||||||||
|
With great difficulty
![]() |
Quote:
|
||||||||||||||
|
|
![]() |
| Tags |
| benchmark, doublemark, doublemark topic, multi-thread, stress test |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|