MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / SetUp

Method SetUp

test/ocl_ext_context.cpp:56–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 cl_command_queue queue = NULL;
55
56 void SetUp() override {
57 cl_platform_id platformId = NULL;
58 cl_uint numPlatforms;
59 cl_uint numDevices;
60 cl_int errorCode = 0;
61
62 checkErr(clGetPlatformIDs(1, &platformId, &numPlatforms),
63 "Get Platforms failed");
64
65 checkErr(clGetDeviceIDs(platformId, CL_DEVICE_TYPE_DEFAULT, 1,
66 &deviceId, &numDevices),
67 "Get cl_device_id failed");
68
69 context = clCreateContext(NULL, 1, &deviceId, NULL, NULL, &errorCode);
70 checkErr(errorCode, "Context creation failed");
71
72#ifdef CL_VERSION_2_0
73 queue = clCreateCommandQueueWithProperties(context, deviceId, 0,
74 &errorCode);
75#else
76 queue = clCreateCommandQueue(context, deviceId, 0, &errorCode);
77#endif
78
79 checkErr(errorCode, "Command queue creation failed");
80 }
81 void TearDown() override {
82 checkErr(clReleaseCommandQueue(queue), "clReleaseCommandQueue");
83 checkErr(clReleaseContext(context), "clReleaseContext");

Callers

nothing calls this directly

Calls 1

checkErrFunction · 0.85

Tested by

no test coverage detected