Bumblebee-Project / Bumblebee

Bumblebee daemon and client rewritten in C
http://www.bumblebee-project.org/
GNU General Public License v3.0
1.3k stars 142 forks source link

Opencl not working without bumblebee #843

Open zsibit opened 7 years ago

zsibit commented 7 years ago

Hi, there is a dual GPU (intel + nvidia) notebook.

Thanks!

Celelibi commented 7 years ago

Check what kernel drivers are loaded when you run a command inside optirun or primusrun. You can run optirun lsmod for instance. You will obviously need the proprietary nvidia kernel drivers to offload an OpenCL kernel to your nvidia GPU.

Other than that, clinfo is supposed to work and show the available platforms. It works pretty well for me. That segmentation fault is most probably a bug on the clinfo side.

zsibit commented 7 years ago

These are the differences between loaded kernel drivers here:

image NVIDIA Driver Version: 375.39 Linux-x86_64

So, why I have to load NVIDIA drivers to have Intel's OPENCL function?

Thank you.

zsibit commented 7 years ago

+++ hid_logitech and usbhid was an additional wireless mouse

Celelibi commented 7 years ago

So, why I have to load NVIDIA drivers to have Intel's OPENCL function?

I don't think you have to. clinfo isn't supposed to crash, you might want to report a bug on their side. And primusrun might not set all the environment variable like optirun. AFAIK, both wrapper set some env variables like LD_LIBRARY_PATH so that the program to run will find some specific glx libraries that will do all the dirty work.

Try running optirun env and primusrun env.

The OpenCL library also tries to connect to the X server if there's one. I don't know why it does this, and this sometimes causes some issues. Try to set the environment variable DISPLAY to the empty string when you run clinfo. Like the following commands.

$ DISPLAY= clinfo
$ optirun env -i clinfo
$ primusrun env -i clinfo
zsibit commented 7 years ago

-----OPTIRUN env shows (++ lines only): _ /usr/bin/optirun BUMBLEBEE_SOCKET /var/run/bumblebee.socket PRIMUS_DISPLAY :8 LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus:/usr/lib/nvidia-375:/usr/lib32/nvidia-375 PRIMUS_libGLa /usr/lib/nvidia-375/libGL.so.1:/usr/lib32/nvidia-375/libGL.so.1 PRIMUS_libGLd /usr/$LIB/libGL.so.1:/usr/lib/$LIB/libGL.so.1:/usr/$LIB/mesa/libGL.so.1:/usr/lib/$LIB/mesa/libGL.so.1

-----PRIMUSRUN env shows (no primus display, no primus lib): LD_LIBRARY_PATH /usr/$LIB/primus:/usr/lib/nvidia-375:/usr/lib32/nvidia-375

-----env shows (++ line only): _ /usr/bin/env

-----+++difference WINDOWID = 41943046 (optirun & primusrun) WINDOWID = 56623110 (only env)

____Results (only optirun worked): ~$ DISPLAY= clinfo Segmentation fault ~$ optirun env -i clinfo ~$ primusrun env -i clinfo Segmentation fault

____General info: KERNEL 4.8.0-34-generic #36-Ubuntu x86_64 GNU/Linux Device Version OpenCL 1.2 beignet 1.1.2 Device OpenCL C Version OpenCL C 1.2 beignet 1.1.2 Execution capabilities
Run OpenCL kernels Yes Run native kernels Yes SPIR versions 1.2 Device Version GPU Device Available Yes Compiler Available Yes Linker Available Yes Device Extensions cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_khr_icd Built-in kernels cl_copy_region_align4; __cl_copy_region_align16; cl_cpy_region_unalign_same_offset; cl_copy_region_unalign_dst_offset; __cl_copy_region_unalign_src_offset; cl_copy_buffer_rect; cl_copy_image_1d_to_1d; __cl_copy_image_2d_to_2d; cl_copy_image_3d_to_2d; cl_copy_image_2d_to_3d; __cl_copy_image_3d_to_3d; cl_copy_image_2d_to_buffer; cl_copy_image_3d_to_buffer; __cl_copy_buffer_to_image_2d; cl_copy_buffer_to_image_3d; cl_fill_region_unalign; __cl_fill_region_align2; cl_fill_region_align4; cl_fill_region_align8_2; cl_fill_region_align8_4; cl_fill_region_align8_8; cl_fill_region_align8_16; cl_fill_region_align128; __cl_fill_image_1d; cl_fill_image_1d_array; __cl_fill_image_2d; cl_fill_image_2d_array; cl_fill_image_3d;

Files are in next folder: /etc/OpenCL/vendors/ intel-beignet-x86_64-linux-gnu.icd (content:) /usr/lib/x86_64-linux-gnu/beignet//libcl.so nvidia.icd (content:) libnvidia-opencl.so.1

HandBrake, Gimp, LibreOffice applications are not able to use OpenCL as well, without optirun command.

Thank you.