Bhavya Agarwal
Bhavya Agarwal

Reputation: 107

Compiling linux kernel with nvcc

I was trying to write a linux driver which can use the power of GPU via CUDA. The basic Makefile looks like this everywhere:

obj-m += hello.o

all:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
        make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

Is there anyway I can put nvcc up there? Basically I want to make my .cu files a part of my linux kernel.

Upvotes: 1

Views: 869

Answers (1)

talonmies
talonmies

Reputation: 72335

What you are trying to do is impossible.

The CUDA API is a user space API. The basic linux kernel architecture makes it illegal to call any user space API from kernel space code. This include CUDA. IF you want to use the GPU as part of an OS kernel service, you will need to do it via a user space kernel interface like FUSE.

Upvotes: 1

Related Questions