Results 1 to 4 of 4

Thread: C# with GPU?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    297

    C# with GPU?

    So I decided to upgrade my code from vb to C#, to see if I can get this to work.


    My program generates random words. (Just a for loop on a array that changes A to H or any other letter) <---- This is on a fuction BTW.

    Now running this on my CPU (i7 920) generates me about 200 words a sec. Now thats kinda fast, but not as fast as I want. I heard about GPU calculation and I'm wondering how can I do that on C#

    Im using VS 2010 ona i7 920 with a ATI 5770 Sapphire Card. I know it supports OpenCL.

    Any help would be great.

    Thanks

  2. #2
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: C# with GPU?

    I don't think that sounds like the sort of thing that a GPU would be much help with.

    200 words/sec doesn't sound very fast for what I'm understanding the function does. Can you post that code and we'll see if there are any obvious speed ups?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2008
    Posts
    297

    Re: C# with GPU?

    Quote Originally Posted by Evil_Giraffe View Post
    I don't think that sounds like the sort of thing that a GPU would be much help with.

    200 words/sec doesn't sound very fast for what I'm understanding the function does. Can you post that code and we'll see if there are any obvious speed ups?
    Here it is

    It's just a simple for loop with 4 if statements inside of it. I did the best solution I could think of.

    So I really cant speed up the process with my GPU?

    PS. Here is the code

    Code:
        Private Sub brain()
            Dim _str() As Char = {" "}
            Dim _len As Integer = _str.Length
            Dim rHash As String
    
            For i = 0 To 3
                If (_str(_len - 1) >= Chr(127)) Then
                    For q = _len - 1 To 0 Step -1
                        If (AscW(_str(q)) >= 127) Then
                            If (q = 0) Then
                                ReDim _str(_len)
                                For p = _len To 0 Step -1
                                    _str(p) = Chr(32)
                                Next
                                _len += 1
                            Else
                                _str(q) = Chr(32)
                                _str(q - 1) = Chr(AscW(_str(q - 1)) + 1)
                            End If
                        End If
                    Next
                End If
                // My Work is here, to save this
                _str(_len - 1) = Chr(AscW(_str(_len - 1)) + 1)
                i = 1 //Infinite loop!
            Next
        End Sub
    Here is my vb.net code, the Syntax is the same except the { }.
    Last edited by simon66; Feb 6th, 2012 at 03:47 PM.

  4. #4
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: C# with GPU?

    May I ask what you are using this for?
    Judging by its output it's not just a word generator. I'd rather say it's a brute-forcer of some kind.
    Delete it. They just clutter threads anyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width