| 481 | } |
| 482 | |
| 483 | void |
| 484 | initOpenCl(void) |
| 485 | { |
| 486 | cl_int status = 0; |
| 487 | cl_uint numPlatforms; |
| 488 | status = clGetPlatformIDs(0, NULL, &numPlatforms); |
| 489 | checkErrorFunc("clGetPlatformIDs", status); |
| 490 | |
| 491 | if (numPlatforms > 0) { |
| 492 | unsigned int i; |
| 493 | cl_platform_id* platforms = |
| 494 | (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id)); |
| 495 | |
| 496 | status = clGetPlatformIDs(numPlatforms, platforms, NULL); |
| 497 | checkErrorFunc("clGetPlatformIDs", status); |
| 498 | |
| 499 | for(i=0; i < numPlatforms; ++i) { |
| 500 | char pbuff[100]; |
| 501 | status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, |
| 502 | sizeof(pbuff), pbuff, NULL); |
| 503 | |
| 504 | checkErrorFunc("clGetPlatformInfo", status); |
| 505 | genInfo.platform = platforms[i]; |
| 506 | if(!strcmp(pbuff, "Advanced Micro Devices, Inc.")) { |
| 507 | break; |
| 508 | } |
| 509 | } |
| 510 | free(platforms); |
| 511 | } |
| 512 | |
| 513 | // Init Device count |
| 514 | status = clGetDeviceIDs(genInfo.platform, genInfo.devType, 0, 0, |
| 515 | (cl_uint*)&genInfo.numDevices); |
| 516 | checkErrorFunc("clGetDeviceIDs", status); |
| 517 | } |
| 518 | |
| 519 | void |
| 520 | initDevice(int dev) |
no test coverage detected