| 19 | #include <clBLAS.h> |
| 20 | |
| 21 | class BasicRoutines : public testing::Test { |
| 22 | protected: |
| 23 | BasicRoutines() : |
| 24 | platform(0), device(0), context(NULL), queue(NULL) { |
| 25 | } |
| 26 | |
| 27 | virtual ~BasicRoutines() { |
| 28 | } |
| 29 | |
| 30 | virtual void SetUp() { |
| 31 | cl_int err; |
| 32 | cl_context_properties props[] = { CL_CONTEXT_PLATFORM, 0, 0 }; |
| 33 | |
| 34 | ASSERT_EQ(CL_SUCCESS, clGetPlatformIDs(1, &platform, NULL)); |
| 35 | ASSERT_EQ(CL_SUCCESS, |
| 36 | clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL)); |
| 37 | props[1] = (cl_context_properties)platform; |
| 38 | context = clCreateContext(props, 1, &device, NULL, NULL, &err); |
| 39 | ASSERT_EQ(CL_SUCCESS, err) << "clCreateContext() failed"; |
| 40 | queue = clCreateCommandQueue(context, device, 0, &err); |
| 41 | ASSERT_EQ(CL_SUCCESS, err) << "clCreateCommandQueue() failed"; |
| 42 | } |
| 43 | |
| 44 | virtual void TearDown() { |
| 45 | if (queue != NULL) { |
| 46 | clReleaseCommandQueue(queue); |
| 47 | } |
| 48 | if (context != NULL) { |
| 49 | clReleaseContext(context); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | cl_platform_id platform; |
| 54 | cl_device_id device; |
| 55 | cl_context context; |
| 56 | cl_command_queue queue; |
| 57 | }; |
| 58 | |
| 59 | TEST_F(BasicRoutines, UsualCodeFlow) { |
| 60 | EXPECT_EQ(CL_SUCCESS, clblasSetup()); |
nothing calls this directly
no outgoing calls
no test coverage detected