inducer / pyopencl

OpenCL integration for Python, plus shiny features
http://mathema.tician.de/software/pyopencl
Other
1.06k stars 241 forks source link

Pyopencl stopped working on MacOS #469

Closed kif closed 3 years ago

kif commented 3 years ago

Dear Andreas,

Is PyOpenCL (actually OpenCL) still working on MacOS ? We have failures on the CI of silx on macos and on my apple computer (10.15.7 catalina), OpenCL is no more able to compile any kernel, neither on CPU (intel core i5) nor on GPU (intel based iGPU). Python is 3.9, pyopencl is 2021.1.6. This raises a RuntimeError: clBuildProgram failed but the context creation was OK. Cheers,

Jerome

kif commented 3 years ago

I checked clpeak which is now also failing with similar error message (it is C++). So it is rather MacOS than pyopencl. Anyway, if you have any info, I would be interested.

inducer commented 3 years ago

I think Apple has deprecated OpenCL, so even if it's still "around" in some capacity, it's IMO just a matter of time until it stops working entirely. CUDA has suffered a similar same fate:

NVIDIA® CUDA Toolkit 11.1 Update 1 no longer supports development or running applications on macOS. While there are no tools which use macOS as a target environment, NVIDIA is making macOS host versions of the following tools that you can launch profiling and debugging sessions on supported target platforms. (https://developer.nvidia.com/gameworksdownload#?dn=cuda-toolkit-developer-tools-for-macos-11-1-1)

So if you'd like to talk to a GPU on a Mac, it seems like the only "future-proof" way you can do it is through their Metal interface, which is a tad unattractive, on account of not being cross-platform at the very least. Potentially, something can be hodge-podged together with https://github.com/KhronosGroup/MoltenVK and https://github.com/kpet/clvk, but that stack likely has some maturing to do. (And if CUDA were a thing still, you could let pocl take care of the CL -> CUDA translation. It has gotten quite good at that.)

If you're "just" trying to develop on a Mac, that still very easy to do, for example by following the PyOpenCL install instructions via conda forge. If you follow those, you get an ICD loader (libOpenCL) and an OpenCL implementation (pocl) that's entirely separate from Apple's. (They're just C/C++ programs after all. Apple can't prevent those.) Optionally, you can make that ICD loader aware of CL devices offered up by Apple's CL implementation, as long as that is still a thing.

So in summary, GPU compute on Apple is looking a bit grim, but developing OpenCL (and running it on the CPU) on macs is no problem at all.

kif commented 3 years ago

Thanks Andreas for the update. We have seen our CI starting to fail systematically and I could just confirm on my mac-book. The libopencl is still present on MacOS, but the compiler has gone... This old laptop remains a nice development platform for opencl when running under linux ... our issue is to support users running macos. Now, they have neither OpenMP, nor OpenCL to run compute intensive code. It's gonna be slow for them !

About PoCL, I confirm it works great to expose OpenCL on our IBM power9 computers with Tesla V100 GPUs. Most of the feature work with PoCL, even the profiler. Very instructive. Apparently PoCL is slightly slower at scheduling kernels but the kernels themselves appear to run at the same speed (approximately).