Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7943 Discussions

Get the intel iGPU card available in the docker without the --privileged flag

FantasticMrFox
Beginner
2,932 Views

We are able to start a docker with the `--privileged` flag and get this:

sycl-ls
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.15.12.0.01_081451]
[opencl:cpu:1] Intel(R) OpenCL, Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz 3.0 [2022.15.12.0.01_081451]
[opencl:gpu:2] Intel(R) OpenCL HD Graphics, Intel(R) UHD Graphics [0x9bc4] 3.0 [22.28.23726.1]
[opencl:acc:3] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.15.12.0.01_081451]

Note that the Intel(R) OpenCL HD Graphics is available, which is my coffee lake iGPU.  But `--privileged` is a collosal hammer of a flag. We should be able to get the gpu with just `--device=/dev/dri`. Indeed, with this flag only, i can get the nvidia card, but not the iGPU. With --device=/dev/dri only, I get:

[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.15.12.0.01_081451]
[opencl:cpu:1] Intel(R) OpenCL, Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz 3.0 [2022.15.12.0.01_081451]
[opencl:acc:3] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.15.12.0.01_081451]

 Note that the iGPU is missing. 

 

What do i need to do to get the iGPU in there?

0 Kudos
6 Replies
FantasticMrFox
Beginner
2,908 Views

In addition to this,

 

If i mount the folder directly:

--volume=/dev/dri:/dev/dri
then it also finds the iGPU
0 Kudos
FantasticMrFox
Beginner
2,901 Views

ok, so you need device, but you also need the render group. This was very hard to find out.

 

getent group render
render:x:109:

 

So you add 

 

--group-add=109

 

0 Kudos
NoorjahanSk_Intel
Moderator
2,885 Views

Hi,


Thanks for posting in Intel communities.


You can get the GPU in docker by installing GPU drivers in the Docker file using the below commands


RUN curl -fsSL https://repositories.intel.com/graphics/intel-graphics.key | apt-key add -

RUN echo "deb [trusted=yes arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main" > /etc/apt/sources.list.d/intel-graphics.list


and then install intel-opencl-icd intel-level-zero-gpu level-zero level-zero-dev through apt-get command


Hope this resolves your issue. If this resolves your issue, make sure to accept this as a solution. This would help others with a similar issue.


Thanks & Regards,

Noorjahan.


0 Kudos
FantasticMrFox
Beginner
2,836 Views

Without this, it would not have even worked with the --privileged. The answer is not what you posted, it is the combination of 

 

--volume=/dev/dri:/dev/dri 

 

and 

 

--group-add=109
0 Kudos
NoorjahanSk_Intel
Moderator
2,794 Views

Hi,


Thanks for providing the details.


You can mount the folder while starting the Docker container and it will find the GPU as you have mentioned.

If you use a Docker file then you can install a GPU driver using the below commands as mentioned in my previous post.


RUN curl -fsSL https://repositories.intel.com/graphics/intel-graphics.key | apt-key add -

RUN echo "deb [trusted=yes arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main" > /etc/apt/sources.list.d/intel-graphics.list


Could you please confirm whether your issue is resolved? If yes, can we go ahead and close this issue?


Thanks & Regards,

Noorjahan.


0 Kudos
NoorjahanSk_Intel
Moderator
2,748 Views

Hi,

 

We assume that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.

 

Thanks & Regards,

Noorjahan.

 

0 Kudos
Reply