Linux: Failed to open dynamic library 'libOpenCL.so'

Moderators: Site Moderators, FAHC Science Team

Post Reply
yogi70
Posts: 4
Joined: Mon May 04, 2020 7:36 am

Linux: Failed to open dynamic library 'libOpenCL.so'

Post by yogi70 »

I am running FAH on an OpenSuse Leap 15.1 system.

When I start the client as root (not as service via /etc/init.d/fahclient start), after adding the GPU slot the client starts processing on the GPU as expected.

When I start the client as service (via /etc/init.d/fahclient start) there is a notice about a missing libOpenCL:

Code: Select all

06:36:19:         GPUs: 1
06:36:19:        GPU 0: Bus:1 Slot:0 Func:0 NVIDIA:5 GM204 [GeForce GTX 970] 3494
06:36:19:CUDA Device 0: Platform:0 Device:0 Bus:1 Slot:0 Compute:5.2 Driver:10.2
06:36:19:       OpenCL: Not detected: Failed to open dynamic library 'libOpenCL.so':
06:36:19:               libOpenCL.so: cannot open shared object file: No such file or
06:36:19:               directory
but the lib exists:
fazer:/var/lib/fahclient # ll $(locate libOpenCL.so)

Code: Select all

lrwxrwxrwx 1 root root    32 Sep 28  2019 /etc/alternatives/libOpenCL.so.1 -> /usr/lib64/nvidia/libOpenCL.so.1
lrwxrwxrwx 1 root root    14 Feb  7 16:48 /usr/lib/libOpenCL.so -> libOpenCL.so.1
lrwxrwxrwx 1 root root    18 Feb  7 16:48 /usr/lib/libOpenCL.so.1 -> libOpenCL.so.1.0.0
-rwxr-xr-x 1 root root 32084 Feb  7 16:48 /usr/lib/libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root    32 Sep 28  2019 /usr/lib64/libOpenCL.so.1 -> /etc/alternatives/libOpenCL.so.1
lrwxrwxrwx 1 root root    18 Feb  7 16:48 /usr/lib64/nvidia/libOpenCL.so.1 -> libOpenCL.so.1.0.0
-rwxr-xr-x 1 root root 27504 Feb  7 16:48 /usr/lib64/nvidia/libOpenCL.so.1.0.0
-rw-r--r-- 1 root root    70 Feb 23 11:18 /var/lib/alternatives/libOpenCL.so.1
On my OpenSuSE there is no libOpenCL.so in /usr/lib64 - maybe that's the cause for the message...
Adding this link manually and restart the service shows no issue about the missing libOpenCL.so.

Now the client downloads a workunit for the GPU - but after the download it throws an error:

Code: Select all

