| 77 | } |
| 78 | |
| 79 | int |
| 80 | main(void) |
| 81 | { |
| 82 | cl_int err; |
| 83 | // Increase platforms array for system needs; 2 covers most situations |
| 84 | cl_platform_id platforms[] = { 0,0 }; |
| 85 | cl_device_id device = 0; |
| 86 | cl_context_properties props[3] = { CL_CONTEXT_PLATFORM, 0, 0 }; |
| 87 | cl_context ctx = 0; |
| 88 | cl_command_queue queue = 0; |
| 89 | cl_mem bufA, bufB; |
| 90 | cl_event event = NULL; |
| 91 | int ret = 0; |
| 92 | |
| 93 | makeScaledIdentity( A, M, N, 1.0f ); |
| 94 | makeScaledIdentity( B, M, N, 1.0f); |
| 95 | makeScaledIdentity( result, M, N, 0.0f); |
| 96 | |
| 97 | /* Setup OpenCL environment. */ |
| 98 | err = clGetPlatformIDs( sizeof( platforms )/ sizeof( cl_platform_id ), &platforms[0], NULL); |
| 99 | if (err != CL_SUCCESS) { |
| 100 | printf( "clGetPlatformIDs() failed with %d\n", err ); |
| 101 | return 1; |
| 102 | } |
| 103 | |
| 104 | // Change this statement to pick the desired platform under test |
| 105 | cl_platform_id test_platform = platforms[1]; |
| 106 | |
| 107 | //!!! Change device type to validate; works on GPU, faults on CPU |
| 108 | err = clGetDeviceIDs(test_platform, CL_DEVICE_TYPE_CPU, 1, &device, NULL); |
| 109 | if (err != CL_SUCCESS) { |
| 110 | printf( "clGetDeviceIDs() failed with %d\n", err ); |
| 111 | return 1; |
| 112 | } |
| 113 | |
| 114 | props[1] = (cl_context_properties)test_platform; |
| 115 | ctx = clCreateContext(props, 1, &device, NULL, NULL, &err); |
| 116 | if (err != CL_SUCCESS) { |
| 117 | printf( "clCreateContext() failed with %d\n", err ); |
| 118 | return 1; |
| 119 | } |
| 120 | |
| 121 | queue = clCreateCommandQueue(ctx, device, 0, &err); |
| 122 | if (err != CL_SUCCESS) { |
| 123 | printf( "clCreateCommandQueue() failed with %d\n", err ); |
| 124 | clReleaseContext(ctx); |
| 125 | return 1; |
| 126 | } |
| 127 | |
| 128 | /* Setup clblas. */ |
| 129 | err = clblasSetup(); |
| 130 | if (err != CL_SUCCESS) { |
| 131 | printf("clblasSetup() failed with %d\n", err); |
| 132 | clReleaseCommandQueue(queue); |
| 133 | clReleaseContext(ctx); |
| 134 | return 1; |
| 135 | } |
| 136 |
nothing calls this directly
no test coverage detected