2.8 not using GPU, but only when headless

See this thread, there is a solution at the bottom that shows how to set Cuda devices in the command line