Running services in a Singularity container¶
Sometimes, for different reasons, programs uns as daemons, servers or started in background. This usually creates problems, since this will exit the container session, sometimes creating problems with lingering and zombie processes.
Here is an example on how to run LM Studio daemon/command line tool.
On Pelle the OS is a bit old and to run the tool and you will need to run it within a container with newer OS.
Start the server in a container instance¶
# Mount/unmount everything you might need
export APPTAINER_BINDPATH="/crex,/gorilla,/proj,/scratch"
export APPTAINER_NO_MOUNT="/domus/h1"
# Start an instance lm with Ubuntu 24.04
apptainer instance start --nv /sw/apps/pm-tools/latest/rackham/bin/Ubuntu_24.04.sif lm
# Start the server in the instance
apptainer exec instance://lm /home/user/.lmstudio/bin/lms server start
# You might need to select different runtime
# apptainer exec instance://lm /home/user/.lmstudio/bin/lms runtime select llama.cpp-linux-x86_64-avx2
# apptainer exec instance://lm /home/user/.lmstudio/bin/lms runtime select llama.cpp-linux-x86_64-nvidia-cuda-avx2
# apptainer exec instance://lm /home/user/.lmstudio/bin/lms runtime select llama.cpp-linux-x86_64-vulkan-avx2