quartz/content/AI&DATA/LXD for ML.md
mahmut_erdem.ozgen 2347565cc1 Add xroad
2024-01-22 13:27:27 +03:00

11 lines
1.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#lcd #lxd #nvidia
The ML application likely requires access to a GPU to run the model on.
Assuming you have a single NVidia GPU, you would create a container with the NVidia runtime, and add at least the `compute` and `utility` capability. The first is for _CUDA_, the second is to have the `nvidia-smi` utility to verify that the GPU is responding. Then, you add a LXD device for the GPU in order to expose the GPU to the container.
`$ lxc launch ubuntu:18.04 machine-learning -c nvidia.runtime=true -c nvidia.driver.capabilities=compute,utility Creating machine-learning Starting machine-learning $ lxc config device add machine-learning mygpu gpu Device mygpu added to machine-learning $`
Finally, get a shell into the container and run `nvidia-smi` to verify that the GPU is accessible from within the container.
By doing all the above, your container will have the proper NVIDIA driver and the proper NVIDIA runtime. If you follow some ML tutorial, you then continue with the rest of their instructions to setup your system. That is, do not follow other instructions on setting up the NVIDIA driver or runtime.