Forum

Author Topic: Enabling GPUs through Python API  (Read 3809 times)

ascornelio

  • Newbie
  • *
  • Posts: 6
    • View Profile
Enabling GPUs through Python API
« on: March 05, 2018, 07:11:00 AM »
Hello,

I'm am trying to enable my GPU for photoscan's computations.
The reason I'm writing here is because I suspect its not working properly, evident by watching my computer's Task Manager process levels. 

When enabling the GPU device through the GUI (Tools>Preference>GPU), my computer is hitting GPU percentages of 10-20% for photoscan.

When enabling through the python script and running photoscan, my computer hits 5% once and then remains at 0% for most of the time.

My question is: how do you enable the GPUs through the python API?

As far as I can tell, its just by setting:
Code: [Select]
PhotoScan.app.gpu_mask = 1

Is there anything else you have to do?

My setup includes:
PhotoScan version 1.4.1
GPU: GeForce GTX 1070
OpenGL version: 4.5.0 NVIDIA 384.94
CPU: Intel i7 at 2.8GHz
RAM: 32GB
OS: windows 10

Cheers,
Alex

PAPA2137

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Enabling GPUs through Python API
« Reply #1 on: March 05, 2018, 10:57:17 AM »
Are you sure that your gpu is first on the list Application.enumGPUDevices()? Integrated graphics may also appear on that list and you migth be activating integrated graphics instead of your gtx.

ascornelio

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Enabling GPUs through Python API
« Reply #2 on: March 06, 2018, 05:47:32 AM »
Thanks for the reply and yes it is.
The output is seen in the attached image.

Any other advice would be greatly appreciated.

Is there any other GPU enabling/configuration steps to do when scripting?

update: okay so setting:
Code: [Select]
PhotoScan.app.gpu_mask = 0
has resulted in a significant boost of GPU performance!

So i think this is solved. If only the python API could be a little more verbose
« Last Edit: March 06, 2018, 06:01:11 AM by ascornelio »