1

I'm looking to do some programming on the GPU but don't need any sort of 3D or high level graphics capability. Essentially all I need to do is call functions that loop through thousands of iterations very quickly. I started looking into OpenCL but it seems that support for that is much, much lower that OpenGL as I can use OpenGL ES even on mobile and WebGL on web. Web isn't that big of an importance to me at this point, but is there a viable alternative that has the wide support that OpenGL has but more used for calculation? I want something that will be able to run on as many computers and devices out there.

EDIT: I'm also looking for the best support of various graphics cards from AMD, Nvidia, etc.

Evan Kennedy
  • 3,975
  • 1
  • 25
  • 31
  • 3
    Computation on GPUs is usually done with OpenCL (on all GPUs) or CUDA (on Nvidia hardware only). – Basile Starynkevitch Oct 02 '12 at 06:56
  • You might be interested in tools from http://www.silkan.com/ – Basile Starynkevitch Oct 02 '12 at 07:01
  • You might also be interested by http://opengpu.net/EN/ -a collobarative R&D french project which has just ended. – Basile Starynkevitch Oct 02 '12 at 08:18
  • I liked [SYCL](https://www.khronos.org/sycl/). It is more "viable" in another sense - "SYCL vs OpenCL" is more like "C++ vs C". On the other hand I always thought that there might be an "assembler" for GPUs - and seems that is [SPIR](https://www.khronos.org/spir/). So it should work on any decent ATI gpus. Nvidias arent mean to be looked at seriously - they are "expensive toys only for games", not for computations, they even lost Ethereum mining race!.. So CUDA is not even worth looking at. – xakepp35 Apr 12 '19 at 13:27
  • Also, if i could have time machine, I'd argued on lack of web support: [WebCL](https://en.wikipedia.org/wiki/WebCL) – xakepp35 Apr 12 '19 at 13:37

2 Answers2

4

OpenCL is supported by both main GPU manufacturers and is by far your best bet. The other alternative is CUDA. I think you would be better off asking a question along the lines of "How do I solve this problem using OpenCL?" than simply stating that it is not suited for the work you need done, as it is very hard to make recommendations based solely on the description above.

Please also note that OpenCL supports an embedded profile, which means it has some support on mobile devices. However the iPhone does not currently support this. It was rumored that it would be coming to iOS 6 but this seems not to have happened yet. Also see this question which explains how android and OpenCL function together.

Community
  • 1
  • 1
Marius Brendmoe
  • 365
  • 1
  • 9
  • Thank you for your input. I need support on mobile devices which as of now I don't see possible with OpenCL. Although [PGCL](http://www.pgroup.com/products/pgcl.htm) seems to have some very promising news in this field, I still feel that OpenGL has far more support even though it is quite different from what I am looking to achieve. – Evan Kennedy Oct 02 '12 at 07:02
  • I worked with a researcher who was doing work in the field of using OpenGL as a computing language, a few years back. However, all work was dropped in favor of CUDA when it first came out. It seems kind of strange to me to want to use a highly parallel language for high performance computing on a mobile device, although I can see a few uses.. Are you sure this is really what you need? Can you elaborate further on your actual needs? Have you considered streaming the dataset to a server that offers OpenCL instead of consuming all the power on the mobile device in question? – Marius Brendmoe Oct 02 '12 at 07:07
  • I'm essentially trying to create an "engine" that runs on multiple platforms that runs mathematical equations on the gpu. I have this created for the CPU, but I'm trying to port over some of the functions that take up the most time. On mobile devices it is incredibly slow to the point where it is unusable if certain functions are used. I am trying to run these very large loops on the GPU and maybe use the GPU for even more of the processing if it seems logical. It would be possible to program several engines for different platforms, but I'm trying to avoid that since I'm just one person. – Evan Kennedy Oct 02 '12 at 07:14
  • 1
    I think you might be slightly ahead of your time then. One would assume that OpenCL is coming more and more to mobile platforms, however I do not know at what pace. – Marius Brendmoe Oct 02 '12 at 07:26
1

I guess for NVIDIA cards the best model to use is CUDA. It's pretty mature by now and very well supported. You can find many guides on the main site and they're well written so you should be able to pick it up quickly imo.

Tudor
  • 61,523
  • 12
  • 102
  • 142
  • But CUDA is specific to Nvidia (you can't have it with AMD GPUs). If you want to code for several brands of GPUs, OpenCL might be more relavant. – Basile Starynkevitch Oct 02 '12 at 06:58
  • @Basile Starynkevitch: Yes, I mentioned that CUDA is for NVIDIA cards. The OP said he already tried OpenCL. – Tudor Oct 02 '12 at 06:59