| 345 | |
| 346 | |
| 347 | int |
| 348 | main(void) |
| 349 | { |
| 350 | cl_int err; |
| 351 | cl_platform_id platform; |
| 352 | cl_device_id device; |
| 353 | cl_context_properties props[] = { CL_CONTEXT_PLATFORM, 0, 0 }; |
| 354 | cl_context context; |
| 355 | |
| 356 | err = clGetPlatformIDs(1, &platform, NULL); |
| 357 | if (err != CL_SUCCESS) { |
| 358 | fprintf(stderr, "clGetPlatformIDs() failed with %d\n", err); |
| 359 | return 1; |
| 360 | } |
| 361 | err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL); |
| 362 | if (err != CL_SUCCESS) { |
| 363 | fprintf(stderr, "clGetDeviceIDs() failed with %d\n", err); |
| 364 | return 1; |
| 365 | } |
| 366 | props[1] = (cl_context_properties)platform; |
| 367 | context = clCreateContext(props, 1, &device, NULL, NULL, &err); |
| 368 | if (err != CL_SUCCESS) { |
| 369 | fprintf(stderr, "clCreateContext() failed with %d\n", err); |
| 370 | return 1; |
| 371 | } |
| 372 | |
| 373 | printf("Launch tests for kernel generators\n"); |
| 374 | printf("-----------------------------------------\n"); |
| 375 | if (!testGen()) { |
| 376 | printf("-----------------------------------------\n\n"); |
| 377 | printf("Launch tests for kernel cache\n"); |
| 378 | printf("-----------------------------------------\n"); |
| 379 | testCache(context, device); |
| 380 | } |
| 381 | |
| 382 | clReleaseContext(context); |
| 383 | return 0; |
| 384 | } |
| 385 | |