MCPcopy Create free account
hub / github.com/clMathLibraries/clBLAS / initOpenCl

Function initOpenCl

src/library/tools/tune/tune.c:483–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483void
484initOpenCl(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
519void
520initDevice(int dev)

Callers 1

createFileFunction · 0.85

Calls 1

checkErrorFuncFunction · 0.85

Tested by

no test coverage detected