![]() |
QMCPACK
|
orchestrate platforms (programming models) and set up the default device on each platform More...
Public Member Functions | |
DeviceManager (int local_rank, int local_size) | |
constructor More... | |
~DeviceManager () | |
int | getDefaultDeviceNum () const |
int | getNumDevices () const |
Static Public Member Functions | |
static void | initializeGlobalDeviceManager (int local_rank, int local_size) |
initialize the global instance of DeviceManager arguments are the same as the constructor More... | |
static const DeviceManager & | getGlobal () |
global instance accessor More... | |
Private Attributes | |
int | default_device_num |
the id of default device. Must be defined before platform device manager objects More... | |
int | num_devices |
the number of devices. Must be defined before platform device manager objects More... | |
Static Private Attributes | |
static std::unique_ptr< DeviceManager > | global |
the global singleton which can be used to query default devices and all the captured devices. More... | |
orchestrate platforms (programming models) and set up the default device on each platform
Currently support CUDA, OpenMP, SYCL
Each platform provides its own device manager class. Each individual device manager initializes all the devices visible to the process and also set the default device. The first initialized platform selects the default device for the current process and all the rest platforms follow that choice.
The device manager on each platform may be constomized to store a list of known device numbers or a list of context device handles depending on the need.
DeviceManager assumes there is only one type of accelerators although they may support multiple platforms. Under this assumption, the numbers of devices captured on all the platforms must agree.
DeviceManager::global is intended to the per-process global instance and should be initialized after MPI initialization in main().
Definition at line 50 of file DeviceManager.h.
DeviceManager | ( | int | local_rank, |
int | local_size | ||
) |
constructor
local_rank | the rank id of the node local MPI communicator |
local_size | the size of the node local MPI communicator |
Definition at line 22 of file DeviceManager.cpp.
References qmcplusplus::app_warning(), and DeviceManager::num_devices.
|
default |
|
inline |
Definition at line 62 of file DeviceManager.h.
References DeviceManager::default_device_num.
|
static |
global instance accessor
Definition at line 57 of file DeviceManager.cpp.
References DeviceManager::global.
Referenced by QMCMain::QMCMain().
|
inline |
Definition at line 63 of file DeviceManager.h.
References DeviceManager::num_devices.
Referenced by QMCMain::QMCMain().
|
static |
initialize the global instance of DeviceManager arguments are the same as the constructor
Definition at line 47 of file DeviceManager.cpp.
References DeviceManager::global.
Referenced by main(), and QMCMain::QMCMain().
|
private |
the id of default device. Must be defined before platform device manager objects
Definition at line 86 of file DeviceManager.h.
Referenced by DeviceManager::getDefaultDeviceNum().
|
staticprivate |
the global singleton which can be used to query default devices and all the captured devices.
Definition at line 84 of file DeviceManager.h.
Referenced by DeviceManager::getGlobal(), and DeviceManager::initializeGlobalDeviceManager().
|
private |
the number of devices. Must be defined before platform device manager objects
Definition at line 88 of file DeviceManager.h.
Referenced by DeviceManager::DeviceManager(), and DeviceManager::getNumDevices().