Using GPGPU in kernel mode

Can I run CUDA or OpenCL applications from a Linux kernel module? I found a project that provides this functionality, but it needs a user space assistant to run CUDA programs. ( https://code.google.com/p/kgpu/ )

Although this project is already avoiding excessive copying of memory between the user and the kernel space, I wonder if it is possible to completely do without using user space?

EDIT: Let me expand my question. I know that kernel components can only call APIs provided by the kernel and other kernel components. Therefore, I do not want to directly access the OpenCL or CUDA API. The CUDA or OpenCL API should eventually call the graphics driver to do its magic. Most likely, this interface is completely non-standard, changing with each release, etc ...

But suppose you have a compiled OpenCL or CUDA kernel that you want to run. Do OpenCL / CUDA user space libraries have a very difficult climb to actually starting the kernel, or is it just lightweight shells around the driver interface?

I also know that a user space helper is probably the best option for this, since calling the driver directly will most likely be broken with the new driver version ...

+3
source share
1 answer

Short answer: you cannot do this.

It is not possible to call any code that relies on glibc from kernel space. This means that there is no way to make CUDA or OpenCL API calls from kernel space, as these libraries rely on glibc and many other user-space helper libraries and user-space APIs that are not available in kernel space. CUDA and OpenCL are not unique in this regard - that is why the whole X11 works in user space, for example.

-, , - , .

[EDIT] OpenCL , . , ( , OpenCL ), ELF . , .

+5

All Articles