KhronosGroup / OpenCL-SDK

OpenCL SDK
Apache License 2.0
577 stars 121 forks source link

Functions to automatically select Device with most flops/memory #41

Open ProjectPhysX opened 2 years ago

ProjectPhysX commented 2 years ago

Added utility functions to automatically select the fastest Device or the Device with largest memory capacity from all available Devices.

For selecting the fastest Device, the TFLOPs/s performance of the Device is estimated. For Nvidia and AMD GPUs, the estimate is challenging due to the different number of cores per CU depending on the microarchitecture and even GPU model:

The vast majority of GPUs are captured with the correct estimate, but for some rare/old GPUs, the estimate could be wrong by a factor of 2. For CPUs without SMT/HT as well as for very old CPUs with IPC<32 or very new CPUs with IPC=64 (AVX-512), the estimate is wrong.

Overall however, the estimated values are good enough to identify the fastest device in systems with one CPU and one or multiple GPUs.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.