Static linkage of oneapi for nvidia

Is it possible to statically link to the oneAPI for nvidia runtime library, so that it doesn’t have to be installed on the device where the code is to be executed?

Hi, unfortunately this is not possible as the DPC++ SYCL runtime relies on dynamic discovery and loading of the backend libraries (plugins).

It seems to be currently hardcoded to look for plugins in the same directory where libsycl.so was found. Given this information, you could hack it in the following way:

  1. Copy both libsycl.so and libpi_cuda.so from your compilation machine to a local directory on your execution machine.
  2. Run your app with: LD_PRELOAD=/your/local/dir/libsycl.so ./your-app

This should trick SYCL runtime into loading libpi_cuda.so from /your/local/dir.

I think the documentation foresees searching for plugins in LD_LIBRARY_PATH but that doesn’t look to happen with the current implementation. This may change in the future, but at least with the 2023.2.1 release we only look for plugins in the location of libsycl.so, so this hack should work for this release.

Hope that helps,
Rafal

Preloading the libraries seems to work (link errors to libsycl* are gone), but the incompatibilities with the standard libraries were too difficult to handle (-static-libstdc++, -static-libgcc does not work with -fsycl, and the remote utilized older versions of these libraries)

I have requested OneAPI for nvidia to be installed on the remote device, which will be a lot easier