Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: OpenCL: "Hello World" adapted from Apple code [Updated Sep 04 2011]

  1. #11

    Re: OpenCL: "Hello World" adapted from Apple code

    Hi Petr,

    Your 15 incorrect results are almost certainly caused by the SINGLE precision multiply in the GPU.

    A 32 bit float has 1 sign bit 8 exponent bits and that leaves 23 bits for the significand
    but this may be further affected by the GPU rounding behaviour.

    Info on floating point formats:

    http://en.wikipedia.org/wiki/Single_...g-point_format

    Charles

    PS: I have your program working inside Oxygen with your OpenCL headers and very few alterations
    Will post soon.


  2. #12

    Re: OpenCL: "Hello World" adapted from Apple code

    Hi Petr,

    I am now getting 100% correct results by assigning data()^2 and results() to SINGLE variables then comparing them.
    So I exonerate the GPU from any rounding anomalies.

    Oxygen Code:
    [code=thinbasic]

    ' Validate our results

    correct = 0
    single r,d
    '
    For i = 1 To count
    r=results(i)
    d=dat(i) * dat(i)
    If r=d Then
    correct += 1
    Else
    'PrintL Round(results(i), 6), Format$(Round(dat(i) * data(i), 6))
    if len(s)<1000 then s+=d tab r crlf
    End If
    Next

    [/code]

  3. #13
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: OpenCL: "Hello World" adapted from Apple code

    Hi Charles,

    very interesting, thanks for the info
    I tried to mod the thinBASIC code to the approach you proposed, but I still get mismatch.
    Could you check the code from the first post if I ported it correctly?

    I am looking forward to Oxygen version!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  4. #14

    Re: OpenCL: "Hello World" adapted from Apple code


    Hi Petr,

    I confirm there is still a precision matching problem in thinBasic and I get the same result as before.

    I've just posted the Oxygen OpenCL_HelloWorld with the latest Oxygen which now supports
    BYVAL 0
    BYREF ANY
    Also fixed a few other problems relating to BYVAL quads.

    Support for EXT variables requires further work but I have redefined EXT as DOUBLE in the main source code, without altering your header files in any way.


    So you will need both Oxygen and OpenCL zips.

    http://community.thinbasic.com/index.php?topic=2517

  5. #15
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: OpenCL: "Hello World" adapted from Apple code

    Thanks Charles!

    worked perfectly. Only problem is that in case error occurs (try to change kernel name to some nonsense), it GPFs in Oxygen. But maybe it is caused by fact the Oxygen version does not stop on an error, which will be easy to fix.


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  6. #16

    Re: OpenCL: "Hello World" adapted from Apple code

    Glad it worked on your system Petr.

    Stopping on an error: my favourite use of GOTO

  7. #17
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Re: OpenCL: "Hello World" adapted from Apple code

    Quote Originally Posted by Charles Pegge
    Hi Petr,

    I get correct 1009/1024 computed 1009/1024
    I got the same result tonight Petr.

    Charles, yours ran fine too and I got 1024/1024.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  8. #18

    Re: OpenCL: "Hello World" adapted from Apple code


    You may be interested in following this thread on the FreeBasic Forum.



    Any NVIDIA OpenCL CUDA or AMD/ATI Stream coder here ?
    D J Peters
    http://www.freebasic.net/forum/viewtopic.php?t=15103

Page 2 of 2 FirstFirst 12

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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