diff --git a/hpvm/projects/hpvm-rt/hpvm-rt.cpp b/hpvm/projects/hpvm-rt/hpvm-rt.cpp index 266d6296dc6b1a119f804e353e0917fc6284d60f..20af30fdfa3d23401d05644a45c0caf124333524 100644 --- a/hpvm/projects/hpvm-rt/hpvm-rt.cpp +++ b/hpvm/projects/hpvm-rt/hpvm-rt.cpp @@ -16,6 +16,7 @@ #endif #include "hpvm-rt.h" +#define DEBUG_BUILD #ifndef DEBUG_BUILD #define DEBUG(s) \ {} @@ -1396,8 +1397,9 @@ cl_platform_id findPlatform(const char *platform_name_search) { if (name.find(search) != std::string::npos) { // Found! + cl_platform_id pid = pids[i]; free(pids); - return pids[i]; + return pid; } } @@ -1439,9 +1441,36 @@ void *llvm_hpvm_ocl_initContext(enum hpvm::Target T) { cl_platform_id platformId; if (T == hpvm::GPU_TARGET) { platformId = findPlatform("nvidia"); + char buffer[10240]; + DEBUG(cout << "Found NVIDIA Device \n"); + clGetPlatformInfo(platformId, CL_PLATFORM_PROFILE, 10240, buffer, NULL); + DEBUG(cout << "\tPROFILE = " << buffer << flush << "\n"); + clGetPlatformInfo(platformId, CL_PLATFORM_VERSION, 10240, buffer, NULL); + DEBUG(cout << "\tVERSION = " << buffer << flush << "\n"); + clGetPlatformInfo(platformId, CL_PLATFORM_NAME, 10240, buffer, NULL); + DEBUG(cout << "\tNAME = " << buffer << flush << "\n"); + clGetPlatformInfo(platformId, CL_PLATFORM_VENDOR, 10240, buffer, NULL); + DEBUG(cout << "\tVENDOR = " << buffer << flush << "\n"); + clGetPlatformInfo(platformId, CL_PLATFORM_EXTENSIONS, 10240, buffer, + NULL); + DEBUG(cout << "\tEXTENSIONS = " << buffer << flush << "\n"); } else { platformId = findPlatform("intel"); + char buffer[10240]; + DEBUG(cout << "Found Intel Device \n"); + clGetPlatformInfo(platformId, CL_PLATFORM_PROFILE, 10240, buffer, NULL); + DEBUG(cout << "\tPROFILE = " << buffer << flush << "\n"); + clGetPlatformInfo(platformId, CL_PLATFORM_VERSION, 10240, buffer, NULL); + DEBUG(cout << "\tVERSION = " << buffer << flush << "\n"); + clGetPlatformInfo(platformId, CL_PLATFORM_NAME, 10240, buffer, NULL); + DEBUG(cout << "\tNAME = " << buffer << flush << "\n"); + clGetPlatformInfo(platformId, CL_PLATFORM_VENDOR, 10240, buffer, NULL); + DEBUG(cout << "\tVENDOR = " << buffer << flush << "\n"); + clGetPlatformInfo(platformId, CL_PLATFORM_EXTENSIONS, 10240, buffer, + NULL); + DEBUG(cout << "\tEXTENSIONS = " << buffer << flush << "\n"); } + DEBUG(cout << "Found plarform with id: " << platformId << "\n"); cl_context_properties properties[] = {CL_CONTEXT_PLATFORM, (long)platformId, 0}; globalOCLContext = clCreateContextFromType( @@ -1454,6 +1483,8 @@ void *llvm_hpvm_ocl_initContext(enum hpvm::Target T) { errcode = clGetContextInfo(globalOCLContext, CL_CONTEXT_DEVICES, 0, NULL, &dataBytes); checkErr(errcode, CL_SUCCESS, "Failure to get context info length"); + + DEBUG(cout << "Got databytes: " << dataBytes << "\n"); clDevices = (cl_device_id *)malloc(dataBytes); errcode |= clGetContextInfo(globalOCLContext, CL_CONTEXT_DEVICES, dataBytes,