コード例 #1
0
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.";
}
コード例 #2
0
ファイル: OCL_Device.cpp プロジェクト: Soledad89/learnOpenCL
void OCL_Device::PrintInfo()
{	
	// Printing device and platform information
	printf("Using platform: ");
	PrintPlatformInfo(m_platform_id);
	printf("Using device:   ");
	PrintDeviceInfo(m_device_id);
}
コード例 #3
0
ファイル: clsetup.cpp プロジェクト: goodgodgd/PointCloudApps
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;
}
コード例 #4
0
ファイル: opencl_env_info.c プロジェクト: capagot/cltools
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] );
    }
}