Commit 194e0e8e authored by kulvait's avatar kulvait

New function getPlatformName in OpenCLManager

parent dc9f5e2c
......@@ -15,7 +15,9 @@ namespace util {
{
public:
static uint32_t platformCount();
static std::shared_ptr<cl::Platform> getPlatform(uint32_t platformID = 0, bool verbose = false);
static std::shared_ptr<cl::Platform> getPlatform(uint32_t platformID = 0,
bool verbose = false);
static std::string getPlatformName(uint32_t platformID);
static uint32_t deviceCount(uint32_t platformID);
static std::shared_ptr<cl::Device>
getDevice(const cl::Platform& platform, uint32_t deviceID = 0, bool verbose = false);
......
......@@ -35,6 +35,20 @@ namespace util {
return std::make_shared<cl::Platform>(all_platforms[platformID]);
}
std::string OpenCLManager::getPlatformName(uint32_t platformID)
{
std::vector<cl::Platform> all_platforms;
cl::Platform::get(&all_platforms);
if(all_platforms.size() <= platformID)
{
LOGE << io::xprintf("There is just %d OpenCL platforms on the PC and you selected "
"invalplatformID zero based index %d.",
all_platforms.size(), platformID);
return nullptr;
}
return all_platforms[platformID].getInfo<CL_PLATFORM_NAME>().c_str();
}
uint32_t OpenCLManager::deviceCount(uint32_t platformID)
{
std::vector<cl::Device> all_devices;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment