Hello EE,
Similar code (just substitute PhotoScan by Metashape) would work in the latest version. It enables all the available GPUs and disables the use of CPU, in case at least one GPU is enabled.
In most cases it is optimal configuration. You may only need to alter that, when working on the system with integrated graphics: you may want to enable CPU, if there's no discrete GPU available, or disable integrated graphics, if there's a powerful discrete GPU.