1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Simple WCG PPD Estimator

Discussion in 'World Community Grid (WCG)' started by [Ion], Dec 21, 2009.

  1. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,416 (6.27/day)
    Thanks Received:
    3,395
    Location:
    IA, USA
    FYI, I spent days trying to figure out the actual clockspeed on my processor using the .NET framework and it wasn't going to happen. I concluded that, in order to obtain the clockspeed, I would have to buy the source from CPUID in order to pull the correct memory addresses and perform the necessary calculations to get the correct values.

    The best I could come up with is grabbing it from the registry:
    HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor

    However, on my processor, it reports 1.6 GHz or 2.66 GHz when it should be 2.79 GHz.



    Suggestion: Why not make the CPU do mock work that BOINC does, crunch a few numbers, then estimate it over x number of hours at y % CPU usage? That way, it would be processor indepenedant. You should have enough information to create a forumla that gets close.

    As far as I know, a bunch of double precision multiply and divide should suffice for simulating work.
    PVTCaboose1337 says thanks.
    Crunching for Team TPU
  2. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    Yeah I tried grabbing it from the registry but it is sadly not even close. Says my laptop is at 700MHz so I was kinda confused. The user entering it in manually might be the best choice still.
  3. [Ion]

    [Ion] WCG Team Assistant

    Joined:
    Sep 15, 2009
    Messages:
    11,787 (6.54/day)
    Thanks Received:
    10,889
    Location:
    North Carolina, United States
    Well, if it gives bogus values like that, having the user enter it manually probably makes the most sense: if the program gives values that aren't even close to the real values, then it's not very useful
    Crunching for Team TPU
  4. mosheen

    mosheen

    Joined:
    Jun 29, 2009
    Messages:
    321 (0.17/day)
    Thanks Received:
    55
    i think user input is better,
    user can input different speed and get an idea if overclocking is worth it or not
    Last edited: Feb 28, 2010
    [Ion] says thanks.
  5. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    Ok ends up that my error checking was severely flawed, and nobody ever caught it because nobody put in 9000 MHz as their CPU frequency. So, to fix this for now, I will take out error checking until I get my homework done. When I am finished I will find a good solution to the problem.

    Edit: Expect a new version at 6pm.

    Attached Files:

  6. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,416 (6.27/day)
    Thanks Received:
    3,395
    Location:
    IA, USA
    A suggestion on that too:

    If the input is invalid, set the usercontrol's BackColor to Pink. If the input is valid, set it to White. Do this in the TextChanged event. For example:
    Code:
    Private Sub txtClockSpeed_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles txtClockSpeed.TextChanged
      Try
        Convert.ToUInt16(txtClockSpeed.Text)
        txtClockSpeed.BackColor = Color.White
      Catch
        txtClockSpeed.BackColor = Color.Pink
      End Try
    End Sub
    Prior to actually using the data (your calculate button), make sure all nececessary BackColors are not Pink.
    Crunching for Team TPU
  7. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    I will try adding this in later. I have tried to do this:

    Code:
    Private Sub Text1_Keypress(KeyAscii As Integer)
    Dim str As String
    
    str=".0123456789"
    If KeyAscii>26 then
       If Instr(str,chr(KeyAscii))=0 Then
           KeyAscii=0
       End if
    End If
    End Sub
    But it would simply not work.
  8. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,416 (6.27/day)
    Thanks Received:
    3,395
    Location:
    IA, USA
    Yeah, Try...Catch is much better. It will throw an exception, and subsequently catch it, if the conversion failed. ;)
    Crunching for Team TPU
  9. 3volvedcombat

    3volvedcombat New Member

    Joined:
    May 10, 2009
    Messages:
    1,514 (0.78/day)
    Thanks Received:
    261
    Location:
    South California, The desert.
    It said i would producting
    [​IMG]
    Thats what it estimated for my WCG

    Nice little program :)
  10. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    Happy to see it works! 0.1.0 should be flawless, minus error correction which I will add later.
  11. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,416 (6.27/day)
    Thanks Received:
    3,395
    Location:
    IA, USA
    Three more suggestions:
    1) Autocheck BOINC version according to CPU architecture. This can be done via:
    Code:
    System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")
    If the result is equal to "x86", it is a 32-bit OS. If the result is equal to "AMD64", it is a 64-bit OS.

    Taking it a step further, find boinc.exe or wcg.exe (not sure on that one) and detect if it is running 32-bit or not. I'm not certain this is possible though...


    2) Auto-clear Speed and Usage when someone clicks in it. If Text = "MHz", Text = "" on text change, for example.

    3) Maybe accept GHz or MHz. If there is no decimal point, assume MHz. If there is a decimal point, assume GHz. I can type up some code for that too if you want it.
    Crunching for Team TPU
  12. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    I was going to have it find boinc.exe or wcg.exe but I realized some people install them in different places.

    I did not put in auto checking for a 32 bit or 64 bit cpu cause some people run 32 bit boinc instead of 64 on their 64 bit system.

    And for the ghz or mhz thing, I think I will stick to mhz only.

    Edit: Regarding processor architecture, I realized that the mobile versions on the C2D were thought of the same as the desktop time.
  13. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    Also, here is the latest version.

    EDIT: FordGT90Concept, you are in the credits.

    Attached Files:

  14. Delta6326

    Delta6326

    Joined:
    May 21, 2008
    Messages:
    3,824 (1.67/day)
    Thanks Received:
    667
    Location:
    Iowa, USA
    i was wandering if you could put in how long it would take to get the number it says like a i7 at 100% is around 22k but how long does it take to do that like in a hour, 22hours
    . you know
  15. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,416 (6.27/day)
    Thanks Received:
    3,395
    Location:
    IA, USA
    It was a lot of work but I finally cracked it:
    Code:
        Private Declare Function IsWow64Process Lib "kernel32" (ByVal hProcess As IntPtr, ByRef Wow64Process As Boolean) As Int32
        Public Function IsRunningApp64Bit(ByVal name As String) As Boolean
            If Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") = "AMD64" Then
                Dim processes As Process() = Process.GetProcessesByName(name)
                If processes.Length > 0 Then
                    Dim wow64 As Boolean
                    Try
                        Dim ret As Int32 = IsWow64Process(processes(0).Handle, wow64)
                        If ret > 0 Then
                            If wow64 = False Then
                                Return True ' Not emulated (32-bit on 32-bit or 64-bit on 64-bit).
                            Else
                                Return False ' Emulated (32-bit on 64-bit).
                            End If
                        Else
                            Return False ' There was a problem.
                        End If
                    Catch
                        Return False ' Problem with getting process info.
                    End Try
                Else
                    Return False ' Process not found.
                End If
            Else
                Return False ' 32-bit OS.
            End If
        End Function
    Run it for "boinc" and also "wcg" (I think). If it returns true for either one of them, check 64-bit. If it does not, check 32-bit.


    Edit: Required imports:
    Code:
    Imports System

    Edit: I only have BOINC (64-bit) installed here so I don't know what the process name for WCG would be. Just make sure to drop the ".exe" and it should work.
    Last edited: Feb 28, 2010
    PVTCaboose1337 says thanks.
    Crunching for Team TPU
  16. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    I understand but an unsure if I want to add it in. The program is after all PPD Estimator, the units being in days!
  17. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    Ok I have decided to do this:

    Maybe one person has this calculator on 1 PC, and then they want to calculate their other PC's and not have to put this program on their computers, then this should work.

    NOW: I like the program F@HMon. Ever used it? It calculates the time a WU will take to complete, PPD, etc. If we start making this all automated, I will make a program like F@HMon for WCG, HOWEVER: Is there a program like this already? If not, I will start to automate all parts of the calculator and start work on WCGMon.
  18. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,416 (6.27/day)
    Thanks Received:
    3,395
    Location:
    IA, USA
    F@H just calculates F=ma over and over and over again. The workload doesn't change so it is easy to estimate how long each individual WU will take given how many calculations there are to perform. WCG/BOINC, on the other hand, handle a multitude of different kinds of tasks so it isn't easy to accurately estimate how long any given task will take to complete. Not to mention, WCG/BOINC already do this (see Tasks tab).



    By the way, I'd use that code to select the default BOINC type (32-bit or 64-bit). The user can easily check the other option if it isn't for their computer.


    Edit: Another suggestion:

    I assume the code to calculate the points isn't very intensive. As such, you could easily remove the Calculate button and make TextChanged, SelectedIndexChanged, and CheckedChanged all point to the Calculate code. That way, if everything is valid, it will calculate it as the information becomes available.
    Last edited: Feb 28, 2010
    Crunching for Team TPU
  19. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    Excellent idea, however, this might be problematic once your previous idea is implemented.
  20. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,416 (6.27/day)
    Thanks Received:
    3,395
    Location:
    IA, USA
    The 32-bit/64-bit code? That should occur only once on startup (in the Form constructor).
    Crunching for Team TPU
  21. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    Ok as promised:

    0.1.2: Many fixes. Please put in original post [Ion].

    EDIT: Also, FordGT90Concept, the button looks so pretty don't make me remove it! (I am changing code as we speak)
    EDIT2: O wow errors are flipping out, computer crashed... need to fix my error reporting badly!

    Attached Files:

    Black Panther says thanks.
  22. Black Panther

    Black Panther Senior Moderatorâ„¢ Staff Member

    Joined:
    May 30, 2007
    Messages:
    8,564 (3.24/day)
    Thanks Received:
    1,919
    Worked fine for me.
    Neat work!
    PVTCaboose1337 says thanks.
  23. PVTCaboose1337

    PVTCaboose1337 Graphical Hacker

    Joined:
    Feb 1, 2006
    Messages:
    9,513 (3.05/day)
    Thanks Received:
    1,142
    Location:
    San Antonio, Texas
    Now I want some screenshots if you don't mind. Try putting putting non-integers into the field, etc.

    EDIT: Look at what we did over a weekend guys!

    Screenshot is of all the versions of the program!

    [​IMG]

    Now, does anyone have an idea for a better UI?
    Last edited: Feb 28, 2010
  24. Black Panther

    Black Panther Senior Moderatorâ„¢ Staff Member

    Joined:
    May 30, 2007
    Messages:
    8,564 (3.24/day)
    Thanks Received:
    1,919
    I'm not sure if you were asking for something like this?

    [​IMG]
    Last edited: Feb 28, 2010
  25. FordGT90Concept

    FordGT90Concept "I go fast!1!11!1!"

    Joined:
    Oct 13, 2008
    Messages:
    13,416 (6.27/day)
    Thanks Received:
    3,395
    Location:
    IA, USA
    PropertyGrid! XD
    Crunching for Team TPU

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page