看看这段代码
#include<iostream>
using namespace std;
//Shape is an Interface Class. No data and everything pure virtual
class Shape {
public:
virtual void Area(int length, int breadth) = 0;
virtual void Perimeter(int length, int breadth) = 0;
//Note, no data
};
//Derived class - Inherits Shape as Public
class Rectangle : public Shape {
public:
void Area(int length, int breadth);
void Perimeter(int length, int breadth);
private:
int someData;
};
//Derived class - Inherits Shape as Public
class Triangle : public Shape …Run Code Online (Sandbox Code Playgroud) 要创建一个opencl应用程序,第一步是通过使用来获取平台
clGetPlatformIDs
Run Code Online (Sandbox Code Playgroud)
我从功能返回的平台有问题;函数返回我有2个平台,但当我检查它时,我发现我有一个平台,但它是重复的!!
源代码
struct PLATFORM
{
cl_platform_id _Platforms ;
map <cl_platform_info , char*> _Platforms_info ;
};
cl_int error ;
cl_uint temp_num_platforms ;
error = clGetPlatformIDs (NULL , NULL , &temp_num_platforms );
if ( error != CL_SUCCESS )
{
/* create error and debug function*/
cout << " error detect platforms " << endl << endl ;
}
else
{
cout << " we detect " << temp_num_platforms << " platforms " << endl << endl ;
_Platforms = std::unique_ptr …Run Code Online (Sandbox Code Playgroud)