Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

oneapi device selector fails in docker

Tomasoni
Novice
3,991 Views

Hello all,

I've built a docker image with my own software and as a dependency intel oneapi basekit.

 

I run the image like this

 

```

docker run -it --rm --device=/dev/dri -v $(pwd)/advdiff:/qspcc/advdiff cosbi/qspcc-plus bash

```

 

to expose my gpu to the container ( I read about --device here https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-base-linux/top/using-containers/using-containers-with-the-command-line.html )

 

but once in the container if I type

 

```

qspcc-server:/qspcc/advdiff> /opt/intel/compiler/latest/linux/bin/sycl-ls
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]

```

 

it is showing nothing, neither the CPU.

this is the output of lspci on the host

 

```

$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)

```

 

Can anyone tell me howto expose my cpu/gpu to the docker container?

The host is ubuntu 20.04 LTS, the docker image debian 11.

 

thank you

Danilo

Labels (2)
0 Kudos
1 Solution
Tomasoni
Novice
3,668 Views

Thank you, now it works, I tried adding to the dockerfile

 

```

# repository to install Intel(R) GPU drivers
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 in the apt-get command I installed

 

intel-opencl-icd intel-level-zero-gpu level-zero level-zero-dev

 

now the gpu is recognized:

 

```

> sycl-ls
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.13.3.0.16_160000]
[opencl:cpu:1] Intel(R) OpenCL, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz 3.0 [2022.13.3.0.16_160000]
[opencl:gpu:2] Intel(R) OpenCL HD Graphics, Intel(R) Iris(R) Xe Graphics [0x9a49] 3.0 [22.23.23405]
[ext_oneapi_level_zero:gpu:0] Intel(R) Level-Zero, Intel(R) Iris(R) Xe Graphics [0x9a49] 1.3 [1.3.23405]
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]
```

 

thank you!

View solution in original post

0 Kudos
10 Replies
NoorjahanSk_Intel
Moderator
3,959 Views

Hi,

 

Thanks for reaching out to us.

 

Could you please provide us with the docker file and steps you have followed to build the docker file so that we can try it from our end?

>>I've built a docker image with my own software

Please let us know the detailes of the software you used to create docker image?

 

Thanks & Regards,

Noorjahan.

 

0 Kudos
Tomasoni
Novice
3,951 Views

Hello and thank you for your answer.

The issue was related to the fact that I've not executed

. /opt/intel/setvars.sh

before calling sycl-ls

I was exporting the libraries manually through LD_LIBRARY_PATH

Now I understand that every time I want to do something with MKL I need to call setvars.

 

I still have a problem though.

 

The output now is

> /opt/intel/compiler/latest/linux/bin/sycl-ls
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.13.3.0.16_160000]
[opencl:cpu:1] Intel(R) OpenCL, Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz 3.0 [2022.13.3.0.16_160000]
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]

But why my GPU is not there? What is this FPGA emulation?

I've installed intel-opencl-icd both in the docker container and in the host machine.

 

The same holds for another machine with an Intel Iris Xe Graphics in windows.

[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.13.3.0.16_160000]
[opencl:cpu:1] Intel(R) OpenCL, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz 3.0 [2022.13.3.0.16_160000]
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]

 

I attach a sample dockerfile without my program and other dependencies, but that behaves the same.

Thank you again for your help.

Danilo

 

0 Kudos
NoorjahanSk_Intel
Moderator
3,911 Views

Hi,

 

Thanks for providing the details.

 

Could you please try using  --privileged option while running the docker file?

This flag will give all the capabilities to the container that a host can perform.

 

Command:

docker run -idt --privileged <image> bash

 

We have tried to run intel/oneapi-basekit docker image and are able to see GPU information in the container.

Please find the attached screenshot for more details:

NoorjahanSk_Intel_0-1659434941133.png

 

Thanks & Regards,

Noorjahan.

 

0 Kudos
Tomasoni
Novice
3,870 Views

Hello, thank you for your answer.

The result in the linux box with

```

docker run -it --rm --privileged --device=/dev/dri -v $(pwd)/advdiff:/qspcc/advdiff <IMAGE> bash

```

 

is the same.

 

```

