You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been experimenting with gpu-enabled Dagger engine on Fly.io: gerhard/daggerverse#4 in order to get an easy access to a physical GPU usable with Dagger.
I ran some examples to re-evaluate the ability for Dagger to use a GPU, and it seems to be all broken...
// TestCuda tests if it can access the GPU, requires a machine with an NVIDIA GPUfunc (m*Gpu) TestCuda(ctx context.Context) (string, error) {
returndag.Container().
// From("nvidia/cuda:12.6.2-base-ubuntu24.04").From("nvidia/cuda:11.7.1-base-ubuntu20.04").
// FIXME: this is an attempt to fix the error: "fork/exec /usr/bin/nvidia-container-runtime-hook: no such file or directory"// WithExec([]string{"sh", "-c", "apt update && apt install -y nvidia-container-toolkit"}).ExperimentalWithAllGPUs().
WithExec([]string{"nvidia-smi", "-L"}).
Stdout(ctx)
}
Log output
Error: response from query: input: gpu.testCuda resolve: call function "TestCuda": process "/runtime" did not complete successfully: exit code: 2Stdout:invoke: input: container.from.withExec.experimentalWithAllGPUs.withExec.stdout resolve: process "nvidia-smi -L" did not complete successfully: exit code: 1/usr/local/bin/runc did not terminate successfully: exit status 1: container does not existStderr:runc run failed: unable to start container process: error during container init: error running hook #0: fork/exec /usr/bin/nvidia-container-runtime-hook: no such file or directory
Definitely worth confirming that the gpu variant is being used, but I also wouldn't be particularly surprised if it's bit-rotted a bit.
We have no CI tests for GPU support - if we're committing to providing examples for GPU support in dagger (which we definitely should do), then I think we need to add GPU tests in CI for sure.
I confirm I am now using the -gpu variant: here is what I get:
NVIDIA-SMI couldn't find libnvidia-ml.so library in your system. Please make sure that the NVIDIA Display Driver is properly installed and present in your system.Please also try adding directory that contains libnvidia-ml.so to your system PATH.
Just FYI, I am now using the same docker image to run TestCuda function, that we use for engine and therefore expect it to have same packages installed, but still get same error. so my 2 cents is that the nvidia-container-toolkit is not able to inject something successfully when running the container.
I finally have this working after installing libnvidia-compute-565. The nvidia drivers are really touchy w.r.t version numbers as such, but I found installing this package fix it for both nvidia/cuda:12.6.2-base-ubuntu24.04 and nvidia/cuda:11.7.1-base-ubuntu20.04.
I finally have this working after installing libnvidia-compute-565. The nvidia drivers are really touchy w.r.t version numbers as such, but I found installing this package fix it for both nvidia/cuda:12.6.2-base-ubuntu24.04 and nvidia/cuda:11.7.1-base-ubuntu20.04.
another workaround that I found to be working was to mount /.fly-upper-layer to the container and add /<mounted-path>/usr/lib/x86_64-linux-gnu to LD_LIBRARY_PATH.
Note: I found the required *.so files in both /.fly-upper-layer AND /usr/lib/x86_64-linux-gnu/ on the fly.io app machine, so I am assuming mounting either of them should work, but I tried mounting /.fly-upper-layer only.
I just tried this on a GPU VM that @marcosnils helped me get access to, and it seems to have worked without any additional package installation. I am going to investigate this more tomorrow but it seems like the issue could be specific to how fly.io setup the firecracker vm.
That's neat, thanks @rajatjindal for gathering all those info. I confirm the workaround on fly. Given we can't hardcode a path on the host, it's probably better (more portable) to rely on installing libnvidia-compute-565.
@samalba regarding your question about Lambda labs, seems like it'll work out of the box similarly to our tests in Oblivus. Let us know in case you give it a try and it doesn't work for some reason.
@samalba regarding your question about Lambda labs, seems like it'll work out of the box similarly to our tests in Oblivus. Let us know in case you give it a try and it doesn't work for some reason.
So I had some time to try it out today:
I keep getting this error, every time I invoke the ExperimentalWithAllGPUs() call:
stderr: Auto-detected mode as 'legacy'nvidia-container-cli: initialization error: load library failed: libnvidia-ml.so.1: cannot open shared object file: no such file or directory
Out of the box, a Lambda VM comes with an Ubuntu 22.04.5 LTS and it seems to have the right packages installed:
ii libnvidia-cfg1-550-server:amd64 550.127.05-0lambda0.22.04.1 amd64 NVIDIA binary OpenGL/GLX configuration libraryii libnvidia-compute-550:amd64 550.127.05-0lambda0.22.04.1 amd64 NVIDIA libcompute packagerc libnvidia-compute-550-server:amd64 550.127.05-0lambda0.22.04.1 amd64 NVIDIA libcompute packageii libnvidia-container-tools 1.17.2+dfsg-0lambda0.22.04.1 amd64 Package for configuring containers with NVIDIA hardware (CLI tool)ii libnvidia-container1:amd64 1.17.2+dfsg-0lambda0.22.04.1 amd64 Package for configuring containers with NVIDIA hardware (shared library)ii libnvidia-extra-550-server:amd64 550.127.05-0lambda0.22.04.1 amd64 Extra libraries for the NVIDIA driverii libnvidia-ml-dev:amd64 12.4.127~12.4.1-0lambda0.22.04.2 amd64 NVIDIA Management Library (NVML) development filesrc nvidia-compute-utils-550-server 550.127.05-0lambda0.22.04.1 amd64 NVIDIA compute utilitiesii nvidia-container-toolkit 1.17.2-0lambda0.22.04.1 amd64 OCI hook for configuring containers for NVIDIA hardwareii nvidia-container-toolkit-base 1.17.2-0lambda0.22.04.1 amd64 Container runtime for NVIDIA hardwareii nvidia-cuda-dev:amd64 12.4.127~12.4.1-0lambda0.22.04.2 amd64 NVIDIA CUDA development filesii nvidia-cuda-toolkit 12.4.131~12.4.1-0lambda0.22.04.2 amd64 NVIDIA CUDA development toolkitii nvidia-cuda-toolkit-gcc 12.4.1-0lambda0.22.04.2 amd64 NVIDIA CUDA development toolkit (GCC compatibility)ii nvidia-dkms-550-server 550.127.05-0lambda0.22.04.1 amd64 NVIDIA DKMS packageii nvidia-fabricmanager-550 550.127.05-0lambda0.22.04.1 amd64 NVIDIA Fabric Manager for NVSwitch systemsii nvidia-firmware-550-server-550.127.05 550.127.05-0lambda0.22.04.1 amd64 Firmware files used by the kernel moduleii nvidia-kernel-common-550-server 550.127.05-0lambda0.22.04.1 amd64 Shared files used with the kernel moduleii nvidia-kernel-source-550-server 550.127.05-0lambda0.22.04.1 amd64 NVIDIA kernel source packageii nvidia-opencl-dev:amd64 12.4.127~12.4.1-0lambda0.22.04.2 amd64 NVIDIA OpenCL development filesii nvidia-profiler 12.4.127~12.4.1-0lambda0.22.04.2 amd64 NVIDIA Profiler for CUDA and OpenCL
Here is how I started the dagger-engine after stopping the default one (v0.14.0):
For the record I did my test with an instance with an Nvidia A6000 attached (gpu_1x_a6000). @marcosnils and @rajatjindal I gave you both an access to my account in case you want to have a look.
Indeed, I can make it work when starting the engine container with GPU. I guess fly.io transparently set this as well.
Thanks for the help! I am closing this issue as we have several ways to access the GPU, I am working on documenting all this (planning to open the PR in the next few days).
Activity
gerhard commentedon Nov 21, 2024
Does the GPU variants of our image -
v0.14.0-gpu&v0.14.0-wolfi-gpu- fail the same way?jedevc commentedon Nov 21, 2024
Definitely worth confirming that the gpu variant is being used, but I also wouldn't be particularly surprised if it's bit-rotted a bit.
We have no CI tests for GPU support - if we're committing to providing examples for GPU support in dagger (which we definitely should do), then I think we need to add GPU tests in CI for sure.
samalba commentedon Nov 21, 2024
I confirm I am now using the
-gpuvariant: here is what I get:I keep digging... Here is a trace for the who can access: https://dagger.cloud/samalba/traces/a8be4e92d6691e5886928bbbb5d8d87e?listen=f96092b08c3043b3&listen=e2afe3eab45439c0
rajatjindal commentedon Nov 22, 2024
I've been looking at it and able to reproduce the issue. I enabled debug logging for the nvidia-container-toolkit, and captured some additional logs:
nvidia-container-toolkit.log
I am still looking into why this is happening.
Just FYI, I am now using the same docker image to run
TestCudafunction, that we use for engine and therefore expect it to have same packages installed, but still get same error. so my 2 cents is that the nvidia-container-toolkit is not able to inject something successfully when running the container.rajatjindal commentedon Nov 22, 2024
a little search of the error string leads to a few related issues https://github.com/search?q=%22missing+compat32+library%22&type=issues&s=updated&o=desc
I am going to go through these and see if I can use any of the suggested workarounds there.
rajatjindal commentedon Nov 25, 2024
I finally have this working after installing
libnvidia-compute-565. The nvidia drivers are really touchy w.r.t version numbers as such, but I found installing this package fix it for bothnvidia/cuda:12.6.2-base-ubuntu24.04andnvidia/cuda:11.7.1-base-ubuntu20.04.The diff to @samalba repo: https://github.com/samalba/dagger-modules/compare/main...rajatjindal:samalba-dagger-modules:fix-gpu?expand=1
sample output:
marcosnils commentedon Nov 25, 2024
That's awesome Rajat! Seems like the diff link you've shared is not showing any changes, maybe you forgot to commit?
rajatjindal commentedon Nov 25, 2024
hmm, that is strange, I do see the changes using that URL.
although the diff is just to run the following two commands:
rajatjindal commentedon Nov 25, 2024
another workaround that I found to be working was to mount
/.fly-upper-layerto the container and add/<mounted-path>/usr/lib/x86_64-linux-gnutoLD_LIBRARY_PATH.Note: I found the required
*.sofiles in both/.fly-upper-layerAND/usr/lib/x86_64-linux-gnu/on thefly.ioapp machine, so I am assuming mounting either of them should work, but I tried mounting/.fly-upper-layeronly.list of `*.so` files
rajatjindal commentedon Dec 2, 2024
I just tried this on a GPU VM that @marcosnils helped me get access to, and it seems to have worked without any additional package installation. I am going to investigate this more tomorrow but it seems like the issue could be specific to how fly.io setup the firecracker vm.
samalba commentedon Dec 3, 2024
That's neat, thanks @rajatjindal for gathering all those info. I confirm the workaround on fly. Given we can't hardcode a path on the host, it's probably better (more portable) to rely on installing
libnvidia-compute-565.Here is the working test for the record:
marcosnils commentedon Dec 3, 2024
@samalba regarding your question about Lambda labs, seems like it'll work out of the box similarly to our tests in Oblivus. Let us know in case you give it a try and it doesn't work for some reason.
samalba commentedon Dec 10, 2024
So I had some time to try it out today:
I keep getting this error, every time I invoke the
ExperimentalWithAllGPUs()call:Out of the box, a Lambda VM comes with an
Ubuntu 22.04.5 LTSand it seems to have the right packages installed:Here is how I started the dagger-engine after stopping the default one (v0.14.0):
docker run -d --privileged -e _EXPERIMENTAL_DAGGER_GPU_SUPPORT=true --name dagger-engine-v0.14.0 registry.dagger.io/engine:v0.14.0-gpu -- --debugFor the record I did my test with an instance with an Nvidia A6000 attached (gpu_1x_a6000). @marcosnils and @rajatjindal I gave you both an access to my account in case you want to have a look.
rajatjindal commentedon Dec 10, 2024
I think I found the problem, we need to start dagger with
--gpus all. once I did that I was able to run a cuda test container on Lambda labs instance.samalba commentedon Dec 10, 2024
Indeed, I can make it work when starting the engine container with GPU. I guess fly.io transparently set this as well.
Thanks for the help! I am closing this issue as we have several ways to access the GPU, I am working on documenting all this (planning to open the PR in the next few days).