38 #include <SkelCL/detail/Device.h>
44 class DeviceTest :
public ::testing::Test {
46 DeviceTest() : _platform(), _device() {
47 std::vector<cl::Platform> platforms;
48 cl::Platform::get(&platforms);
49 _platform = platforms[0];
51 std::vector<cl::Device> devices;
52 _platform.getDevices(CL_DEVICE_TYPE_ALL, &devices);
60 cl::Platform _platform;
64 TEST_F(DeviceTest, CreateDevice) {
66 skelcl::detail::Device
device(_device, _platform,
id);
68 EXPECT_EQ(
id,
device.id());
69 EXPECT_EQ(_device(),
device.clDevice()());
71 cl::Context context =
device.clContext();
73 std::vector<cl::Device> devices = context.getInfo<CL_CONTEXT_DEVICES>(&err);
74 EXPECT_EQ(CL_SUCCESS, err);
75 EXPECT_EQ(1, devices.size());
76 EXPECT_EQ(
device.clDevice()(), devices[0]());
SKELCL_DLL detail::DeviceID device(size_t dID)
Creates an OpenCL device ID to be used as parameter of the init(detail::PlatformID, detail::DeviceID) function.