Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: calculation of a float value

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    8

    calculation of a float value

    Hi
    I am using my laptop with an intel graphics and a Intel CPU. So i Think the whole work is done by the CPU or? I am using a testprogram which calculates the result of a multiplication of two float values. The calculation is done in a openCL kernel and the result is checked in the normal c program but the results are not the same as you can see in the following output of the program:

    results = 0.772663116455078, data[1020] = 0.772663124036853

    Results is the value from the kernel and data is the value from the normal c program. When the both runs on the same execution unit the results should be the same or?

    Best regards

    Harald

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: calculation of a float value

    I am using my laptop with an intel graphics and a Intel CPU. So i Think the whole work is done by the CPU or?
    In OpenCL the application has to choose explicitly what device is going to do the work. If you search for "clGetDeviceIDs()" in the source code of your app you will find what device is used. It's almost certainly the CPU in your case.

    When the both runs on the same execution unit the results should be the same or?
    Can you show us the kernel source and the way you computed the same thing in regular C? I would suspect that OpenCL is computing the value in single precision while the regular C code is using x87 internally.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Senior Member
    Join Date
    May 2010
    Posts
    207

    Re: calculation of a float value

    Intel GPU's don't have vertex shaders - and their fragment shaders are pretty slow and rather limited.

    You might be better off doing it in the CPU.

  4. #4

    Re: calculation of a float value

    Intel GPU's don't have vertex shaders - and their fragment shaders are pretty slow and rather limited.
    Intel GPUs DO have vertex shaders. Regardless, shaders aren't in question unless you are using heavy OpenGL interoperation.

    However, the current Intel OpenCL implementation supports only Intel CPUs at this point. Until the drivers come out for Intel GPU OpenCL, your app is running only on the CPU.

  5. #5
    Junior Member
    Join Date
    Jan 2011
    Posts
    8

    Re: calculation of a float value

    Hi

    Thanks for the answers. I am using the ATI Stream SDK but I am working on a Laptop with an Intel CPU and Intel GPU so I think the program only runs on the CPU. Is there a driver from Intel which supports OpenCL for Linux?

    For not starting another thread I write here because I have another question. The first opencl command in my code is clGetPlatformDs and than i run clPlatformInfo. The output of the clPlatformInfo command is "Advanced Micro Device, Inc.". My question know is if this is normal? I thought the platform is Intel or shows he do me the sdk which i use? When i run the clGetPlatformIDs on a PC with a intel CPU and a NVIDIA GPU is the number of platfroms than two or one?

    With the output of the clGetPlatformIDs I can run the clGetDeviceIDs where i get the devices which i can assign to a context or? Is it possible to assign more than one device to a context or do I need a new context for every device?

    Thank for your help!

    Best regards
    Harald

  6. #6
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: calculation of a float value

    The output of the clPlatformInfo command is "Advanced Micro Device, Inc.".
    That's normal. The platforms represent which SDKs you have available in your system. Currently you are using AMD's SDK.

    If you install for example both AMD's and NVidia's SDK you will find two platforms.

    When i run the clGetPlatformIDs on a PC with a intel CPU and a NVIDIA GPU is the number of platfroms than two or one?
    Platforms only depend on what SDKs you installed, not which devices are connected to your system.

    With the output of the clGetPlatformIDs I can run the clGetDeviceIDs where i get the devices which i can assign to a context or?
    That's right. Each platform shows zero or more devices. You can assign any of those devices to a context.

    Is it possible to assign more than one device to a context or do I need a new context for every device?
    Yes, it's legal. However, you can only assign to the same context devices that come from the same platform. You can't put in one context a device from platform A and a device from platform B.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  7. #7
    Junior Member
    Join Date
    Jan 2011
    Posts
    8

    Re: calculation of a float value

    Hi

    Thanks for your answer. The whole part is know more transparent for me. I always get the amd platform an a intel device which works fine. If i work with windows 7 and I use the Intel driver for OpenCL and the NVIDIA driver with OpenCL i get two platforms. The intel platform is the CPU and the NVIDIA platform is the GPU. So it is not possible to use both devices in the same context? That means that i decide which kernel runs on the GPU and which kernel runs on the CPU or?

    Best regards

    Harald

  8. #8
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: calculation of a float value

    So it is not possible to use both devices in the same context?
    That's right. Devices from different platforms cannot be in the same context.

    That means that i decide which kernel runs on the GPU and which kernel runs on the CPU or?
    You always have to select which kernels run on which devices. How devices are arranged in different contexts has nothing to do with this. OpenCL doesn't do automatic load balancing.

    The reason contexts are important is because objects like images (textures), buffers, etc. all belong to a single context. You can't share an image or a buffer between two different contexts and you can't wait in one context for an event that belongs to a different context. You would have to make a copy.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  9. #9
    Junior Member
    Join Date
    Jan 2011
    Posts
    8

    Re: calculation of a float value

    Hi
    Thanks for your describtion of contexts. Did developers in the industrie uses multiple contexts or to the use only one context where all available devices are included? So when i want to use a intel CPU and a NVIDIA GPU with the best performance i need two contexts or? The partition into work groups is done by opencl in dependcie of the available devices or compute units or is it possible for the developer to set the number of work groups and work items?

    Best regards
    Harald

  10. #10
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: calculation of a float value

    So when i want to use a intel CPU and a NVIDIA GPU with the best performance i need two contexts or?
    Currently you have no option. You have to create two contexts in that case. If you had an AMD GPU and an AMD CPU then you could have both in one context.

    The partition into work groups is done by opencl in dependcie of the available devices or compute units or is it possible for the developer to set the number of work groups and work items?
    The developer always has to select the number of work items and the device where the work is executed. The developer can also choose the number of work-groups.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Page 1 of 2 12 LastLast

Similar Threads

  1. Vector's(float4, float8) calculation
    By dollarzuke in forum OpenCL
    Replies: 1
    Last Post: 12-06-2010, 10:40 AM

Posting Permissions

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