GPU Programming on non openCL compliant Graphic Chip for Mac OSX - cocoa

I have been playing around, trying to implement an openCL GPU computing layer in my Mac OSX Cocoa app, just to realize that my 13" Macbook Pro Late 2011 and it's Intel HD3000 graphic chip doesn't comply with openCL !
What are my alternatives to get my GPU to do any computation ?

Related

Rough performance estimation for the code Matlab to c++

I am planning to port MATLAB algorithm into mobile devices. As part of my proposal i need to give rough estimation of the computation time required for the algorithm on mobile devices. I have figures for the algorithm on MATLAB. It would be great if someone share their experience how should get the rough number for a given mobile platform.
Update:
I am currently targeting to make proposal for the following mobile specification ,Operating System Android 5.1.1 Lollipop Display 8-inch 1920x1200 LCD Processor Tegra K1 quad-core at 2.2 GHz 192-core Kepler GPU Storage 16GB MicroSD card expandable

CUDA development Mac Mini

I'm very new in CUDA development and I don't know how to start. I have a Mac Mini
With a OS X 10.8.3 and XCode 4.6.3. Can I use it for CUDA development?
You will not be able to use CUDA, as you do not have an NVidia graphics card. You might want to look into OpenCL which is supported on Intel CPUs and GPUs (as well as AMD and NVidia GPUs). OpenCL is similar to the CUDA Driver API and therefore what you learn programming in OpenCL will help with learning CUDA as well since many of the concepts are similar.
For OpenCL on Mac, check out https://developer.apple.com/library/mac/#documentation/Performance/Conceptual/OpenCL_MacProgGuide/Introduction/Introduction.html.
You can do CUDA development on some Mac Minis.
You, of course, need a model with an Nvidia GPU. I'm doing it on my 2010 Mini which has a NVIDIA GeForce 320M 256 MB. This is a lightweight chip. It only has 48 CUDA cores, but it is good for educational use.
You can get info on the software you need here:
https://cseweb.ucsd.edu/classes/fa12/cse260-b/RoomFullOfMacMinis.txt

How to do GPU programming on Macbook Air?

I want to try GPU programming. The GPU of my MacBook Air is Intel HD Graphics 3000, so I think I cannot use CUDA.
I did some research and ran into OpenCL. But in the homepage, it is said that
OpenCL™ (Open Computing Language) is a low-level API for heterogeneous
computing that runs on CUDA-powered GPUs.
I think my GPU is not CUDA-powered, so maybe OpenCL cannot be used either.
Then I wonder how can I do GPU programming on my MacBook Air?
By GPU Programming I am assuming you mean high performance parallel calculations on the GPU without graphics (since you mention OpenCL and CUDA).
If so this link may be helpful: https://anteru.net/2012/11/03/2009/.
And that card definitely can't use CUDA.
CUDA supported by NVIDIA only because it is NVIDIA invention. OpenCL is open standard made as an answer of AMD on NVIDIAs CUDA. OpenCL supported widely by various platforms including Nvidia, Intel and Apple.

How to do OpenGL 3 programming on OS X with a GeForce 9400

I have a MacBook Pro with a GeForce 9400 graphics card. Wikipedia said this card supports OpenGL 3.
But the header and library shipped with OS X 10.6 seems to be OpenGL 2 only (I checked the files in /usr/X11/include/).
I need to do some OpenGL 3 programming. Can I do it with my current hardware and OS? What do I need to get and install?
Sadly, I don't think you can yet, as detailed here.
I believe Lion will upgrade OpenGL to 3.2 for OS X though (which is still short of the more useful 3.3 unfortunately).
NB: I do not own a Mac, this is purely from trying to learn modern OpenGL on the windows side and digging around to understand how portable it would be.
Edit: this thread on the official OpenGL forums has more detail. Although (see comments below this answer) it may not be completely clear why vendors cannot provide OpenGL 3+ compliant drivers, it seems pretty clear that there is no way to use fully OpenGL 3.3 compliant code and shaders in OS X. Some workarounds are provided in that thread however, as well as in my first link.
The best place to check OpenGL support on the various OSX and Mac combinations is:
http://developer.apple.com/graphicsimaging/opengl/capabilities/
See the "Core" subpage for 10.7+
OpenGL 3.2 with GLSL 1.5 on 10.7.2 isn't too bad.
Your current hardware can support OpenGL 3, but not the OS. Mac OS X 10.7 (Lion) should support OpenGL 3, which is a solution only if you can wait many months.
Your only option right now is to switch to a different OS such as Windows or Linux. You'll have to boot from this other operating system, because the virtual machine systems present a virtual video card to the guest operating systems, and none have OpenGL 3 compatible virtual video cards.
(Disclaimer: This information is based on taking Windows OpenGL and replacing wgl with glX. But I did verify that the corresponding extensions exist in GLX land)
You won't find OpenGL 3 support in any header files. Rather you need the GLX_ARB_create_context extension.
The other answers are probably correct about missing support in OSX, but even when support comes, you'll have to use glXGetProcAddress and load the extension. (Can't video card manufacturers add support for these extensions through their driver? Why does it require "OS support"?)
Windows OpenGL developer here. On Windows 7 only OpenGL 1.4 is officially supported, but everyone gets around this limitation by querying which functions are available at run-time.
On OSX I expect you can do the same thing. The easiest way to do this is with The OpenGL Extension Wrangler Library: http://www.opengl.org/sdk/libs/GLEW/

How to disable Macbook Pro from switching to a high performance graphics card in Cocoa?

All 2010 Macbook Pros come with two graphics cards — a low-performance built-in Intel HD one and a high-performance discrete NVIDIA one — and it switches between them on the fly depending on the needs of the running applications.
I have a simple Cocoa application that consists of just a menu bar item with a NSTextField in it. All I do is update the text field with an NSAttributedString from time to time. The trouble is that my application switches my Macbook Pro to use the high-performance NVIDIA card (I used the gfxCardStatus tool to confirm this).
What could possibly need the high-performance card? Is there a known list of reasons for the applications to require high-performance graphics card? Is there a way to force the computer to use the discrete graphics card?
There is a good article about GPU switching in the newer MacBook Pros at Ars Technica.
I noticed that OS X switches to the dedicated GPU if you
Start an application that links against OpenGL
Connect a second display
The code of gfxCardStatus is open source. And it seems that the relevant part is located in switcher.m. You can take a closer look here.
In MacOS 10.7 you can specify a setting in the PList to stop going to discrete graphics:
https://developer.apple.com/library/mac/qa/qa1734/_index.html
Needs to be a 2011+ MacBook Pro.

Resources