Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCL run-time extension #574

Open
matze opened this issue Feb 17, 2017 · 12 comments
Open

OpenCL run-time extension #574

matze opened this issue Feb 17, 2017 · 12 comments

Comments

@matze
Copy link

matze commented Feb 17, 2017

Are there plans to allow applications talk to an OpenCL run-time similar to OpenGL? Applications like Darktable are almost useless without proper GPU acceleration.

@alexlarsson
Copy link
Member

I would love to have support for this, but I don't really know how opencl works, so help would be very much appreciated.

@matze
Copy link
Author

matze commented Apr 28, 2017

As far as I can see the org.freedesktop.GL.nvidia-xxx run-times already ships libnvidia-opencl.so. This name is specified in /etc/OpenCL/vendors/nvidia.icd and load at run time by an "installable client driver" loader (libOpenCL.so) which dispatches all OpenCL calls to the library. So all is needed is this ICD loader in the run-time and the Khronos header files in the Sdk.

I contacted the maintainer of the Blender flatpak and asked him if and how he uses OpenCL. But I doubt it's enabled right now …

@hubslave
Copy link

Hello friends, today I started to play with flatpak, I must say that I am pretty impressed, they work really great, still having some rough edges such as OpenCL support or bumblebee support but overall impression is super :)

As a Linux newbie I dont have much experience neither with OpenCL or flatpak, but as far as I know OpenCL uses something called ICD loaders. On all distributions they tend to be located in folder /etc/opencl/vendors

Also Nvidia and Intel (Not sure how it works on AMD, but I guess that pretty similar) create a file libOpenCL.so.1 which always symlinks to their latest OpenCL driver (or library, not sure about the naming conventions :) )

There is a great article about how OpenCL works on Linux here: https://wiki.tiker.net/OpenCLHowTo

I probably dont understand flatpaks enough to propose some specific solution but maybe flatpak could allow flatpak apps access to these files? To ICD loaders and libOpenCL symlinks? Do you think this could work?

Just my two cents, hope it could spark some ideas :)
Have a nice day

@hubslave
Copy link

Arch documentation also have some (hopefuly) useful information: https://wiki.archlinux.org/index.php/GPGPU

"The OpenCL ICD loader is supposed to be a platform-agnostic library that provides the means to load device-specific drivers through the OpenCL API. Most OpenCL vendors provide their own implementation of an OpenCL ICD loader, and these should all work with the other vendors' OpenCL implementations. Unfortunately, most vendors do not provide completely up-to-date ICD loaders, and therefore Arch Linux has decided to provide this library from a separate project (ocl-icd) which currently provides a functioning implementation of the current OpenCL API."

@hubslave
Copy link

I read a little more about flatpak and how it handles GPU drivers and I think that it bundles them as runtimes. If I understand correctly Vulkan could work on flatpak and I think that it works similar to OpenCL, it is getting loaded with ICD loaders, maybe OpenCL could be implemented the same way? Make runtime provide OpenCL libs and ICD loaders to flatpak apps?

@AsavarTzeth
Copy link

AsavarTzeth commented Aug 28, 2017

Out of tree drivers (nvidia) is bundled as extensions, not runtimes. But it works similarly. As for the open source stack; that is not handled by Flatpak, but your distribution, as usual.

@TingPing
Copy link
Member

TingPing commented Aug 28, 2017

As for the open source stack; that is not handled by Flatpak, but your distribution, as usual.

That is handled by Flatpak too, just those can be bundled in the fdo runtime.

@AsavarTzeth
Copy link

Oh by bad, thank you for the correction.

@jbleonesio
Copy link

Basically what is missing is a symlink in the GL extension from /usr/lib/GL/nvidia-XXX-XX/lib/libnvidia-opencl.so to /usr/lib/GL/nvidia-XXX-XX/lib/libnvidia-opencl.so.XXX.XX and an OpenCL ICD file located in /etc/OpenCL/vendors/nvidia.icd containing the line "libnvidia-opencl.so" as text.

@TingPing
Copy link
Member

@jbleonesio If you have the time you can add those here: https://github.com/flatpak/freedesktop-sdk-images/blob/nvidia-drivers/nvidia-apply-extra.c#L347-L375

Otherwise I'll try to remember to get around to it (or open an issue on that repo to track it).

@jbleonesio
Copy link

@TingPing I submitted 2 pull requests: one for OpenCL support in the SDK, the other one for shipping NVIDIA OpenCL ICD loader with the drivers.

flatpak/freedesktop-sdk-images#78
flatpak/freedesktop-sdk-images#79

I didn't manage to test it properly, so it will maybe need some corrections.

@arigit
Copy link

arigit commented Aug 10, 2018

Looking for the same, usecase: darktable flatpak; I have amdgpu opencl libraries installed (ubuntu 18.04), darktable installed by package can see them and works fine, darktable via package does not see them.

ICD files in /etc/OpenCL/vendors

amdocl64.icd
amdocl-orca32.icd
amdocl-orca64.icd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants