MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / prettyPrintPlatformInfo

Function prettyPrintPlatformInfo

src/client/openCL.misc.cpp:32–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31
32void prettyPrintPlatformInfo( const cl_platform_id& pId )
33{
34 size_t platformProfileSize = 0;
35 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_PROFILE, 0, NULL, &platformProfileSize ),
36 "Getting CL_PLATFORM_PROFILE Platform Info string size ( ::clGetPlatformInfo() )" );
37
38 std::vector< char > szPlatformProfile( platformProfileSize );
39 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_PROFILE, platformProfileSize, &szPlatformProfile[ 0 ], NULL),
40 "Getting CL_PLATFORM_PROFILE Platform Info string ( ::clGetPlatformInfo() )" );
41
42 size_t platformVersionSize = 0;
43 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VERSION, 0, NULL, &platformVersionSize ),
44 "Getting CL_PLATFORM_VERSION Platform Info string size ( ::clGetPlatformInfo() )" );
45
46 std::vector< char > szPlatformVersion( platformVersionSize );
47 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VERSION, platformVersionSize, &szPlatformVersion[ 0 ], NULL),
48 "Getting CL_PLATFORM_VERSION Platform Info string ( ::clGetPlatformInfo() )" );
49
50 size_t platformNameSize = 0;
51 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_NAME, 0, NULL, &platformNameSize ),
52 "Getting CL_PLATFORM_NAME Platform Info string size ( ::clGetPlatformInfo() )" );
53
54 std::vector< char > szPlatformName( platformNameSize );
55 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_NAME, platformNameSize, &szPlatformName[ 0 ], NULL),
56 "Getting CL_PLATFORM_NAME Platform Info string ( ::clGetPlatformInfo() )" );
57
58 size_t vendorStringSize = 0;
59 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VENDOR, 0, NULL, &vendorStringSize ),
60 "Getting CL_PLATFORM_VENDOR Platform Info string size ( ::clGetPlatformInfo() )" );
61
62 std::vector< char > szPlatformVendor( vendorStringSize );
63 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_VENDOR, vendorStringSize, &szPlatformVendor[ 0 ], NULL),
64 "Getting CL_PLATFORM_VENDOR Platform Info string ( ::clGetPlatformInfo() )" );
65
66 size_t platformExtensionsSize = 0;
67 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_EXTENSIONS, 0, NULL, &platformExtensionsSize ),
68 "Getting CL_PLATFORM_EXTENSIONS Platform Info string size ( ::clGetPlatformInfo() )" );
69
70 std::vector< char > szPlatformExtensions( platformExtensionsSize );
71 OPENCL_V_THROW( ::clGetPlatformInfo( pId, CL_PLATFORM_EXTENSIONS, platformExtensionsSize, &szPlatformExtensions[ 0 ], NULL),
72 "Getting CL_PLATFORM_EXTENSIONS Platform Info string ( ::clGetPlatformInfo() )" );
73
74 const int indent = countOf( " CL_PLATFORM_EXTENSIONS: " );
75 std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_PROFILE: " << &szPlatformProfile[ 0 ] << std::endl;
76 std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_VERSION: " << &szPlatformVersion[ 0 ] << std::endl;
77 std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_NAME: " << &szPlatformName[ 0 ] << std::endl;
78 std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_VENDOR: " << &szPlatformVendor[ 0 ] << std::endl;
79 std::cout << std::left << std::setw( indent ) << " CL_PLATFORM_EXTENSIONS: " << &szPlatformExtensions[ 0 ] << std::endl;
80 std::cout << std::right << std::endl;
81}
82
83void prettyPrintDeviceInfo( const cl_device_id& dId )
84{

Callers 2

prettyPrintCLPlatformsFunction · 0.70
initializeCLFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected