Getting a better CPU-based OpenCL driver (OS X) - macos

While browsing the Web, I came across this page from the PyOpenCL project:
Py OpenCL Mac OS Install Readme
On this page, something strange is alleged:
"OS X has support for both CPU- and GPU-based OpenCL built in. Unfortunately, the built-in drivers can be temperamental, and they have not advanced as quickly as one might like. To make PyOpenCL use a more up-to-date (and open-source) CPU-based OpenCL driver, type the following:
conda install osx-pocl-opencl pocl (OS X)
Note that, by installing osx-pocl-opencl, you will no longer be able to use PyOpenCL to talk to the system-wide Apple OpenCL drivers. To regain access to those drivers, simply uninstall osx-pocl-opencl and reinstall pyopencl afterwards."
Is this true? Are there faster OpenCL drivers for MacOS?
I'm not interested in installing PyOpenCL. Is there a way for me to get my hands on those "faster" drivers?

It seems that they're suggesting you use pocl, an open source OpenCL implementation with support for OpenCL 1.2 features (and some 2.0 features). I can't comment on the performance, but it's definitely true that the official Mac OS OpenCL drivers are pretty finicky.
I found this readme detailing the steps to build and install pocl for OSX.

Related

Installing SDL 2 with Macports; Is X11 a dependency?

I am in the process of installing SDL 2 on Mac OSX 10.9 via macports, and for reference I have been following the official documentation as well as any sdl-specific information I can find.
https://guide.macports.org/ is straight-forward, as is:
https://guide.macports.org/#using.variants.invoking
I see that sdl2lib is available...
libsdl2 has the variants:
universal: Build for multiple architectures
x11: Enable X11 support
but despite having looked through pages at the above links and having searched for documentation for "SDL with X11", I can't seem to find information about whether I need X11 (and/or universal AKA powerpc) support. I wouldn't want to install SDL only to find that something is broken or missing.
Then again, there were some issues with X11 being enabled by default back when Mac OSX 10.1 was new:
https://forums.libsdl.org/viewtopic.php?t=2871&sid=52ca72a72c285196dd25fd8619715ae9
(That is another problem: much of the information I discover applies to outdated operating systems.)
Apparently SDL wasn't thread-safe at one point unless you used X11, but this was mentioned when SDL verson 1 was the main version:
http://forum.freegamedev.net/viewtopic.php?f=3&t=1078
How am I meant to proceed (Which flags, if any, are usually chosen?)
port install libsdl2 <???>
I would appreciate any help and follow-up warnings for the next stepsinstallation steps.
Thank you in advance.
Most people have moved to Homebrew as their package system, but Macports should work just fine.
Universal does not mean PowerPC necessarily. In fact almost no one needs it anymore. Universal means a fat binary, which architectures this defines is set in your Macports configuration.
SDL2 should work just fine under Quartz, no need to have X11 - as also makes deployment annoying and difficult as you need to have XQuartz installed.
Also don't be afraid to reinstall SDL2 with other options if you miss something, it shouldn't take to long.
TL;DR Just install it without any additional flags unless you discover you need something special.

Haskell for Mac (El Capitan)

I'm trying to decide what haskell installation is more appropriate for a Mac running El Capitan.
It seems there are at least two alternatives:
Install the haskell platform as indicated in https://www.haskell.org/platform/
Install the haskell platform as indicated in https://ghcformacosx.github.io/
What is the difference between the two distributions?
Will I be able to use Xcode as an Haskell IDE?
The main differences I see are:
Haskell for Mac OSX:
is relocatable
comes with stack pre-built
Haskell Platform:
installs in /usr/local/bin (requires root access)
comes with more pre-compiled libraries
comes with the programs happy and alex pre-built
Neither comes with explicit support for using Xcode as an IDE. Usually one uses Emacs or Atom or Vi to develop Haskell programs.

install Frama-C on Mac OS X

