File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,15 @@ std::vector<cl::Platform> get_platforms() {
1414 return platforms;
1515}
1616
17+ cl::Platform get_platform_matching (std::string_view s) {
18+ auto platforms = get_platforms ();
19+ for (auto &p : platforms) {
20+ auto pname = p.getInfo <CL_PLATFORM_NAME>();
21+ if (pname.find (s) != std::string::npos)
22+ return p;
23+ }
24+ }
25+
1726cl::Platform get_default_platform () { return get_platforms ()[0 ]; }
1827
1928std::vector<cl::Device> get_devices (const cl::Platform &p, int type) {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ class OCLHelpersException : public std::runtime_error {
2828
2929std::vector<cl::Platform> get_platforms ();
3030cl::Platform get_default_platform ();
31+ cl::Platform get_platform_matching (std::string_view s);
3132
3233std::vector<cl::Device> get_gpus (const cl::Platform &p);
3334std::vector<cl::Device> get_cpus (const cl::Platform &p);
You can’t perform that action at this time.
0 commit comments