09:11:02:WU01:FS01:0x22:Digital signatures verified
09:11:02:WU01:FS01:0x22:Folding@home GPU Core22 Folding@home Core
09:11:02:WU01:FS01:0x22:Version 0.0.5
09:11:02:WU01:FS01:0x22:ERROR:exception: There is no registered Platform called "OpenCL"
09:11:02:WU01:FS01:0x22:Saving result file ../logfile_01.txt
09:11:02:WU01:FS01:0x22:Saving result file science.log
09:11:02:WU01:FS01:0x22:Folding@home Core Shutdown: BAD_WORK_UNIT
[93m09:11:03:WARNING:WU01:FS01:FahCore returned: BAD_WORK_UNIT (114 = 0x72)[0m
09:11:03:WU01:FS01:Sending unit results: id:01 state:SEND error:FAULTY project:13402 run:2 clone:130 gen:0 core:0x22 unit:0x0000000012bc7d9a5eafa8f8f744a299
09:11:03:WU01:FS01:Uploading 1.80KiB to 18.188.125.154
09:11:03:WU01:FS01:Connecting to 18.188.125.154:8080
09:11:03:WU02:FS01:Connecting to 65.254.110.245:80
09:11:03:WU01:FS01:Upload complete
09:11:03:WU01:FS01:Server responded WORK_ACK (400)
09:11:03:WU01:FS01:Cleaning up
Checking the /work/XX directory there is only the 00 running in the CPU - maybe the "Cleaning up" removes the subdir in /work/ for the WorkUnit. Is there a way to keep them for analysis?

on the WU02:FS01 there is shown an other error:

Code: Select all

09:11:15:WU02:FS01:0x22:ERROR:exception: There is no registered Platform called "OpenCL"
But what else is needed for the service process to access libOpenCL - as running as non service the system uses the GPU?

whole logfile since start (without FS00 (Slot 0: CPU): grep -v 'FS00' log.txt)

Code: Select all

*********************** Log Started 2020-05-04T09:10:49Z ***********************
09:10:49:****************************** FAHClient ******************************
09:10:49:        Version: 7.6.9
09:10:49:         Author: Joseph Coffland <[email protected]>
09:10:49:      Copyright: 2020 foldingathome.org
09:10:49:       Homepage: https://foldingathome.org/
09:10:49:           Date: Apr 17 2020
09:10:49:           Time: 18:11:30
09:10:49:       Revision: 398c2b17fa535e0cc6c9d10856b2154c32771646
09:10:49:         Branch: master
09:10:49:       Compiler: GNU 4.9.4
09:10:49:        Options: -std=c++11 -ffunction-sections -fdata-sections -O3
09:10:49:                 -funroll-loops
09:10:49:       Platform: linux2 4.19.0-5-amd64
09:10:49:           Bits: 64
09:10:49:           Mode: Release
09:10:49:           Args: --child /etc/fahclient/config.xml --run-as fahclient
09:10:49:                 --pid-file=/var/run/fahclient.pid --daemon
09:10:49:         Config: /etc/fahclient/config.xml
09:10:49:******************************** CBang ********************************
09:10:49:           Date: Apr 17 2020
09:10:49:           Time: 18:10:08
09:10:49:       Revision: 2fb0be7809c5e45287a122ca5fbc15b5ae859a3b
09:10:49:         Branch: master
09:10:49:       Compiler: GNU 4.9.4
09:10:49:        Options: -std=c++11 -ffunction-sections -fdata-sections -O3
09:10:49:                 -funroll-loops -fPIC
09:10:49:       Platform: linux2 4.19.0-5-amd64
09:10:49:           Bits: 64
09:10:49:           Mode: Release
09:10:49:******************************* System ********************************
09:10:49:            CPU: AMD FX(tm)-4100 Quad-Core Processor
09:10:49:         CPU ID: AuthenticAMD Family 21 Model 1 Stepping 2
09:10:49:           CPUs: 4
09:10:49:         Memory: 15.56GiB
09:10:49:    Free Memory: 4.07GiB
09:10:49:        Threads: POSIX_THREADS
09:10:49:     OS Version: 4.12
09:10:49:    Has Battery: false
09:10:49:     On Battery: false
09:10:49:     UTC Offset: 2
09:10:49:            PID: 8870
09:10:49:            CWD: /var/lib/fahclient
09:10:49:             OS: Linux 4.12.14-lp151.28.36-default x86_64
09:10:49:        OS Arch: AMD64
09:10:49:           GPUs: 1
09:10:49:          GPU 0: Bus:1 Slot:0 Func:0 NVIDIA:5 GM204 [GeForce GTX 970] 3494
09:10:49:  CUDA Device 0: Platform:0 Device:0 Bus:1 Slot:0 Compute:5.2 Driver:10.2
09:10:49:OpenCL Device 0: Platform:0 Device:0 Bus:1 Slot:0 Compute:1.2 Driver:440.59
09:10:49:******************************* libFAH ********************************
09:10:49:           Date: Apr 15 2020
09:10:49:           Time: 21:43:27
09:10:49:       Revision: 216968bc7025029c841ed6e36e81a03a316890d3
09:10:49:         Branch: master
09:10:49:       Compiler: GNU 4.9.4
09:10:49:        Options: -std=c++11 -ffunction-sections -fdata-sections -O3
09:10:49:                 -funroll-loops
09:10:49:       Platform: linux2 4.19.0-5-amd64
09:10:49:           Bits: 64
09:10:49:           Mode: Release
09:10:49:***********************************************************************
09:10:49:<config>
09:10:49:  <!-- Folding Slot Configuration -->
09:10:49:  <cause v='COVID_19'/>
09:10:49:
09:10:49:  <!-- Network -->
09:10:49:  <proxy v=':8080'/>
09:10:49:
09:10:49:  <!-- Slot Control -->
09:10:49:  <power v='full'/>
09:10:49:
09:10:49:  <!-- User Information -->
09:10:49:  <passkey v='*****'/>
09:10:49:  <team v='251999'/>
09:10:49:  <user v='yogi70'/>
09:10:49:
09:10:49:  <!-- Folding Slots -->
09:10:49:  <slot id='0' type='CPU'>
09:10:49:    <cpus v='2'/>
09:10:49:  </slot>
09:10:49:  <slot id='1' type='GPU'/>
09:10:49:</config>
09:10:49:Trying to access database...
09:10:49:Successfully acquired database lock
09:10:49:Enabled folding slot 00: READY cpu:2
09:10:49:Enabled folding slot 01: READY gpu:0:GM204 [GeForce GTX 970] 3494
09:10:50:WU01:FS01:Connecting to 65.254.110.245:80
[93m09:10:51:WARNING:WU01:FS01:Failed to get assignment from '65.254.110.245:80': No WUs available for this configuration[0m
09:10:51:WU01:FS01:Connecting to 18.218.241.186:80
09:10:52:WU01:FS01:Assigned to work server 18.188.125.154
09:10:52:WU01:FS01:Requesting new work unit for slot 01: READY gpu:0:GM204 [GeForce GTX 970] 3494 from 18.188.125.154
09:10:52:WU01:FS01:Connecting to 18.188.125.154:8080
09:10:54:WU01:FS01:Downloading 6.57MiB
09:11:00:WU01:FS01:Download 70.38%
09:11:02:WU01:FS01:Download complete
09:11:02:WU01:FS01:Received Unit: id:01 state:DOWNLOAD error:NO_ERROR project:13402 run:2 clone:130 gen:0 core:0x22 unit:0x0000000012bc7d9a5eafa8f8f744a299
09:11:02:WU01:FS01:Starting
09:11:02:WU01:FS01:Running FahCore: /usr/bin/FAHCoreWrapper /var/lib/fahclient/cores/cores.foldingathome.org/v7/lin/64bit/Core_22.fah/FahCore_22 -dir 01 -suffix 01 -version 706 -lifeline 8870 -checkpoint 15 -gpu-vendor nvidia -opencl-platform 0 -opencl-device 0 -cuda-device 0 -gpu 0
09:11:02:WU01:FS01:Started FahCore on PID 8901
09:11:02:WU01:FS01:Core PID:8905
09:11:02:WU01:FS01:FahCore 0x22 started
09:11:02:WU01:FS01:0x22:*********************** Log Started 2020-05-04T09:11:02Z ***********************
09:11:02:WU01:FS01:0x22:*************************** Core22 Folding@home Core ***************************
09:11:02:WU01:FS01:0x22:       Type: 0x22
09:11:02:WU01:FS01:0x22:       Core: Core22
09:11:02:WU01:FS01:0x22:    Website: https://foldingathome.org/
09:11:02:WU01:FS01:0x22:  Copyright: (c) 2009-2018 foldingathome.org
09:11:02:WU01:FS01:0x22:     Author: John Chodera <[email protected]> and Rafal Wiewiora
09:11:02:WU01:FS01:0x22:             <[email protected]>
09:11:02:WU01:FS01:0x22:       Args: -dir 01 -suffix 01 -version 706 -lifeline 8901 -checkpoint 15
09:11:02:WU01:FS01:0x22:             -gpu-vendor nvidia -opencl-platform 0 -opencl-device 0 -cuda-device
09:11:02:WU01:FS01:0x22:             0 -gpu 0
09:11:02:WU01:FS01:0x22:     Config: <none>
09:11:02:WU01:FS01:0x22:************************************ Build *************************************
09:11:02:WU01:FS01:0x22:    Version: 0.0.5
09:11:02:WU01:FS01:0x22:       Date: Apr 22 2020
09:11:02:WU01:FS01:0x22:       Time: 03:57:11
09:11:02:WU01:FS01:0x22: Repository: Git
09:11:02:WU01:FS01:0x22:   Revision: 2d69202c898bd9bb3e093f51cd32bf411c2a0388
09:11:02:WU01:FS01:0x22:     Branch: HEAD
09:11:02:WU01:FS01:0x22:   Compiler: GNU 4.8.2 20140120 (Red Hat 4.8.2-15)
09:11:02:WU01:FS01:0x22:    Options: -std=c++11 -O3 -funroll-loops
09:11:02:WU01:FS01:0x22:   Platform: linux2 4.19.76-linuxkit
09:11:02:WU01:FS01:0x22:       Bits: 64
09:11:02:WU01:FS01:0x22:       Mode: Release
09:11:02:WU01:FS01:0x22:************************************ System ************************************
09:11:02:WU01:FS01:0x22:        CPU: AMD FX(tm)-4100 Quad-Core Processor
09:11:02:WU01:FS01:0x22:     CPU ID: AuthenticAMD Family 21 Model 1 Stepping 2
09:11:02:WU01:FS01:0x22:       CPUs: 4
09:11:02:WU01:FS01:0x22:     Memory: 15.56GiB
09:11:02:WU01:FS01:0x22:Free Memory: 3.93GiB
09:11:02:WU01:FS01:0x22:    Threads: POSIX_THREADS
09:11:02:WU01:FS01:0x22: OS Version: 4.12
09:11:02:WU01:FS01:0x22:Has Battery: false
09:11:02:WU01:FS01:0x22: On Battery: false
09:11:02:WU01:FS01:0x22: UTC Offset: 2
09:11:02:WU01:FS01:0x22:        PID: 8905
09:11:02:WU01:FS01:0x22:        CWD: /var/lib/fahclient/work
09:11:02:WU01:FS01:0x22:         OS: Linux 4.12.14-lp151.28.36-default x86_64
09:11:02:WU01:FS01:0x22:    OS Arch: AMD64
09:11:02:WU01:FS01:0x22:********************************************************************************
09:11:02:WU01:FS01:0x22:Project: 13402 (Run 2, Clone 130, Gen 0)
09:11:02:WU01:FS01:0x22:Unit: 0x0000000012bc7d9a5eafa8f8f744a299
09:11:02:WU01:FS01:0x22:Reading tar file core.xml
09:11:02:WU01:FS01:0x22:Reading tar file integrator.xml
09:11:02:WU01:FS01:0x22:Reading tar file state.xml
09:11:02:WU01:FS01:0x22:Reading tar file system.xml
09:11:02:WU01:FS01:0x22:Digital signatures verified
09:11:02:WU01:FS01:0x22:Folding@home GPU Core22 Folding@home Core
09:11:02:WU01:FS01:0x22:Version 0.0.5
09:11:02:WU01:FS01:0x22:ERROR:exception: There is no registered Platform called "OpenCL"
09:11:02:WU01:FS01:0x22:Saving result file ../logfile_01.txt
09:11:02:WU01:FS01:0x22:Saving result file science.log
09:11:02:WU01:FS01:0x22:Folding@home Core Shutdown: BAD_WORK_UNIT
[93m09:11:03:WARNING:WU01:FS01:FahCore returned: BAD_WORK_UNIT (114 = 0x72)[0m
09:11:03:WU01:FS01:Sending unit results: id:01 state:SEND error:FAULTY project:13402 run:2 clone:130 gen:0 core:0x22 unit:0x0000000012bc7d9a5eafa8f8f744a299
09:11:03:WU01:FS01:Uploading 1.80KiB to 18.188.125.154
09:11:03:WU01:FS01:Connecting to 18.188.125.154:8080
09:11:03:WU02:FS01:Connecting to 65.254.110.245:80
09:11:03:WU01:FS01:Upload complete
09:11:03:WU01:FS01:Server responded WORK_ACK (400)
09:11:03:WU01:FS01:Cleaning up
HaloJones
Posts: 906
Joined: Thu Jul 24, 2008 10:16 am

Re: Linux: Failed to open dynamic library 'libOpenCL.so'

Post by HaloJones »

Can you try this please:

Code: Select all

 sudo apt update 
sudo apt install ocl-icd-opencl-dev
then report back?

We've seen so many problems on Linux because the Nvidia and AMD drivers don't seem to include everything that is included in Windows drivers.
single 1070

Image
yogi70
Posts: 4
Joined: Mon May 04, 2020 7:36 am

Re: Linux: Failed to open dynamic library 'libOpenCL.so'

Post by yogi70 »

looks like ther is no ocl-icd-opencl-dev package on openSuSE, which files should be included there?

the opencl-headers for opencl-2.2 are installed
opencl-headers | package | 2.2+git.20170617-lp151.2.1 | noarch | openSUSE-15.1-Oss

but the libOpenCL comes from nvidia:

Code: Select all

fazer:/var/lib/fahclient # rpm -qil nvidia-computeG05
Name        : nvidia-computeG05
Version     : 440.82
Release     : lp151.25.1
Architecture: x86_64
Install Date: Mon May  4 11:40:04 2020
Group       : System/Libraries
Size        : 110138911
License     : SUSE-NonFree
Signature   : DSA/SHA1, Mon Apr 13 23:01:42 2020, Key ID f5113243c66b6eae
Source RPM  : x11-video-nvidiaG05-440.82-lp151.25.1.nosrc.rpm
Build Date  : Sun Apr  5 12:39:03 2020
Build Host  : sheep95
Relocations : (not relocatable)
Vendor      : obs://build.suse.de/Proprietary:X11:Drivers
URL         : https://www.nvidia.com/object/unix.html
Summary     : NVIDIA driver for computing with GPGPU
Description :
NVIDIA driver for computing with GPGPUs using CUDA or OpenCL.
Distribution: Proprietary:X11:Drivers / openSUSE_Leap_15.1
/etc/OpenCL
/etc/OpenCL/vendors
/etc/OpenCL/vendors/nvidia.icd
/etc/alternatives/libOpenCL.so.1
/usr/bin/nvidia-cuda-mps-control
/usr/bin/nvidia-cuda-mps-server
/usr/bin/nvidia-modprobe
/usr/bin/nvidia-smi
/usr/lib/libOpenCL.so
/usr/lib/libOpenCL.so.1
/usr/lib/libOpenCL.so.1.0.0
/usr/lib/libcuda.so
/usr/lib/libcuda.so.1
/usr/lib/libcuda.so.440.82
/usr/lib/libnvidia-fatbinaryloader.so.440.82
/usr/lib/libnvidia-ml.so.1
/usr/lib/libnvidia-ml.so.440.82
/usr/lib/libnvidia-opencl.so.1
/usr/lib/libnvidia-opencl.so.440.82
/usr/lib/libnvidia-ptxjitcompiler.so.1
/usr/lib/libnvidia-ptxjitcompiler.so.440.82
/usr/lib64/libOpenCL.so.1
/usr/lib64/libcuda.so
/usr/lib64/libcuda.so.1
/usr/lib64/libcuda.so.440.82
/usr/lib64/libnvidia-fatbinaryloader.so.440.82
/usr/lib64/libnvidia-ml.so
/usr/lib64/libnvidia-ml.so.1
/usr/lib64/libnvidia-ml.so.440.82
/usr/lib64/libnvidia-opencl.so.1
/usr/lib64/libnvidia-opencl.so.440.82
/usr/lib64/libnvidia-ptxjitcompiler.so.1
/usr/lib64/libnvidia-ptxjitcompiler.so.440.82
/usr/lib64/nvidia
/usr/lib64/nvidia/libOpenCL.so.1
/usr/lib64/nvidia/libOpenCL.so.1.0.0
/usr/share/man/man1/nvidia-cuda-mps-control.1.gz
well if I run the client in the terminal all works fine - also GPU processing works.
Running as Service failed - looks like some PATH did not match to find OpenCL

by the way, why did a binary should need devel libs?
zepingouin
Posts: 2
Joined: Thu Mar 26, 2020 8:31 am
Hardware configuration: V7.6.9 -> 24/7
Ubuntu 18.04.4 LTS
GPU 1: GeForce GTX 1080 Ti
GPU 2: GeForce GTX 1080 Ti

Re: Linux: Failed to open dynamic library 'libOpenCL.so'

Post by zepingouin »

yogi70 wrote: well if I run the client in the terminal all works fine - also GPU processing works.
Running as Service failed - looks like some PATH did not match to find OpenCL

by the way, why did a binary should need devel libs?
Try these commands :

Code: Select all

cd /usr/lib/x86_64-linux-gnu/
sudo ln -s libOpenCL.so.1.0.0 libOpenCL.so
Image
HaloJones
Posts: 906
Joined: Thu Jul 24, 2008 10:16 am

Re: Linux: Failed to open dynamic library 'libOpenCL.so'

Post by HaloJones »

It's not that it's dev level, it's just a library which has shown to help fix this problem. We're mostly volunteers on here with no more access to underlying code than you so sometimes it's just about pointing people with problems to known solutions.
single 1070

Image
Joe_H
Site Admin
Posts: 7938
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Linux: Failed to open dynamic library 'libOpenCL.so'

Post by Joe_H »

To expand on that a bit, someone posted a while back that installing the dev package appeared to fix up some links that were left unresolved by the runtime install. Whether that is still the case, adding the dev kit has fixed up things for many, but not all.

An additional problem people have run into is that on more recent distros of Linux, the account running the GPU folding also needs to belong to the 'video' group, and on the latest a 'render' group. Running under 'root' is just a way to avoid that issue. There is a longish set of posts here on the forum by someone who dug into this and posted his findings as well as submitted a problem report on the GitHub site for the F@h software.
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
bruce
Posts: 20824
Joined: Thu Nov 29, 2007 10:13 pm
Location: So. Cal.

Re: Linux: Failed to open dynamic library 'libOpenCL.so'

Post by bruce »

From what I understand, FAH needs the runtime library package but if it exists, it's hard to find. The full developer lib probably isn't needed but it certainly contains the runtime code. If you discover a better way (with a smaller install package) let us know.
ableeker
Posts: 10
Joined: Sun Jul 06, 2008 11:17 am

Re: Linux: Failed to open dynamic library 'libOpenCL.so'

Post by ableeker »

I'm using an AMD Radeon RX 64, not an Nvidia GPU, but I had the same issue. Other OpenCL applications were working fine, but FaH is quite picky. darktable has an excellent explanation of what makes OpenCL work, and how it finds its components. It says amongst others things that libOpenCL.so "must be in a folder where it is found by your system's dynamic linker". This is because there's no fixed place for this library, on my computer for instance. On my machine OpenCL is provided by the AMD implementation ROCm 3.3, and libOpenCL is located in path /opt/rocm-3.3.0/opencl/lib/x86_64, while others seem to use /usr/lib. There are actually 2 files, there's libOpenCL.so that's a link to the actual libOpenCL.so.1, which other apps search for, and use. FaH seems to insist on libOpenCL.so however, but that wasn't in the library path. I solved the issue by adding a .conf file to /etc/ld.so.conf.d, with the library path as content, and added that to the library with ldconfig. You could probably use LD_LIBRARY_PATH as well, but I haven't tried that, ld.so.conf.d is working great for me.

I'm also not sure about the group fahclient is supposed to be in. It has to do with the udev rules in /etc/udev/rules.d for KFD, but people say in Ubuntu 20.04, which I'm running, KFD isn't owned by video anymore, but by render. That's why I made user fahclient a member of both groups. And I've modified /etc/init.d/FAHClient so it runs as root. It's running as a service, it's crunching CPU, and GPU WU's fine, and I can use fahcontrol to manage the service, but it takes a lot of tweaking to get it all to run smoothly.
Post Reply