-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoiding ldconfig #7
Comments
Hello @haampie, This program needs to find out autonomously if there are MPI libraries in the container, where they are and if they are fit to be replaced by host equivalents. This solution has the following advantages over relying on ELF's
That said, if you wish to avoid the use of
|
Thanks, makes sense. How about this approach: add a flag Best! |
One last comment, though, since I'm quite happy with my current approach of building small Docker images and relying on RUNPATH to do its job, maybe I should explain it a bit better.
I totally agree that this is the way to go for sure!
True, but it still introduces a step in the Dockerfile that is sarus-runtime specific. So, in my use-case I have a multistage build where the builder image is terribly big, but the resulting image is just a bare
Now the What I could do now, is to create the following structure instead: $ tree MyApp.AppDir/
MyApp.AppDir/
└── usr
├── bin
│ └── app
├── lib
│ ├── libcublas.so
│ ├── libmkl.so
│ └── libmpi.so
└── vendor and create a Dockerfile like this: FROM ubuntu:18.04
COPY --from=builder ~/MyApp.AppDir ~/MyApp.AppDir
ENV PATH ~/MyApp.AppDir/usr/bin:$PATH
# Allow vendor-specific libraries to be loaded here
ENV LD_LIBRARY_PATH ~/MyApp.AppDir/usr/vendor and run sarus like sarus run --mount-vendor-mpi-to=~/MyApp.AppDir/usr/vendor/ my_image app This approach has the same advantage of not having to infer the Lastly, if / when sarus would support extending existing variables, I could even drop the |
Closing for now, since I've found a way to avoid using |
I've stumbled upon what is likely a long-standing issue in
ldconfig
that is blocking me to run it. It seems to be necessary forsarus run --mpi ..
to work.To reduce the size of my docker image I'm running a bundling tool that collects all executables in a
bin/
folder and recursively all dependent shared libraries in alib/
folder. Then it changes the RUNPATH of the binaries using thepatchelf
tool so thatldd
can resolve them. Everything is fine, it seems I can run the binaries, however,ldconfig
chokes on it in the following way:This is apparently a 10 year old issue (https://nix-dev.science.uu.narkive.com/q6Ww5fyO/ldconfig-problem-with-patchelf-and-64-bit-libs, NixOS/patchelf#44, mesonbuild/meson#4685, and more), and apparently everybody seems to be working around it.
Can we somehow avoid relying on
ldconfig
in sarus so that we don't run into this problem?Since my executables are configured to use RUNPATH, it should be enough to mount MPI into the container and set an environment variable LD_LIBRARY_PATH=/path/to/mpi/lib, since that takes precedence.
The text was updated successfully, but these errors were encountered: