If the HDMI is connected to the GPU, e.g. for a monitor, then cuda may not work, perhaps because the GPU is occupied by the monitor. A possible solution may be disconnecting the HDMI and use ssh to control your server.