diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2017-04-07 07:37:30 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2017-04-07 07:37:30 +0200 |
commit | fb6c78ea070fbfc7d2d38a3c0d77a8219cef6f04 (patch) | |
tree | 4de82d8b349d7eb5939f60c24f0712979009001f /src/clpp11.hpp | |
parent | d28ee082b0844086ee9b9cfb50825427f0b3a48a (diff) |
Added a special override database for the Apple CPU implementation on OS X: this makes the test work, it does not focus on good performance
Diffstat (limited to 'src/clpp11.hpp')
-rw-r--r-- | src/clpp11.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/clpp11.hpp b/src/clpp11.hpp index 29f81cf8..e0b8cbe9 100644 --- a/src/clpp11.hpp +++ b/src/clpp11.hpp @@ -164,6 +164,10 @@ class Platform { platform_ = platforms[platform_id]; } + // Methods to retrieve platform information + std::string Name() const { return GetInfoString(CL_PLATFORM_NAME); } + std::string Vendor() const { return GetInfoString(CL_PLATFORM_VENDOR); } + // Returns the number of devices on this platform size_t NumDevices() const { auto result = cl_uint{0}; @@ -175,6 +179,17 @@ class Platform { const cl_platform_id& operator()() const { return platform_; } private: cl_platform_id platform_; + + // Private helper functions + std::string GetInfoString(const cl_device_info info) const { + auto bytes = size_t{0}; + CheckError(clGetPlatformInfo(platform_, info, 0, nullptr, &bytes)); + auto result = std::string{}; + result.resize(bytes); + CheckError(clGetPlatformInfo(platform_, info, bytes, &result[0], nullptr)); + result.resize(strlen(result.c_str())); // Removes any trailing '\0'-characters + return result; + } }; // Retrieves a vector with all platforms |