How do I install a current Frama-C release and its prerequisites on Macs?
I have a laptop running Mac OS X 10.6.8 and a desktop running Mac OS X 10.7.5
which I can install software on. I also have access to a lab of machines
running Mac OS X 10.8 which our technical support people will install stuff on
if I ask nicely.
I have a student who is interested in program analysis and needs something
that we have a fighting chance of understanding and adding to. I was already
aware of Frama-C, and a colleague at another university recommended it.
I had previously tried to install Frama-C and failed miserably. The colleague
commented that he'd had the same experience. Well, times change. So I visited
the Frama-C web site, was more impressed and keener to have it than ever, and
set about it.
The frama-c.com download page doesn't have links to any binaries for the
current (Flourine 3) release for any platform. The link to installation
instruction takes me to a page that says to download the auto-installer.
What auto-installer?
There are instructions for an old version of Mac OS X, but following them
didn't work; loading one set of prerequisites as instructed produced a
state where the next prerequisite (gtksourceview) would not install.
Of course I checked the older releases, and I see that there's a Nitrogen
version for Mac OS X Leopard, but "Please untar the archive as root in /"
asks me to perform the impossible. I don't have a root account and will
never be given one (the machines all belong to the university). It is
perfectly possible to install gcc and clang anywhere you like; why does
Frama-C want to be in /?
In addition to Pascal's answer, you can also have a look to opam, which is a source package manager for OCaml applications. It appears to run on MacOS X, and there are packages for Frama-C's Oxygen and Fluorine.
All Frama-C binary packages want to install in / (precisely, in /usr/local/Frama-C) because Frama-C uses GTK+ and various GTK+-related libraries that were never designed to run from anything other than a fixed location. They load configuration files and resources from paths that have been hard-coded at compile-time. GCC and Clang install anywhere because they don't rely on GTK+. Like them, the command-line version of Frama-C can be relocated through various environment variables listed here.
Note that to take advantage of a binary package, you would only need one symbolic link pointing from /usr/local/Frama-C to the place where you really extracted the files, if your administrator(s) can grant you that. Binary packages only work for one OS X version. For packages available from the official website, this version is usually 10.6 (Snow Leopard).
I have ceased making Frama-C binary packages for two reasons:
by removing features and support for hardware configurations in each of the last two OS X releases, Apple has fragmented the OS X landscape in a way I don't have the time to deal with. You mention 10.6, 10.7 and 10.8 in your question. I also have Macs running each of 10.6, 10.7 and 10.8. They are all incompatible (when trying to build a software package that includes a compiler).
I have much less time available now that I am participating in the creation of a start-up that offers Frama-C-based static analysis to interested industrial users.
This said, Frama-C the Open-Source advanced research prototype continues to be developed and maintained, and continues to be a great testbed to experiment in. You can install Frama-C without root access on a Mac in two ways apart from what you have already tried:
Install only the command-line version. Then the only dependency is a recent version of the OCaml compiler. Frama-C's configure will detect that you do not have the GTK libraries and will not try to use them. Installation should take 20 minutes at most for a recent OCaml + the latest Frama-C.
Install a recent Linux distribution in a virtual machine. Use that distribution's package manager to obtain all the GTK+ dependencies. If the distribution's OCaml package is recent enough, use that and then the lablgtk-2 package, otherwise, compile OCaml and then lablgtk-2 from source. Then compile Frama-C.
For Fluorine, the oldest supported OCaml version is 3.12.1.
with macports:
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
sudo port install opam
opam init
Y
eval `opam config env`
sudo port install gtksourceview2 lablgtk2 ocaml-ocamlgraph
opam install frama-c

Getting Leksah working on Mac OS X 10.5.8

I'm using Mac OS X 10.5.8. Another question indicated that Leksah is the IDE of choice for Haskell development.
However, Leksah (version 0.10.0.4) requires GHC 7.0.3 (problems with 6.12.2, problems with 6.12.3). Unfortunately, the newest Haskell platform available for OS X 10.5.8 is 6.12.3.
How do I get Leksah working on my Mac? An OS upgrade is not possible. Should I just use a different IDE/text editor?
According to the latest State of Haskell survey, the most popular IDE's are vi and Emacs, both of which have Haskell-mode features and are quite usable on OS X.
That said, it's probably worthwhile to get ghc-7 anyway. Is self-compiling an option? You can install a ghc-6.12 binary, then use that to bootstrap compiling ghc-7.0.3. Once you have a working ghc-7, download the Haskell Platform Source and build that. Compiling both ghc and the full platform will take a while, but I'd expect it all should work.
This is ghc 7.0.4 for Leopard PPC: https://downloads.haskell.org/~ghc/7.0.4/krabby/
I was also able to use it to build ghc 7.6.3.

OpenCL support on Leopard

I want to use OpenCL in my software but I am running Leopard.
I will probably update to Snow Leopard later. In the mean time I would like to get started with OpenCL in Leopard. Setting up on 10.5 is confusing: most SDKs and articles assume that you must be using Snow Leopard. Searching for "Using OpenCL on Leopard" is completely useless, as you would expect.
I downloaded the cuda toolkit, devdriver and gpucomputing SDK from nvidia but the examples won't compile because OpenCL/opencl.h is not found. The OpenCL release notes don't mention MacOSX so again I think this is assuming that all Mac users are running Snow Leopard.
Where can I find OpenCL includes and libraries for Mac OSX 10.5 ?
Or, is this just a waste of time and I should go and get Snow Leopard ASAP ?
After upgrading to Snow Leopard I would like my software to support Leopard. Is this possible ?
I believe the headers necessary to compile OpenCL code are included with the Nvidia GPU Computing SDK (path is something like NVIDIA_GPU_Computing_SDK/OpenCL/common/inc/CL). You could copy or link these into the directory where your compiler looks for includes (/usr/include/CL/ on Linux, not sure for Mac). Alternatively, you could get the headers from khronos.org/registry/cl. The libraries themselves should be included with either the SDK or the cuda toolkit (I don't recall which).
You will need to upgrade to Snow Leopard. Also note that OpenCL really isn't ready for "prime time" software development on any platform yet. CUDA is much more mature than OpenCL and you should consider using CUDA rather than OpenCL if you want to develop and deploy GPGPU-dependent software in the near future.

Resources