Multi-Devices

The GGEMS library can use several devices during the simulation. There are two ways to do this, either give the device index or explicitly indicate the device(s).

  • Using the device index:

from ggems import *

opencl_manager = GGEMSOpenCLManager()
opencl_manager.set_device_index(0) # Activate device id 0
opencl_manager.set_device_index(2) # Activate device id 2, if it exists

opencl_manager.clean()
exit()
  • Explicitly indicate the device(s):

from ggems import *

opencl_manager = GGEMSOpenCLManager()
opencl_manager.set_device_to_activate('gpu', 'nvidia') # Activate all NVIDIA GPU only
opencl_manager.set_device_to_activate('gpu', 'intel') # Activate all Intel GPU only
opencl_manager.set_device_to_activate('gpu', 'amd') # Activate all AMD GPU only
opencl_manager.set_device_to_activate('cpu') # Activate cpu only
opencl_manager.set_device_to_activate('all') # Activate all found devices
opencl_manager.set_device_to_activate('0;2') # Activate devices 0 and 2

opencl_manager.clean()
exit()