void AcceleratorDevice::InitializePlatform() { const cl_uint kMaxNumberOfPlatforms = 5; cl_uint number_of_platforms; clGetPlatformIDs(kMaxNumberOfPlatforms, nullptr, &number_of_platforms); auto platforms = static_cast<cl_platform_id*>(malloc( number_of_platforms * sizeof(cl_platform_id))); clGetPlatformIDs(number_of_platforms, platforms, 0); *logger_ << log4cpp::Priority::DEBUG << "Number of platforms: " << number_of_platforms; if (number_of_platforms > 0) { platform_ = platforms[0]; PrintPlatformInfo(CL_PLATFORM_NAME, "name"); PrintPlatformInfo(CL_PLATFORM_VENDOR, "vendor"); PrintPlatformInfo(CL_PLATFORM_VERSION, "version"); PrintPlatformInfo(CL_PLATFORM_PROFILE, "profile"); PrintPlatformInfo(CL_PLATFORM_EXTENSIONS, "extensions"); } else { *logger_ << log4cpp::Priority::ERROR << "No OpenCL platforms available."; exit(EXIT_FAILURE); } free(platforms); *logger_ << log4cpp::Priority::INFO << "Initializing Parallella platform completed."; }
void OCL_Device::PrintInfo() { // Printing device and platform information printf("Using platform: "); PrintPlatformInfo(m_platform_id); printf("Using device: "); PrintDeviceInfo(m_device_id); }
void ClSetup::SetupCl(int platform_index, int device_index) { platform = GetPlatformID(platform_index); PrintPlatformInfo(platform); device = GetDeviceID(device_index); PrintDeviceInfo(device); context = CreateContext(); queue = CreateCommandQueue(); bInit = true; }
void PrintOpenCLEnvironmentInfo( OpenCLEnvironmentInfo *opencl_env ) { printf( "OpenCL environment information :\n" ); printf( "--------------------------------\n" ); printf( "Number of OpenCL platforms detected : %u\n", opencl_env->num_platforms ); for ( cl_uint i = 0; i < opencl_env->num_platforms; i++ ) { printf( "Platform #%u :\n", i ); PrintPlatformInfo( &opencl_env->platforms[i] ); } }