When rendering headless on a Multi GPU host(vastai) is it possible to have the tiles generated by the gpus and not the CPU?

I’m trying to use vast.ai to render the demo of the BMW. I have gotten a 5xGTX 1080ti system and I have created the docker. I managed to get it going but it takes very long to create the 12 tiles. the 5 GTX 1080ti are ideal during that time. Is there a way to force blender to generate the tile on the gpu’s rather than he Xeon E5-2650L?

here is what I have done.
I have selected the docker image nvidia/cuda:10.0-base-ubuntu16.04

ssh into the system. I ran this script to install everything
bash -c ‘apt -y update; apt -y upgrade apt install -y libglu1-mesa-dev ;apt-get install -y libxi6 libgconf-2-4; apt-get install -y libfontconfig1 libxrender1; apt-get install -y libxxf86vm-dev; apt-get install -y libxfixes-dev; apt install -y libgl1-mesa-glx; apt-get install -y curl; apt-get install -y wget; apt-get install -y p7zip-full; apt-get install xz-utils; apt-get install nano; wget https://ftp.nluug.nl/pub/graphics/blender/release/Blender2.82/blender-2.82a-linux64.tar.xz; xz -d blender-2.82a-linux64.tar.xz; tar -xvf blender-2.82a-linux64.tar; apt upgrade’

Then I downloaded the bmw27_gpt.blend file to the system

Create the py file: nano activate_gpu.py Then paste the following code:

import re
import bpy
import time
scene = bpy.context.scene
scene.cycles.device = 'GPU'
prefs = bpy.context.preferences
prefs.addons['cycles'].preferences.get_devices()
cprefs = prefs.addons['cycles'].preferences
print(cprefs)
for compute_device_type in ('CUDA', 'OPENCL', 'NONE'):
  try:
    cprefs.compute_device_type = compute_device_type
    print('Device found',compute_device_type)
    break
  except TypeError:
    pass
for device in cprefs.devices:
    print('Activating',device)
    device.use = True

and then ran this

./blender -b bmw27_gpu.blend -E CYCLES -P activate_gpu.py -o output/output -a

the images are being generated but it takes like 2-3 seconds vs the tiles that take over 10 minutes to generate the 12 tiles.

Im scouring the web but can’t seem to find a solution.

device.use = (device.type != 'CPU') might do it.

you are my hero! yes that works!!!