ProjectPhysX / FluidX3D

The fastest and most memory efficient lattice Boltzmann CFD software, running on all GPUs via OpenCL. Free for non-commercial use.
https://youtube.com/@ProjectPhysX
Other
3.77k stars 300 forks source link

libOpenCL.so #89

Closed Anewre closed 1 year ago

Anewre commented 1 year ago

Upon following the steps for compilation, I get the following error.

"./bin/FluidX3D: error while loading shared libraries: libOpenCL.so.1: cannot open shared object file: No such file or directory"

Lacking a lot of experience (undergrad student, but excited to try out your software), I am uncertain how I can load the library required and get this error resolved.

I'm using an Ubuntu system (22.04.02) with intel CPU and RTX2060.

Thank you very much for any attention this matter may receive.

With kind regards,

Anewre commented 1 year ago

In addition to the above:

I found libOpenCL.so.1 on my system (/snap/firefox/2356/usr/lib/x86_64-linux-gnu/libOpenCL.so.1) I created a symbolic link: sudo ln -s /path/to/library /usr/lib/libOpenCL.so.1 sudo ln -s /path/to/library /usr/local/lib/libOpenCL.so.1

However, I now get the error: Error: There are no OpenCL devices available. Make sure that the OpenCL 1.2 Runtime for your device is installed. For GPUs it comes by default
with the graphics driver, for CPUs it has to be installed
separately.

I am using a LiveUSB with persistence, I suppose I need to somehow install the nvidia drivers for my system and make sure it is loaded upon boot. I will attempt this now.

jansol commented 1 year ago

Yes, the nvidia drivers provide a libOpenCL.so that works. Alternatively you can install for example pocl-opencl-icd (CPU-based OpenCL driver) and ocl-icd-libopencl1 (loader library that lets you have multiple drivers installed side by side). The CPU driver is of course going to be a lot slower for FluidX3D than the GPU, but it is good enough for making sure the setup works and some basic testing.

Note that the nvidia driver package tends to mess with the library search path in a way that breaks the side-by-side solution.

(Specifically it puts its own libOpenCL.so in the search path before the generic loader, which causes apps to only see that and not the loader that would let them use multiple drivers. Have a look around /etc/ld.so.conf.d for details. You'll need LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/ to put the loader in front of the nvidia driver again, since it seems that the order of entries in that directory does not matter. The silliest part about this is that the nvidia driver also installs a .icd file for the loader to find so they could just pull that in as a dependency or ship it with their driver.)

Anewre commented 1 year ago

Thank you very much for your solution. It turns out that I was using a LiveUSB with persistence, with restrictions that prevented the nvidia driver from being loaded upon booting. (Nouveau driver is used) I now installed ubuntu (instead of using liveUSB) and nvidia driver l(including libOpenCL.so) loads correctly. Subsequently, following the instructions in the documentation the compilation went flawlessly.

I am amazed by the capabilities of the software and the relative ease of use. I will now try to figure out how to setup my own cases.