> /opt/intel/compiler/latest/linux/bin/sycl-ls
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.13.3.0.16_160000]
[opencl:cpu:1] Intel(R) OpenCL, Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz 3.0 [2022.13.3.0.16_160000]
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]

```

 

This is the output of lspci in the host

 

```

~$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation 100 Series/C230 Series Chipset Family Thermal Subsystem (rev 31)
00:16.0 Communication controller: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 (rev 31)
00:16.3 Serial controller: Intel Corporation 100 Series/C230 Series Chipset Family KT Redirection (rev 31)
00:17.0 RAID bus controller: Intel Corporation SATA Controller [RAID mode] (rev 31)
00:1f.0 ISA bridge: Intel Corporation Q170 Chipset LPC/eSPI Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller (rev 31)
00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller (rev 31)
00:1f.4 SMBus: Intel Corporation 100 Series/C230 Series Chipset Family SMBus (rev 31)
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (2) I219-LM (rev 31)

```

 

 

In the other pc with an Intel Iris Xe Graphics in windows I run

 

```

docker run -it --privileged --rm -v ${PWD}\tests:/qspcc/tests <IMAGE> bash

```

 

and get the same

 

```

> /opt/intel/compiler/latest/linux/bin/sycl-ls
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.13.3.0.16_160000]
[opencl:cpu:1] Intel(R) OpenCL, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz 3.0 [2022.13.3.0.16_160000]
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]

```

0 Kudos
NoorjahanSk_Intel
Moderator
3,847 Views

Hi,

 

We see that you did not install the Intel Graphics Driver in the Docker.

Please refer to the below link for more details to install the Graphics Driver and this docker example is for Ubuntu 20.4. (Line No: 42-45)

 

https://github.com/intel/oneapi-containers/blob/master/images/docker/basekit/Dockerfile.ubuntu-20.04

 

Please Install the graphics driver and let us know if you still face the same issue.

 

Thanks & Regards,

Noorjahan.

 

0 Kudos
NoorjahanSk_Intel
Moderator
3,802 Views

Hi,


We haven't heard back from you. Could you please provide an update on your issue?


Thanks & Regards,

Noorjahan.


0 Kudos
NoorjahanSk_Intel
Moderator
3,744 Views

Hi,


We have not heard back from you, so we will close this inquiry now. If you need further assistance, please post a new question.


Thanks & Regards,

Noorjahan.


0 Kudos
Tomasoni
Novice
3,694 Views

I'm sorry for the late reply, but I don't get e-mail updates.

I'll try installing drivers asap and let you know.

thanks.

0 Kudos
Tomasoni
Novice
3,694 Views

Hello again,

I checked my dockerfile and I installed intel-opencl-icd  I thought it would be sufficient for the driver installation (line 47 of my dockerfile)

 

I looked at your sample dockerfile but it is installing also dscpp and other dependencies I'm already installing later (line 106 of my dockerfile) which is the package name that I'm missing? maybe `intel-level-zero-gpu level-zero` ?

I don't think I need dev packages since I'm only compiling against oneapi, or am I wrong?

The reason why I don't install everything is just because I want to keep the docker as slim as possible.

 

Thank you.

Danilo

0 Kudos
Tomasoni
Novice
3,669 Views

Thank you, now it works, I tried adding to the dockerfile

 

```

# repository to install Intel(R) GPU drivers
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 in the apt-get command I installed

 

intel-opencl-icd intel-level-zero-gpu level-zero level-zero-dev

 

now the gpu is recognized:

 

```

> sycl-ls
[opencl:acc:0] Intel(R) FPGA Emulation Platform for OpenCL(TM), Intel(R) FPGA Emulation Device 1.2 [2022.13.3.0.16_160000]
[opencl:cpu:1] Intel(R) OpenCL, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz 3.0 [2022.13.3.0.16_160000]
[opencl:gpu:2] Intel(R) OpenCL HD Graphics, Intel(R) Iris(R) Xe Graphics [0x9a49] 3.0 [22.23.23405]
[ext_oneapi_level_zero:gpu:0] Intel(R) Level-Zero, Intel(R) Iris(R) Xe Graphics [0x9a49] 1.3 [1.3.23405]
[host:host:0] SYCL host platform, SYCL host device 1.2 [1.2]
```

 

thank you!

0 Kudos
Reply