OpenCL does not work properly in Singularity container with custom CUDA installation

I’m struggling a lot with making OpenCL GPU acceleration available within a Singularity container and hope to get some helpful hints in this forum. Because executed directly on the host itself which is Linux Mint 20.1 (Kernel 5.4.0-91-generic) with Nvidia driver 530.41 and CUDA version 12.1, I successfully get the GPU application (a proprietary molecular modelling/simulation software called Yasara) utilizing the GPU. And clinfo gives me lots of output, but interestingly, without the ICD related lines at the end. However, there’s a final note saying: “NOTE: your OpenCL library only supports OpenCL 2.2”.

If I pass the CUDA installation path to LD_LIBRARY_PATH within the Singularity container, ldd clinfo lists libOpenCL.so from the CUDA path and I have the same clinfo output as on the host, but receive a not further specified error when executing Yasara: The GPU could not be used to perform computations as expected, the OpenCL compiler encountered an error.

If I do not pass the CUDA path, I get the same Yasara runtime error, but the clinfo output differs. It does show lines related to ICD at the end and the final note states, “NOTE: your OpenCL library only supports OpenCL 2.1”

I’m assuming a conflict with duplicate occurrences of OpenCL relevant files, since at least 3 related libraries are present twice on this host system

/usr/local/cuda-12.1/targets/x86_64-linux/lib/stubs/libcuda.so
/usr/local/cuda-12.1/targets/x86_64-linux/lib/stubs/libnvidia-ml.so
/usr/local/cuda-12.1/targets/x86_64-linux/lib/libOpenCL.so [.1, .1.0, .1.0.0]

/usr/lib/x86_64-linux-gnu/libcuda.so [.1, .530.41.03]
/usr/lib/x86_64-linux-gnu/libnvidia-ml.so [.1, .530.41.03]
/usr/lib/x86_64-linux-gnu/libOpenCL.so.1 [.1.0.0]

Since linux Mint repository-based OpenCL libraries are needed by few tools installed from those repositories, I would like to avoid just removing these default OpenCL libraries. So I assume that apart from libOpenCL.so respectively the CUDA installation path, I might need to pass further libraries to the container.

Is anyone in this forum able to tell me which other libs might be required inside the container? Any other alternative but helpful suggestion regarding OpenCL in Singularity is highly appreciated.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.