SEXP ocl_get_platform_info(SEXP platform) { SEXP res; cl_platform_id platform_id = getPlatformID(platform); const char *names[] = { "name", "vendor", "version", "profile", "exts" }; SEXP nv = PROTECT(Rf_allocVector(STRSXP, 5)); int i; for (i = 0; i < LENGTH(nv); i++) SET_STRING_ELT(nv, i, mkChar(names[i])); res = PROTECT(Rf_allocVector(VECSXP, LENGTH(nv))); Rf_setAttrib(res, R_NamesSymbol, nv); SET_VECTOR_ELT(res, 0, getPlatformInfo(platform_id, CL_PLATFORM_NAME)); SET_VECTOR_ELT(res, 1, getPlatformInfo(platform_id, CL_PLATFORM_VENDOR)); SET_VECTOR_ELT(res, 2, getPlatformInfo(platform_id, CL_PLATFORM_VERSION)); SET_VECTOR_ELT(res, 3, getPlatformInfo(platform_id, CL_PLATFORM_PROFILE)); SET_VECTOR_ELT(res, 4, getPlatformInfo(platform_id, CL_PLATFORM_EXTENSIONS)); UNPROTECT(2); return res; }
void Platform::queryTotalPlatforms() { cl_int errorCode; cl_uint numberOfPlatforms; errorCode = clGetPlatformIDs( 0, 0, &numberOfPlatforms ); errorCheck( errorCode ); std::cout << "Found " << numberOfPlatforms << " platform(s)" << std::endl; std::vector<cl_platform_id> platforms(numberOfPlatforms); errorCheck( clGetPlatformIDs( numberOfPlatforms, platforms.data(), 0 ) ); for( unsigned int i = 0; i < platforms.size(); ++i ) { std::cout << "Platform " << i << std::endl; getPlatformInfo( platforms.at(0) ); std::cout << std::endl; } }
WString BuildManager::getDefines(PlatformType type) const { return getPlatformInfo(type)->defines; }